upgrade node and swig
This commit is contained in:
@@ -5,13 +5,21 @@
|
||||
#ifndef V8_LIBPLATFORM_V8_TRACING_H_
|
||||
#define V8_LIBPLATFORM_V8_TRACING_H_
|
||||
|
||||
#include <atomic>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "libplatform/libplatform-export.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
#include "v8-platform.h" // NOLINT(build/include_directory)
|
||||
|
||||
namespace perfetto {
|
||||
namespace trace_processor {
|
||||
class TraceProcessorStorage;
|
||||
}
|
||||
class TracingSession;
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
|
||||
@@ -22,12 +30,13 @@ class Mutex;
|
||||
namespace platform {
|
||||
namespace tracing {
|
||||
|
||||
class TraceEventListener;
|
||||
|
||||
const int kTraceMaxNumArgs = 2;
|
||||
|
||||
class V8_PLATFORM_EXPORT TraceObject {
|
||||
public:
|
||||
union ArgValue {
|
||||
bool as_bool;
|
||||
uint64_t as_uint;
|
||||
int64_t as_int;
|
||||
double as_double;
|
||||
@@ -35,7 +44,7 @@ class V8_PLATFORM_EXPORT TraceObject {
|
||||
const char* as_string;
|
||||
};
|
||||
|
||||
TraceObject() {}
|
||||
TraceObject() = default;
|
||||
~TraceObject();
|
||||
void Initialize(
|
||||
char phase, const uint8_t* category_enabled_flag, const char* name,
|
||||
@@ -106,8 +115,8 @@ class V8_PLATFORM_EXPORT TraceObject {
|
||||
|
||||
class V8_PLATFORM_EXPORT TraceWriter {
|
||||
public:
|
||||
TraceWriter() {}
|
||||
virtual ~TraceWriter() {}
|
||||
TraceWriter() = default;
|
||||
virtual ~TraceWriter() = default;
|
||||
virtual void AppendTraceEvent(TraceObject* trace_event) = 0;
|
||||
virtual void Flush() = 0;
|
||||
|
||||
@@ -115,6 +124,8 @@ class V8_PLATFORM_EXPORT TraceWriter {
|
||||
static TraceWriter* CreateJSONTraceWriter(std::ostream& stream,
|
||||
const std::string& tag);
|
||||
|
||||
static TraceWriter* CreateSystemInstrumentationTraceWriter();
|
||||
|
||||
private:
|
||||
// Disallow copy and assign
|
||||
TraceWriter(const TraceWriter&) = delete;
|
||||
@@ -147,8 +158,8 @@ class V8_PLATFORM_EXPORT TraceBufferChunk {
|
||||
|
||||
class V8_PLATFORM_EXPORT TraceBuffer {
|
||||
public:
|
||||
TraceBuffer() {}
|
||||
virtual ~TraceBuffer() {}
|
||||
TraceBuffer() = default;
|
||||
virtual ~TraceBuffer() = default;
|
||||
|
||||
virtual TraceObject* AddTraceEvent(uint64_t* handle) = 0;
|
||||
virtual TraceObject* GetEventByHandle(uint64_t handle) = 0;
|
||||
@@ -189,6 +200,9 @@ class V8_PLATFORM_EXPORT TraceConfig {
|
||||
|
||||
TraceConfig() : enable_systrace_(false), enable_argument_filter_(false) {}
|
||||
TraceRecordMode GetTraceRecordMode() const { return record_mode_; }
|
||||
const StringList& GetEnabledCategories() const {
|
||||
return included_categories_;
|
||||
}
|
||||
bool IsSystraceEnabled() const { return enable_systrace_; }
|
||||
bool IsArgumentFilterEnabled() const { return enable_argument_filter_; }
|
||||
|
||||
@@ -221,12 +235,21 @@ class V8_PLATFORM_EXPORT TraceConfig {
|
||||
class V8_PLATFORM_EXPORT TracingController
|
||||
: public V8_PLATFORM_NON_EXPORTED_BASE(v8::TracingController) {
|
||||
public:
|
||||
enum Mode { DISABLED = 0, RECORDING_MODE };
|
||||
TracingController();
|
||||
~TracingController() override;
|
||||
|
||||
// The pointer returned from GetCategoryGroupEnabledInternal() points to a
|
||||
// value with zero or more of the following bits. Used in this class only.
|
||||
// The TRACE_EVENT macros should only use the value as a bool.
|
||||
// These values must be in sync with macro values in TraceEvent.h in Blink.
|
||||
#if defined(V8_USE_PERFETTO)
|
||||
// Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides
|
||||
// the output stream for the JSON trace data.
|
||||
void InitializeForPerfetto(std::ostream* output_stream);
|
||||
// Provide an optional listener for testing that will receive trace events.
|
||||
// Must be called before StartTracing().
|
||||
void SetTraceEventListenerForTesting(TraceEventListener* listener);
|
||||
#else // defined(V8_USE_PERFETTO)
|
||||
// The pointer returned from GetCategoryGroupEnabled() points to a value with
|
||||
// zero or more of the following bits. Used in this class only. The
|
||||
// TRACE_EVENT macros should only use the value as a bool. These values must
|
||||
// be in sync with macro values in TraceEvent.h in Blink.
|
||||
enum CategoryGroupEnabledFlags {
|
||||
// Category group enabled for the recording mode.
|
||||
ENABLED_FOR_RECORDING = 1 << 0,
|
||||
@@ -236,8 +259,7 @@ class V8_PLATFORM_EXPORT TracingController
|
||||
ENABLED_FOR_ETW_EXPORT = 1 << 3
|
||||
};
|
||||
|
||||
TracingController();
|
||||
~TracingController() override;
|
||||
// Takes ownership of |trace_buffer|.
|
||||
void Initialize(TraceBuffer* trace_buffer);
|
||||
|
||||
// v8::TracingController implementation.
|
||||
@@ -258,30 +280,44 @@ class V8_PLATFORM_EXPORT TracingController
|
||||
unsigned int flags, int64_t timestamp) override;
|
||||
void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
|
||||
const char* name, uint64_t handle) override;
|
||||
|
||||
static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag);
|
||||
|
||||
void AddTraceStateObserver(
|
||||
v8::TracingController::TraceStateObserver* observer) override;
|
||||
void RemoveTraceStateObserver(
|
||||
v8::TracingController::TraceStateObserver* observer) override;
|
||||
#endif // !defined(V8_USE_PERFETTO)
|
||||
|
||||
void StartTracing(TraceConfig* trace_config);
|
||||
void StopTracing();
|
||||
|
||||
static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag);
|
||||
|
||||
protected:
|
||||
#if !defined(V8_USE_PERFETTO)
|
||||
virtual int64_t CurrentTimestampMicroseconds();
|
||||
virtual int64_t CurrentCpuTimestampMicroseconds();
|
||||
#endif // !defined(V8_USE_PERFETTO)
|
||||
|
||||
private:
|
||||
const uint8_t* GetCategoryGroupEnabledInternal(const char* category_group);
|
||||
#if !defined(V8_USE_PERFETTO)
|
||||
void UpdateCategoryGroupEnabledFlag(size_t category_index);
|
||||
void UpdateCategoryGroupEnabledFlags();
|
||||
#endif // !defined(V8_USE_PERFETTO)
|
||||
|
||||
std::unique_ptr<TraceBuffer> trace_buffer_;
|
||||
std::unique_ptr<TraceConfig> trace_config_;
|
||||
std::unique_ptr<base::Mutex> mutex_;
|
||||
std::unique_ptr<TraceConfig> trace_config_;
|
||||
std::atomic_bool recording_{false};
|
||||
|
||||
#if defined(V8_USE_PERFETTO)
|
||||
std::ostream* output_stream_ = nullptr;
|
||||
std::unique_ptr<perfetto::trace_processor::TraceProcessorStorage>
|
||||
trace_processor_;
|
||||
TraceEventListener* listener_for_testing_ = nullptr;
|
||||
std::unique_ptr<perfetto::TracingSession> tracing_session_;
|
||||
#else // !defined(V8_USE_PERFETTO)
|
||||
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
||||
Mode mode_ = DISABLED;
|
||||
std::unique_ptr<TraceBuffer> trace_buffer_;
|
||||
#endif // !defined(V8_USE_PERFETTO)
|
||||
|
||||
// Disallow copy and assign
|
||||
TracingController(const TracingController&) = delete;
|
||||
|
||||
Reference in New Issue
Block a user