Chromium Code Reviews| 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_event.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 }; | |
|
dsinclair
2015/06/24 19:05:09
There is also a ENABLED_FOR_ETW_EXPORT = 1 << 3 sh
| |
| 42 | |
| 43 virtual const uint8_t* GetCategoryGroupEnabled(const char* name) = 0; | |
| 44 virtual const char* GetCategoryGroupName( | |
| 45 const uint8_t* categoryEnabledFlag) = 0; | |
| 46 | |
| 47 virtual EventTracer::Handle AddTraceEvent( | |
| 48 char phase, const uint8_t* categoryEnabledFlag, const char* name, | |
| 49 uint64_t id, int32_t numArgs, const char** argNames, | |
| 50 const uint8_t* argTypes, const uint64_t* argValues, uint8_t flags) = 0; | |
| 51 | |
| 52 virtual void UpdateTraceEventDuration(const uint8_t* categoryEnabledFlag, | |
| 53 const char* name, | |
| 54 EventTracer::Handle handle) = 0; | |
| 55 | |
| 56 private: | |
| 57 static EventTracer* instance; | |
| 58 }; | |
| 59 } // namespace v8 | |
| 60 | |
| 61 #endif // INCLUDE_V8_TRACING_H_ | |
| OLD | NEW |