Index: include/v8-tracing.h |
diff --git a/include/v8-tracing.h b/include/v8-tracing.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..430a07ed200220c5eb0188d5de17719d649000cd |
--- /dev/null |
+++ b/include/v8-tracing.h |
@@ -0,0 +1,72 @@ |
+// Copyright 2015 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef INCLUDE_V8_TRACING_H_ |
+#define INCLUDE_V8_TRACING_H_ |
+ |
+#include <stdint.h> |
+ |
+namespace v8 { |
+ |
+// This will mark the trace event as disabled by default. The user will need |
+// to explicitly enable the event. |
+#define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name |
+ |
+class EventTracer { |
+ public: |
+ typedef uint64_t Handle; |
+ |
+ static EventTracer* GetInstance(); |
+ |
+ static void SetInstance(EventTracer* tracer) { |
+ delete (EventTracer::instance); |
+ EventTracer::instance = tracer; |
+ } |
+ |
+ virtual ~EventTracer() {} |
+ |
+ // 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 trace_log.h in |
+ // chromium. |
+ enum CategoryGroupEnabledFlags { |
+ // Category group enabled for the recording mode. |
+ kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0, |
+ // Category group enabled for the monitoring mode. |
+ kEnabledForMonitoring_CategoryGroupEnabledFlags = 1 << 1, |
+ // Category group enabled by SetEventCallbackEnabled(). |
+ kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2, |
+ // Category group enabled to export events to ETW. |
+ kEnabledForETWExport_CategoryGroupEnabledFlags = 1 << 3, |
+ }; |
+ |
+ virtual const uint8_t* GetCategoryGroupEnabled(const char* name) = 0; |
+ virtual const char* GetCategoryGroupName( |
+ const uint8_t* categoryEnabledFlag) = 0; |
+ |
+ virtual EventTracer::Handle AddTraceEvent( |
caseq
2015/08/25 22:02:46
I'm very positive about the CL in general, but rat
jochen (gone - plz use gerrit)
2015/09/08 14:20:34
agreed.
Either it should be part of the platform,
caseq
2015/09/08 17:57:49
Current trace macros implementation relies on stat
|
+ char phase, const uint8_t* categoryEnabledFlag, const char* name, |
+ uint64_t id, uint64_t context_id, uint64_t bind_id, int32_t numArgs, |
+ const char** argNames, const uint8_t* argTypes, const uint64_t* argValues, |
+ unsigned int flags) = 0; |
+ |
+ virtual void UpdateTraceEventDuration(const uint8_t* categoryEnabledFlag, |
+ const char* name, |
+ EventTracer::Handle handle) = 0; |
+ |
+ protected: |
+ EventTracer() {} |
+ |
+ private: |
+ static EventTracer* instance; |
+ |
+ // Disallow copying and assigning. |
+ EventTracer(const EventTracer&); |
+ void operator=(const EventTracer&); |
+}; |
+ |
+} // namespace v8 |
+ |
+#endif // INCLUDE_V8_TRACING_H_ |