OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 the V8 project authors. All rights reserved. | |
2 // Redistribution and use in source and binary forms, with or without | |
3 // modification, are permitted provided that the following conditions are | |
4 // met: | |
5 // | |
6 // * Redistributions of source code must retain the above copyright | |
7 // notice, this list of conditions and the following disclaimer. | |
8 // * Redistributions in binary form must reproduce the above | |
9 // copyright notice, this list of conditions and the following | |
10 // disclaimer in the documentation and/or other materials provided | |
11 // with the distribution. | |
12 // * Neither the name of Google Inc. nor the names of its | |
13 // contributors may be used to endorse or promote products derived | |
14 // from this software without specific prior written permission. | |
15 // | |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
Yang
2015/03/13 07:52:10
Please use the shorter license header here and els
fmeawad
2015/03/17 01:18:04
Done.
| |
27 | |
28 #ifndef INCLUDE_V8_TRACING_H_ | |
29 #define INCLUDE_V8_TRACING_H_ | |
30 | |
31 #include <stdint.h> | |
32 | |
33 namespace v8 { | |
34 | |
35 // This will mark the trace event as disabled by default. The user will need | |
36 // to explicitly enable the event. | |
37 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name | |
38 | |
39 class EventTracer { | |
40 public: | |
41 typedef uint64_t Handle; | |
42 | |
43 static EventTracer* GetInstance(); | |
44 | |
45 static void SetInstance(EventTracer* tracer) { | |
46 delete (EventTracer::gInstance); | |
47 EventTracer::gInstance = tracer; | |
48 } | |
49 | |
50 virtual ~EventTracer() {} | |
51 | |
52 // The pointer returned from GetCategoryGroupEnabled() points to a | |
53 // value with zero or more of the following bits. Used in this class only. | |
54 // The TRACE_EVENT macros should only use the value as a bool. | |
55 // These values must be in sync with macro values in trace_event.h in | |
56 // chromium. | |
57 enum CategoryGroupEnabledFlags { | |
58 // Category group enabled for the recording mode. | |
59 kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0, | |
60 // Category group enabled for the monitoring mode. | |
61 kEnabledForMonitoring_CategoryGroupEnabledFlags = 1 << 1, | |
62 // Category group enabled by SetEventCallbackEnabled(). | |
63 kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2, | |
64 }; | |
65 | |
66 virtual const uint8_t* getCategoryGroupEnabled(const char* name) = 0; | |
Yang
2015/03/13 07:52:10
Please use all upper case here and below.
fmeawad
2015/03/17 01:18:04
Done.
| |
67 virtual const char* getCategoryGroupName( | |
68 const uint8_t* categoryEnabledFlag) = 0; | |
69 | |
70 virtual EventTracer::Handle addTraceEvent( | |
71 char phase, const uint8_t* categoryEnabledFlag, const char* name, | |
72 uint64_t id, int32_t numArgs, const char** argNames, | |
73 const uint8_t* argTypes, const uint64_t* argValues, uint8_t flags) = 0; | |
74 | |
75 virtual void updateTraceEventDuration(const uint8_t* categoryEnabledFlag, | |
76 const char* name, | |
77 EventTracer::Handle handle) = 0; | |
78 | |
79 private: | |
80 static EventTracer* gInstance; | |
Yang
2015/03/13 07:52:10
V8 doesn't use this naming convention. Just callin
fmeawad
2015/03/17 01:18:04
Done.
| |
81 }; | |
82 } // namespace v8 | |
83 | |
84 #endif // INCLUDE_V8_TRACING_H_ | |
OLD | NEW |