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