11cb0ef41Sopenharmony_ci// Copyright 2016 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_LIBPLATFORM_V8_TRACING_H_ 61cb0ef41Sopenharmony_ci#define V8_LIBPLATFORM_V8_TRACING_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include <atomic> 91cb0ef41Sopenharmony_ci#include <fstream> 101cb0ef41Sopenharmony_ci#include <memory> 111cb0ef41Sopenharmony_ci#include <unordered_set> 121cb0ef41Sopenharmony_ci#include <vector> 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ci#include "libplatform/libplatform-export.h" 151cb0ef41Sopenharmony_ci#include "v8-platform.h" // NOLINT(build/include_directory) 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_cinamespace perfetto { 181cb0ef41Sopenharmony_cinamespace trace_processor { 191cb0ef41Sopenharmony_ciclass TraceProcessorStorage; 201cb0ef41Sopenharmony_ci} 211cb0ef41Sopenharmony_ciclass TracingSession; 221cb0ef41Sopenharmony_ci} 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_cinamespace v8 { 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_cinamespace base { 271cb0ef41Sopenharmony_ciclass Mutex; 281cb0ef41Sopenharmony_ci} // namespace base 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_cinamespace platform { 311cb0ef41Sopenharmony_cinamespace tracing { 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_ciclass TraceEventListener; 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ciconst int kTraceMaxNumArgs = 2; 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_ciclass V8_PLATFORM_EXPORT TraceObject { 381cb0ef41Sopenharmony_ci public: 391cb0ef41Sopenharmony_ci union ArgValue { 401cb0ef41Sopenharmony_ci uint64_t as_uint; 411cb0ef41Sopenharmony_ci int64_t as_int; 421cb0ef41Sopenharmony_ci double as_double; 431cb0ef41Sopenharmony_ci const void* as_pointer; 441cb0ef41Sopenharmony_ci const char* as_string; 451cb0ef41Sopenharmony_ci }; 461cb0ef41Sopenharmony_ci 471cb0ef41Sopenharmony_ci TraceObject() = default; 481cb0ef41Sopenharmony_ci ~TraceObject(); 491cb0ef41Sopenharmony_ci void Initialize( 501cb0ef41Sopenharmony_ci char phase, const uint8_t* category_enabled_flag, const char* name, 511cb0ef41Sopenharmony_ci const char* scope, uint64_t id, uint64_t bind_id, int num_args, 521cb0ef41Sopenharmony_ci const char** arg_names, const uint8_t* arg_types, 531cb0ef41Sopenharmony_ci const uint64_t* arg_values, 541cb0ef41Sopenharmony_ci std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables, 551cb0ef41Sopenharmony_ci unsigned int flags, int64_t timestamp, int64_t cpu_timestamp); 561cb0ef41Sopenharmony_ci void UpdateDuration(int64_t timestamp, int64_t cpu_timestamp); 571cb0ef41Sopenharmony_ci void InitializeForTesting( 581cb0ef41Sopenharmony_ci char phase, const uint8_t* category_enabled_flag, const char* name, 591cb0ef41Sopenharmony_ci const char* scope, uint64_t id, uint64_t bind_id, int num_args, 601cb0ef41Sopenharmony_ci const char** arg_names, const uint8_t* arg_types, 611cb0ef41Sopenharmony_ci const uint64_t* arg_values, 621cb0ef41Sopenharmony_ci std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables, 631cb0ef41Sopenharmony_ci unsigned int flags, int pid, int tid, int64_t ts, int64_t tts, 641cb0ef41Sopenharmony_ci uint64_t duration, uint64_t cpu_duration); 651cb0ef41Sopenharmony_ci 661cb0ef41Sopenharmony_ci int pid() const { return pid_; } 671cb0ef41Sopenharmony_ci int tid() const { return tid_; } 681cb0ef41Sopenharmony_ci char phase() const { return phase_; } 691cb0ef41Sopenharmony_ci const uint8_t* category_enabled_flag() const { 701cb0ef41Sopenharmony_ci return category_enabled_flag_; 711cb0ef41Sopenharmony_ci } 721cb0ef41Sopenharmony_ci const char* name() const { return name_; } 731cb0ef41Sopenharmony_ci const char* scope() const { return scope_; } 741cb0ef41Sopenharmony_ci uint64_t id() const { return id_; } 751cb0ef41Sopenharmony_ci uint64_t bind_id() const { return bind_id_; } 761cb0ef41Sopenharmony_ci int num_args() const { return num_args_; } 771cb0ef41Sopenharmony_ci const char** arg_names() { return arg_names_; } 781cb0ef41Sopenharmony_ci uint8_t* arg_types() { return arg_types_; } 791cb0ef41Sopenharmony_ci ArgValue* arg_values() { return arg_values_; } 801cb0ef41Sopenharmony_ci std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables() { 811cb0ef41Sopenharmony_ci return arg_convertables_; 821cb0ef41Sopenharmony_ci } 831cb0ef41Sopenharmony_ci unsigned int flags() const { return flags_; } 841cb0ef41Sopenharmony_ci int64_t ts() { return ts_; } 851cb0ef41Sopenharmony_ci int64_t tts() { return tts_; } 861cb0ef41Sopenharmony_ci uint64_t duration() { return duration_; } 871cb0ef41Sopenharmony_ci uint64_t cpu_duration() { return cpu_duration_; } 881cb0ef41Sopenharmony_ci 891cb0ef41Sopenharmony_ci private: 901cb0ef41Sopenharmony_ci int pid_; 911cb0ef41Sopenharmony_ci int tid_; 921cb0ef41Sopenharmony_ci char phase_; 931cb0ef41Sopenharmony_ci const char* name_; 941cb0ef41Sopenharmony_ci const char* scope_; 951cb0ef41Sopenharmony_ci const uint8_t* category_enabled_flag_; 961cb0ef41Sopenharmony_ci uint64_t id_; 971cb0ef41Sopenharmony_ci uint64_t bind_id_; 981cb0ef41Sopenharmony_ci int num_args_ = 0; 991cb0ef41Sopenharmony_ci const char* arg_names_[kTraceMaxNumArgs]; 1001cb0ef41Sopenharmony_ci uint8_t arg_types_[kTraceMaxNumArgs]; 1011cb0ef41Sopenharmony_ci ArgValue arg_values_[kTraceMaxNumArgs]; 1021cb0ef41Sopenharmony_ci std::unique_ptr<v8::ConvertableToTraceFormat> 1031cb0ef41Sopenharmony_ci arg_convertables_[kTraceMaxNumArgs]; 1041cb0ef41Sopenharmony_ci char* parameter_copy_storage_ = nullptr; 1051cb0ef41Sopenharmony_ci unsigned int flags_; 1061cb0ef41Sopenharmony_ci int64_t ts_; 1071cb0ef41Sopenharmony_ci int64_t tts_; 1081cb0ef41Sopenharmony_ci uint64_t duration_; 1091cb0ef41Sopenharmony_ci uint64_t cpu_duration_; 1101cb0ef41Sopenharmony_ci 1111cb0ef41Sopenharmony_ci // Disallow copy and assign 1121cb0ef41Sopenharmony_ci TraceObject(const TraceObject&) = delete; 1131cb0ef41Sopenharmony_ci void operator=(const TraceObject&) = delete; 1141cb0ef41Sopenharmony_ci}; 1151cb0ef41Sopenharmony_ci 1161cb0ef41Sopenharmony_ciclass V8_PLATFORM_EXPORT TraceWriter { 1171cb0ef41Sopenharmony_ci public: 1181cb0ef41Sopenharmony_ci TraceWriter() = default; 1191cb0ef41Sopenharmony_ci virtual ~TraceWriter() = default; 1201cb0ef41Sopenharmony_ci virtual void AppendTraceEvent(TraceObject* trace_event) = 0; 1211cb0ef41Sopenharmony_ci virtual void Flush() = 0; 1221cb0ef41Sopenharmony_ci 1231cb0ef41Sopenharmony_ci static TraceWriter* CreateJSONTraceWriter(std::ostream& stream); 1241cb0ef41Sopenharmony_ci static TraceWriter* CreateJSONTraceWriter(std::ostream& stream, 1251cb0ef41Sopenharmony_ci const std::string& tag); 1261cb0ef41Sopenharmony_ci 1271cb0ef41Sopenharmony_ci static TraceWriter* CreateSystemInstrumentationTraceWriter(); 1281cb0ef41Sopenharmony_ci 1291cb0ef41Sopenharmony_ci private: 1301cb0ef41Sopenharmony_ci // Disallow copy and assign 1311cb0ef41Sopenharmony_ci TraceWriter(const TraceWriter&) = delete; 1321cb0ef41Sopenharmony_ci void operator=(const TraceWriter&) = delete; 1331cb0ef41Sopenharmony_ci}; 1341cb0ef41Sopenharmony_ci 1351cb0ef41Sopenharmony_ciclass V8_PLATFORM_EXPORT TraceBufferChunk { 1361cb0ef41Sopenharmony_ci public: 1371cb0ef41Sopenharmony_ci explicit TraceBufferChunk(uint32_t seq); 1381cb0ef41Sopenharmony_ci 1391cb0ef41Sopenharmony_ci void Reset(uint32_t new_seq); 1401cb0ef41Sopenharmony_ci bool IsFull() const { return next_free_ == kChunkSize; } 1411cb0ef41Sopenharmony_ci TraceObject* AddTraceEvent(size_t* event_index); 1421cb0ef41Sopenharmony_ci TraceObject* GetEventAt(size_t index) { return &chunk_[index]; } 1431cb0ef41Sopenharmony_ci 1441cb0ef41Sopenharmony_ci uint32_t seq() const { return seq_; } 1451cb0ef41Sopenharmony_ci size_t size() const { return next_free_; } 1461cb0ef41Sopenharmony_ci 1471cb0ef41Sopenharmony_ci static const size_t kChunkSize = 64; 1481cb0ef41Sopenharmony_ci 1491cb0ef41Sopenharmony_ci private: 1501cb0ef41Sopenharmony_ci size_t next_free_ = 0; 1511cb0ef41Sopenharmony_ci TraceObject chunk_[kChunkSize]; 1521cb0ef41Sopenharmony_ci uint32_t seq_; 1531cb0ef41Sopenharmony_ci 1541cb0ef41Sopenharmony_ci // Disallow copy and assign 1551cb0ef41Sopenharmony_ci TraceBufferChunk(const TraceBufferChunk&) = delete; 1561cb0ef41Sopenharmony_ci void operator=(const TraceBufferChunk&) = delete; 1571cb0ef41Sopenharmony_ci}; 1581cb0ef41Sopenharmony_ci 1591cb0ef41Sopenharmony_ciclass V8_PLATFORM_EXPORT TraceBuffer { 1601cb0ef41Sopenharmony_ci public: 1611cb0ef41Sopenharmony_ci TraceBuffer() = default; 1621cb0ef41Sopenharmony_ci virtual ~TraceBuffer() = default; 1631cb0ef41Sopenharmony_ci 1641cb0ef41Sopenharmony_ci virtual TraceObject* AddTraceEvent(uint64_t* handle) = 0; 1651cb0ef41Sopenharmony_ci virtual TraceObject* GetEventByHandle(uint64_t handle) = 0; 1661cb0ef41Sopenharmony_ci virtual bool Flush() = 0; 1671cb0ef41Sopenharmony_ci 1681cb0ef41Sopenharmony_ci static const size_t kRingBufferChunks = 1024; 1691cb0ef41Sopenharmony_ci 1701cb0ef41Sopenharmony_ci static TraceBuffer* CreateTraceBufferRingBuffer(size_t max_chunks, 1711cb0ef41Sopenharmony_ci TraceWriter* trace_writer); 1721cb0ef41Sopenharmony_ci 1731cb0ef41Sopenharmony_ci private: 1741cb0ef41Sopenharmony_ci // Disallow copy and assign 1751cb0ef41Sopenharmony_ci TraceBuffer(const TraceBuffer&) = delete; 1761cb0ef41Sopenharmony_ci void operator=(const TraceBuffer&) = delete; 1771cb0ef41Sopenharmony_ci}; 1781cb0ef41Sopenharmony_ci 1791cb0ef41Sopenharmony_ci// Options determines how the trace buffer stores data. 1801cb0ef41Sopenharmony_cienum TraceRecordMode { 1811cb0ef41Sopenharmony_ci // Record until the trace buffer is full. 1821cb0ef41Sopenharmony_ci RECORD_UNTIL_FULL, 1831cb0ef41Sopenharmony_ci 1841cb0ef41Sopenharmony_ci // Record until the user ends the trace. The trace buffer is a fixed size 1851cb0ef41Sopenharmony_ci // and we use it as a ring buffer during recording. 1861cb0ef41Sopenharmony_ci RECORD_CONTINUOUSLY, 1871cb0ef41Sopenharmony_ci 1881cb0ef41Sopenharmony_ci // Record until the trace buffer is full, but with a huge buffer size. 1891cb0ef41Sopenharmony_ci RECORD_AS_MUCH_AS_POSSIBLE, 1901cb0ef41Sopenharmony_ci 1911cb0ef41Sopenharmony_ci // Echo to console. Events are discarded. 1921cb0ef41Sopenharmony_ci ECHO_TO_CONSOLE, 1931cb0ef41Sopenharmony_ci}; 1941cb0ef41Sopenharmony_ci 1951cb0ef41Sopenharmony_ciclass V8_PLATFORM_EXPORT TraceConfig { 1961cb0ef41Sopenharmony_ci public: 1971cb0ef41Sopenharmony_ci typedef std::vector<std::string> StringList; 1981cb0ef41Sopenharmony_ci 1991cb0ef41Sopenharmony_ci static TraceConfig* CreateDefaultTraceConfig(); 2001cb0ef41Sopenharmony_ci 2011cb0ef41Sopenharmony_ci TraceConfig() : enable_systrace_(false), enable_argument_filter_(false) {} 2021cb0ef41Sopenharmony_ci TraceRecordMode GetTraceRecordMode() const { return record_mode_; } 2031cb0ef41Sopenharmony_ci const StringList& GetEnabledCategories() const { 2041cb0ef41Sopenharmony_ci return included_categories_; 2051cb0ef41Sopenharmony_ci } 2061cb0ef41Sopenharmony_ci bool IsSystraceEnabled() const { return enable_systrace_; } 2071cb0ef41Sopenharmony_ci bool IsArgumentFilterEnabled() const { return enable_argument_filter_; } 2081cb0ef41Sopenharmony_ci 2091cb0ef41Sopenharmony_ci void SetTraceRecordMode(TraceRecordMode mode) { record_mode_ = mode; } 2101cb0ef41Sopenharmony_ci void EnableSystrace() { enable_systrace_ = true; } 2111cb0ef41Sopenharmony_ci void EnableArgumentFilter() { enable_argument_filter_ = true; } 2121cb0ef41Sopenharmony_ci 2131cb0ef41Sopenharmony_ci void AddIncludedCategory(const char* included_category); 2141cb0ef41Sopenharmony_ci 2151cb0ef41Sopenharmony_ci bool IsCategoryGroupEnabled(const char* category_group) const; 2161cb0ef41Sopenharmony_ci 2171cb0ef41Sopenharmony_ci private: 2181cb0ef41Sopenharmony_ci TraceRecordMode record_mode_; 2191cb0ef41Sopenharmony_ci bool enable_systrace_ : 1; 2201cb0ef41Sopenharmony_ci bool enable_argument_filter_ : 1; 2211cb0ef41Sopenharmony_ci StringList included_categories_; 2221cb0ef41Sopenharmony_ci 2231cb0ef41Sopenharmony_ci // Disallow copy and assign 2241cb0ef41Sopenharmony_ci TraceConfig(const TraceConfig&) = delete; 2251cb0ef41Sopenharmony_ci void operator=(const TraceConfig&) = delete; 2261cb0ef41Sopenharmony_ci}; 2271cb0ef41Sopenharmony_ci 2281cb0ef41Sopenharmony_ci#if defined(_MSC_VER) 2291cb0ef41Sopenharmony_ci#define V8_PLATFORM_NON_EXPORTED_BASE(code) \ 2301cb0ef41Sopenharmony_ci __pragma(warning(suppress : 4275)) code 2311cb0ef41Sopenharmony_ci#else 2321cb0ef41Sopenharmony_ci#define V8_PLATFORM_NON_EXPORTED_BASE(code) code 2331cb0ef41Sopenharmony_ci#endif // defined(_MSC_VER) 2341cb0ef41Sopenharmony_ci 2351cb0ef41Sopenharmony_ciclass V8_PLATFORM_EXPORT TracingController 2361cb0ef41Sopenharmony_ci : public V8_PLATFORM_NON_EXPORTED_BASE(v8::TracingController) { 2371cb0ef41Sopenharmony_ci public: 2381cb0ef41Sopenharmony_ci TracingController(); 2391cb0ef41Sopenharmony_ci ~TracingController() override; 2401cb0ef41Sopenharmony_ci 2411cb0ef41Sopenharmony_ci#if defined(V8_USE_PERFETTO) 2421cb0ef41Sopenharmony_ci // Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides 2431cb0ef41Sopenharmony_ci // the output stream for the JSON trace data. 2441cb0ef41Sopenharmony_ci void InitializeForPerfetto(std::ostream* output_stream); 2451cb0ef41Sopenharmony_ci // Provide an optional listener for testing that will receive trace events. 2461cb0ef41Sopenharmony_ci // Must be called before StartTracing(). 2471cb0ef41Sopenharmony_ci void SetTraceEventListenerForTesting(TraceEventListener* listener); 2481cb0ef41Sopenharmony_ci#else // defined(V8_USE_PERFETTO) 2491cb0ef41Sopenharmony_ci // The pointer returned from GetCategoryGroupEnabled() points to a value with 2501cb0ef41Sopenharmony_ci // zero or more of the following bits. Used in this class only. The 2511cb0ef41Sopenharmony_ci // TRACE_EVENT macros should only use the value as a bool. These values must 2521cb0ef41Sopenharmony_ci // be in sync with macro values in TraceEvent.h in Blink. 2531cb0ef41Sopenharmony_ci enum CategoryGroupEnabledFlags { 2541cb0ef41Sopenharmony_ci // Category group enabled for the recording mode. 2551cb0ef41Sopenharmony_ci ENABLED_FOR_RECORDING = 1 << 0, 2561cb0ef41Sopenharmony_ci // Category group enabled by SetEventCallbackEnabled(). 2571cb0ef41Sopenharmony_ci ENABLED_FOR_EVENT_CALLBACK = 1 << 2, 2581cb0ef41Sopenharmony_ci // Category group enabled to export events to ETW. 2591cb0ef41Sopenharmony_ci ENABLED_FOR_ETW_EXPORT = 1 << 3 2601cb0ef41Sopenharmony_ci }; 2611cb0ef41Sopenharmony_ci 2621cb0ef41Sopenharmony_ci // Takes ownership of |trace_buffer|. 2631cb0ef41Sopenharmony_ci void Initialize(TraceBuffer* trace_buffer); 2641cb0ef41Sopenharmony_ci 2651cb0ef41Sopenharmony_ci // v8::TracingController implementation. 2661cb0ef41Sopenharmony_ci const uint8_t* GetCategoryGroupEnabled(const char* category_group) override; 2671cb0ef41Sopenharmony_ci uint64_t AddTraceEvent( 2681cb0ef41Sopenharmony_ci char phase, const uint8_t* category_enabled_flag, const char* name, 2691cb0ef41Sopenharmony_ci const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args, 2701cb0ef41Sopenharmony_ci const char** arg_names, const uint8_t* arg_types, 2711cb0ef41Sopenharmony_ci const uint64_t* arg_values, 2721cb0ef41Sopenharmony_ci std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables, 2731cb0ef41Sopenharmony_ci unsigned int flags) override; 2741cb0ef41Sopenharmony_ci uint64_t AddTraceEventWithTimestamp( 2751cb0ef41Sopenharmony_ci char phase, const uint8_t* category_enabled_flag, const char* name, 2761cb0ef41Sopenharmony_ci const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args, 2771cb0ef41Sopenharmony_ci const char** arg_names, const uint8_t* arg_types, 2781cb0ef41Sopenharmony_ci const uint64_t* arg_values, 2791cb0ef41Sopenharmony_ci std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables, 2801cb0ef41Sopenharmony_ci unsigned int flags, int64_t timestamp) override; 2811cb0ef41Sopenharmony_ci void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, 2821cb0ef41Sopenharmony_ci const char* name, uint64_t handle) override; 2831cb0ef41Sopenharmony_ci 2841cb0ef41Sopenharmony_ci static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag); 2851cb0ef41Sopenharmony_ci#endif // !defined(V8_USE_PERFETTO) 2861cb0ef41Sopenharmony_ci 2871cb0ef41Sopenharmony_ci void AddTraceStateObserver( 2881cb0ef41Sopenharmony_ci v8::TracingController::TraceStateObserver* observer) override; 2891cb0ef41Sopenharmony_ci void RemoveTraceStateObserver( 2901cb0ef41Sopenharmony_ci v8::TracingController::TraceStateObserver* observer) override; 2911cb0ef41Sopenharmony_ci 2921cb0ef41Sopenharmony_ci void StartTracing(TraceConfig* trace_config); 2931cb0ef41Sopenharmony_ci void StopTracing(); 2941cb0ef41Sopenharmony_ci 2951cb0ef41Sopenharmony_ci protected: 2961cb0ef41Sopenharmony_ci#if !defined(V8_USE_PERFETTO) 2971cb0ef41Sopenharmony_ci virtual int64_t CurrentTimestampMicroseconds(); 2981cb0ef41Sopenharmony_ci virtual int64_t CurrentCpuTimestampMicroseconds(); 2991cb0ef41Sopenharmony_ci#endif // !defined(V8_USE_PERFETTO) 3001cb0ef41Sopenharmony_ci 3011cb0ef41Sopenharmony_ci private: 3021cb0ef41Sopenharmony_ci#if !defined(V8_USE_PERFETTO) 3031cb0ef41Sopenharmony_ci void UpdateCategoryGroupEnabledFlag(size_t category_index); 3041cb0ef41Sopenharmony_ci void UpdateCategoryGroupEnabledFlags(); 3051cb0ef41Sopenharmony_ci#endif // !defined(V8_USE_PERFETTO) 3061cb0ef41Sopenharmony_ci 3071cb0ef41Sopenharmony_ci std::unique_ptr<base::Mutex> mutex_; 3081cb0ef41Sopenharmony_ci std::unique_ptr<TraceConfig> trace_config_; 3091cb0ef41Sopenharmony_ci std::atomic_bool recording_{false}; 3101cb0ef41Sopenharmony_ci std::unordered_set<v8::TracingController::TraceStateObserver*> observers_; 3111cb0ef41Sopenharmony_ci 3121cb0ef41Sopenharmony_ci#if defined(V8_USE_PERFETTO) 3131cb0ef41Sopenharmony_ci std::ostream* output_stream_ = nullptr; 3141cb0ef41Sopenharmony_ci std::unique_ptr<perfetto::trace_processor::TraceProcessorStorage> 3151cb0ef41Sopenharmony_ci trace_processor_; 3161cb0ef41Sopenharmony_ci TraceEventListener* listener_for_testing_ = nullptr; 3171cb0ef41Sopenharmony_ci std::unique_ptr<perfetto::TracingSession> tracing_session_; 3181cb0ef41Sopenharmony_ci#else // !defined(V8_USE_PERFETTO) 3191cb0ef41Sopenharmony_ci std::unique_ptr<TraceBuffer> trace_buffer_; 3201cb0ef41Sopenharmony_ci#endif // !defined(V8_USE_PERFETTO) 3211cb0ef41Sopenharmony_ci 3221cb0ef41Sopenharmony_ci // Disallow copy and assign 3231cb0ef41Sopenharmony_ci TracingController(const TracingController&) = delete; 3241cb0ef41Sopenharmony_ci void operator=(const TracingController&) = delete; 3251cb0ef41Sopenharmony_ci}; 3261cb0ef41Sopenharmony_ci 3271cb0ef41Sopenharmony_ci#undef V8_PLATFORM_NON_EXPORTED_BASE 3281cb0ef41Sopenharmony_ci 3291cb0ef41Sopenharmony_ci} // namespace tracing 3301cb0ef41Sopenharmony_ci} // namespace platform 3311cb0ef41Sopenharmony_ci} // namespace v8 3321cb0ef41Sopenharmony_ci 3331cb0ef41Sopenharmony_ci#endif // V8_LIBPLATFORM_V8_TRACING_H_ 334