OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef INCLUDE_V8_TRACING_H_ | |
6 #define INCLUDE_V8_TRACING_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 namespace v8 { | |
11 | |
12 // This will mark the trace event as disabled by default. The user will need | |
13 // to explicitly enable the event. | |
14 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name | |
15 | |
16 class EventTracer { | |
17 public: | |
18 typedef uint64_t Handle; | |
19 | |
20 static EventTracer* GetInstance(); | |
21 | |
22 static void SetInstance(EventTracer* tracer) { | |
23 delete (EventTracer::instance); | |
24 EventTracer::instance = tracer; | |
25 } | |
26 | |
27 virtual ~EventTracer() {} | |
28 | |
29 // The pointer returned from GetCategoryGroupEnabled() points to a | |
30 // value with zero or more of the following bits. Used in this class only. | |
31 // The TRACE_EVENT macros should only use the value as a bool. | |
32 // These values must be in sync with macro values in trace_log.h in | |
33 // chromium. | |
34 enum CategoryGroupEnabledFlags { | |
35 // Category group enabled for the recording mode. | |
36 kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0, | |
37 // Category group enabled for the monitoring mode. | |
38 kEnabledForMonitoring_CategoryGroupEnabledFlags = 1 << 1, | |
39 // Category group enabled by SetEventCallbackEnabled(). | |
40 kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2, | |
41 // Category group enabled to export events to ETW. | |
42 kEnabledForETWExport_CategoryGroupEnabledFlags = 1 << 3, | |
43 }; | |
44 | |
45 virtual const uint8_t* GetCategoryGroupEnabled(const char* name) = 0; | |
46 virtual const char* GetCategoryGroupName( | |
47 const uint8_t* categoryEnabledFlag) = 0; | |
48 | |
49 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
| |
50 char phase, const uint8_t* categoryEnabledFlag, const char* name, | |
51 uint64_t id, uint64_t context_id, uint64_t bind_id, int32_t numArgs, | |
52 const char** argNames, const uint8_t* argTypes, const uint64_t* argValues, | |
53 unsigned int flags) = 0; | |
54 | |
55 virtual void UpdateTraceEventDuration(const uint8_t* categoryEnabledFlag, | |
56 const char* name, | |
57 EventTracer::Handle handle) = 0; | |
58 | |
59 protected: | |
60 EventTracer() {} | |
61 | |
62 private: | |
63 static EventTracer* instance; | |
64 | |
65 // Disallow copying and assigning. | |
66 EventTracer(const EventTracer&); | |
67 void operator=(const EventTracer&); | |
68 }; | |
69 | |
70 } // namespace v8 | |
71 | |
72 #endif // INCLUDE_V8_TRACING_H_ | |
OLD | NEW |