Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: include/v8-tracing.h

Issue 988893003: Implement tracing interface for v8 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a Unittest for trace-event Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | src/log-inl.h » ('j') | src/tracing/trace-event.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8-tracing.h
diff --git a/include/v8-tracing.h b/include/v8-tracing.h
new file mode 100644
index 0000000000000000000000000000000000000000..6436387b4500eacbe01397a3d95b7e206c1b3ab2
--- /dev/null
+++ b/include/v8-tracing.h
@@ -0,0 +1,61 @@
+// 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_event.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,
+ };
dsinclair 2015/06/24 19:05:09 There is also a ENABLED_FOR_ETW_EXPORT = 1 << 3 sh
+
+ virtual const uint8_t* GetCategoryGroupEnabled(const char* name) = 0;
+ virtual const char* GetCategoryGroupName(
+ const uint8_t* categoryEnabledFlag) = 0;
+
+ virtual EventTracer::Handle AddTraceEvent(
+ char phase, const uint8_t* categoryEnabledFlag, const char* name,
+ uint64_t id, int32_t numArgs, const char** argNames,
+ const uint8_t* argTypes, const uint64_t* argValues, uint8_t flags) = 0;
+
+ virtual void UpdateTraceEventDuration(const uint8_t* categoryEnabledFlag,
+ const char* name,
+ EventTracer::Handle handle) = 0;
+
+ private:
+ static EventTracer* instance;
+};
+} // namespace v8
+
+#endif // INCLUDE_V8_TRACING_H_
« no previous file with comments | « BUILD.gn ('k') | src/log-inl.h » ('j') | src/tracing/trace-event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698