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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Collect statistical profiling information (ticks), default is off. The | 59 // Collect statistical profiling information (ticks), default is off. The |
60 // tick profiler requires code events, so --prof implies --log-code. | 60 // tick profiler requires code events, so --prof implies --log-code. |
61 | 61 |
62 // Forward declarations. | 62 // Forward declarations. |
63 class CodeEventListener; | 63 class CodeEventListener; |
64 class CpuProfiler; | 64 class CpuProfiler; |
65 class Isolate; | 65 class Isolate; |
66 class Log; | 66 class Log; |
67 class PositionsRecorder; | 67 class PositionsRecorder; |
68 class Profiler; | 68 class Profiler; |
| 69 class ProfilerListener; |
69 class Ticker; | 70 class Ticker; |
70 struct TickSample; | 71 struct TickSample; |
71 class RuntimeCallTimer; | 72 class RuntimeCallTimer; |
72 | 73 |
73 #undef LOG | 74 #undef LOG |
74 #define LOG(isolate, Call) \ | 75 #define LOG(isolate, Call) \ |
75 do { \ | 76 do { \ |
76 v8::internal::Logger* logger = \ | 77 v8::internal::Logger* logger = \ |
77 (isolate)->logger(); \ | 78 (isolate)->logger(); \ |
78 if (logger->is_logging()) \ | 79 if (logger->is_logging()) \ |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 161 |
161 // Acquires resources for logging if the right flags are set. | 162 // Acquires resources for logging if the right flags are set. |
162 bool SetUp(Isolate* isolate); | 163 bool SetUp(Isolate* isolate); |
163 | 164 |
164 // Sets the current code event handler. | 165 // Sets the current code event handler. |
165 void SetCodeEventHandler(uint32_t options, | 166 void SetCodeEventHandler(uint32_t options, |
166 JitCodeEventHandler event_handler); | 167 JitCodeEventHandler event_handler); |
167 | 168 |
168 sampler::Sampler* sampler(); | 169 sampler::Sampler* sampler(); |
169 | 170 |
| 171 ProfilerListener* profiler_listener() { return profiler_listener_; } |
| 172 |
170 // Frees resources acquired in SetUp. | 173 // Frees resources acquired in SetUp. |
171 // When a temporary file is used for the log, returns its stream descriptor, | 174 // When a temporary file is used for the log, returns its stream descriptor, |
172 // leaving the file open. | 175 // leaving the file open. |
173 FILE* TearDown(); | 176 FILE* TearDown(); |
174 | 177 |
175 // Emits an event with a string value -> (name, value). | 178 // Emits an event with a string value -> (name, value). |
176 void StringEvent(const char* name, const char* value); | 179 void StringEvent(const char* name, const char* value); |
177 | 180 |
178 // Emits an event with an int value -> (name, value). | 181 // Emits an event with an int value -> (name, value). |
179 void IntEvent(const char* name, int value); | 182 void IntEvent(const char* name, int value); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 friend class Profiler; | 390 friend class Profiler; |
388 template <StateTag Tag> friend class VMState; | 391 template <StateTag Tag> friend class VMState; |
389 friend class LoggerTestHelper; | 392 friend class LoggerTestHelper; |
390 | 393 |
391 bool is_logging_; | 394 bool is_logging_; |
392 Log* log_; | 395 Log* log_; |
393 PerfBasicLogger* perf_basic_logger_; | 396 PerfBasicLogger* perf_basic_logger_; |
394 PerfJitLogger* perf_jit_logger_; | 397 PerfJitLogger* perf_jit_logger_; |
395 LowLevelLogger* ll_logger_; | 398 LowLevelLogger* ll_logger_; |
396 JitLogger* jit_logger_; | 399 JitLogger* jit_logger_; |
| 400 ProfilerListener* profiler_listener_; |
397 List<CodeEventListener*> listeners_; | 401 List<CodeEventListener*> listeners_; |
398 | 402 |
399 // Guards against multiple calls to TearDown() that can happen in some tests. | 403 // Guards against multiple calls to TearDown() that can happen in some tests. |
400 // 'true' between SetUp() and TearDown(). | 404 // 'true' between SetUp() and TearDown(). |
401 bool is_initialized_; | 405 bool is_initialized_; |
402 | 406 |
403 base::ElapsedTimer timer_; | 407 base::ElapsedTimer timer_; |
404 | 408 |
405 friend class CpuProfiler; | 409 friend class CpuProfiler; |
406 }; | 410 }; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 526 |
523 NameBuffer* name_buffer_; | 527 NameBuffer* name_buffer_; |
524 }; | 528 }; |
525 | 529 |
526 | 530 |
527 } // namespace internal | 531 } // namespace internal |
528 } // namespace v8 | 532 } // namespace v8 |
529 | 533 |
530 | 534 |
531 #endif // V8_LOG_H_ | 535 #endif // V8_LOG_H_ |
OLD | NEW |