OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_LOG_H_ | 5 #ifndef V8_LOG_H_ |
6 #define V8_LOG_H_ | 6 #define V8_LOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
11 #include "src/base/compiler-specific.h" | 11 #include "src/base/compiler-specific.h" |
12 #include "src/base/platform/elapsed-timer.h" | 12 #include "src/base/platform/elapsed-timer.h" |
13 #include "src/base/platform/platform.h" | 13 #include "src/base/platform/platform.h" |
14 #include "src/objects.h" | 14 #include "src/objects.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class Semaphore; | 19 class Semaphore; |
20 } | 20 } |
21 | 21 |
| 22 namespace sampler { |
| 23 class Sampler; |
| 24 } |
| 25 |
22 namespace internal { | 26 namespace internal { |
23 | 27 |
24 // Logger is used for collecting logging information from V8 during | 28 // Logger is used for collecting logging information from V8 during |
25 // execution. The result is dumped to a file. | 29 // execution. The result is dumped to a file. |
26 // | 30 // |
27 // Available command line flags: | 31 // Available command line flags: |
28 // | 32 // |
29 // --log | 33 // --log |
30 // Minimal logging (no API, code, or GC sample events), default is off. | 34 // Minimal logging (no API, code, or GC sample events), default is off. |
31 // | 35 // |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ | 138 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ |
135 V(NATIVE_SCRIPT_TAG, "Script") | 139 V(NATIVE_SCRIPT_TAG, "Script") |
136 // Note that 'NATIVE_' cases for functions and scripts are mapped onto | 140 // Note that 'NATIVE_' cases for functions and scripts are mapped onto |
137 // original tags when writing to the log. | 141 // original tags when writing to the log. |
138 | 142 |
139 | 143 |
140 class JitLogger; | 144 class JitLogger; |
141 class PerfBasicLogger; | 145 class PerfBasicLogger; |
142 class LowLevelLogger; | 146 class LowLevelLogger; |
143 class PerfJitLogger; | 147 class PerfJitLogger; |
144 class Sampler; | |
145 | 148 |
146 class Logger { | 149 class Logger { |
147 public: | 150 public: |
148 enum StartEnd { START = 0, END = 1 }; | 151 enum StartEnd { START = 0, END = 1 }; |
149 | 152 |
150 #define DECLARE_ENUM(enum_item, ignore) enum_item, | 153 #define DECLARE_ENUM(enum_item, ignore) enum_item, |
151 enum LogEventsAndTags { | 154 enum LogEventsAndTags { |
152 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) | 155 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) |
153 NUMBER_OF_LOG_EVENTS | 156 NUMBER_OF_LOG_EVENTS |
154 }; | 157 }; |
155 #undef DECLARE_ENUM | 158 #undef DECLARE_ENUM |
156 | 159 |
157 // Acquires resources for logging if the right flags are set. | 160 // Acquires resources for logging if the right flags are set. |
158 bool SetUp(Isolate* isolate); | 161 bool SetUp(Isolate* isolate); |
159 | 162 |
160 // Sets the current code event handler. | 163 // Sets the current code event handler. |
161 void SetCodeEventHandler(uint32_t options, | 164 void SetCodeEventHandler(uint32_t options, |
162 JitCodeEventHandler event_handler); | 165 JitCodeEventHandler event_handler); |
163 | 166 |
164 Sampler* sampler(); | 167 sampler::Sampler* sampler(); |
165 | 168 |
166 // Frees resources acquired in SetUp. | 169 // Frees resources acquired in SetUp. |
167 // When a temporary file is used for the log, returns its stream descriptor, | 170 // When a temporary file is used for the log, returns its stream descriptor, |
168 // leaving the file open. | 171 // leaving the file open. |
169 FILE* TearDown(); | 172 FILE* TearDown(); |
170 | 173 |
171 // Emits an event with a string value -> (name, value). | 174 // Emits an event with a string value -> (name, value). |
172 void StringEvent(const char* name, const char* value); | 175 void StringEvent(const char* name, const char* value); |
173 | 176 |
174 // Emits an event with an int value -> (name, value). | 177 // Emits an event with an int value -> (name, value). |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 520 |
518 NameBuffer* name_buffer_; | 521 NameBuffer* name_buffer_; |
519 }; | 522 }; |
520 | 523 |
521 | 524 |
522 } // namespace internal | 525 } // namespace internal |
523 } // namespace v8 | 526 } // namespace v8 |
524 | 527 |
525 | 528 |
526 #endif // V8_LOG_H_ | 529 #endif // V8_LOG_H_ |
OLD | NEW |