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/platform/elapsed-timer.h" | 11 #include "src/base/platform/elapsed-timer.h" |
12 #include "src/base/platform/platform.h" | 12 #include "src/base/platform/platform.h" |
13 #include "src/objects.h" | 13 #include "src/objects.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 | 16 |
| 17 class V8Sampler; |
| 18 |
17 namespace base { | 19 namespace base { |
18 class Semaphore; | 20 class Semaphore; |
19 } | 21 } |
20 | 22 |
21 namespace internal { | 23 namespace internal { |
22 | 24 |
23 // Logger is used for collecting logging information from V8 during | 25 // Logger is used for collecting logging information from V8 during |
24 // execution. The result is dumped to a file. | 26 // execution. The result is dumped to a file. |
25 // | 27 // |
26 // Available command line flags: | 28 // Available command line flags: |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 V(NATIVE_FUNCTION_TAG, "Function") \ | 141 V(NATIVE_FUNCTION_TAG, "Function") \ |
140 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ | 142 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ |
141 V(NATIVE_SCRIPT_TAG, "Script") | 143 V(NATIVE_SCRIPT_TAG, "Script") |
142 // Note that 'NATIVE_' cases for functions and scripts are mapped onto | 144 // Note that 'NATIVE_' cases for functions and scripts are mapped onto |
143 // original tags when writing to the log. | 145 // original tags when writing to the log. |
144 | 146 |
145 | 147 |
146 class JitLogger; | 148 class JitLogger; |
147 class PerfBasicLogger; | 149 class PerfBasicLogger; |
148 class LowLevelLogger; | 150 class LowLevelLogger; |
149 class Sampler; | 151 // class Sampler; |
150 | 152 |
151 class Logger { | 153 class Logger { |
152 public: | 154 public: |
153 enum StartEnd { START = 0, END = 1 }; | 155 enum StartEnd { START = 0, END = 1 }; |
154 | 156 |
155 #define DECLARE_ENUM(enum_item, ignore) enum_item, | 157 #define DECLARE_ENUM(enum_item, ignore) enum_item, |
156 enum LogEventsAndTags { | 158 enum LogEventsAndTags { |
157 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) | 159 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) |
158 NUMBER_OF_LOG_EVENTS | 160 NUMBER_OF_LOG_EVENTS |
159 }; | 161 }; |
160 #undef DECLARE_ENUM | 162 #undef DECLARE_ENUM |
161 | 163 |
162 // Acquires resources for logging if the right flags are set. | 164 // Acquires resources for logging if the right flags are set. |
163 bool SetUp(Isolate* isolate); | 165 bool SetUp(Isolate* isolate); |
164 | 166 |
165 // Sets the current code event handler. | 167 // Sets the current code event handler. |
166 void SetCodeEventHandler(uint32_t options, | 168 void SetCodeEventHandler(uint32_t options, |
167 JitCodeEventHandler event_handler); | 169 JitCodeEventHandler event_handler); |
168 | 170 |
169 Sampler* sampler(); | 171 //Sampler* sampler(); |
| 172 V8Sampler* sampler(); |
170 | 173 |
171 // Frees resources acquired in SetUp. | 174 // Frees resources acquired in SetUp. |
172 // When a temporary file is used for the log, returns its stream descriptor, | 175 // When a temporary file is used for the log, returns its stream descriptor, |
173 // leaving the file open. | 176 // leaving the file open. |
174 FILE* TearDown(); | 177 FILE* TearDown(); |
175 | 178 |
176 // Emits an event with a string value -> (name, value). | 179 // Emits an event with a string value -> (name, value). |
177 void StringEvent(const char* name, const char* value); | 180 void StringEvent(const char* name, const char* value); |
178 | 181 |
179 // Emits an event with an int value -> (name, value). | 182 // Emits an event with an int value -> (name, value). |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 529 |
527 NameBuffer* name_buffer_; | 530 NameBuffer* name_buffer_; |
528 }; | 531 }; |
529 | 532 |
530 | 533 |
531 } // namespace internal | 534 } // namespace internal |
532 } // namespace v8 | 535 } // namespace v8 |
533 | 536 |
534 | 537 |
535 #endif // V8_LOG_H_ | 538 #endif // V8_LOG_H_ |
OLD | NEW |