| 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/code-events.h" | 14 #include "src/code-events.h" |
| 15 #include "src/isolate.h" | 15 #include "src/isolate.h" |
| 16 #include "src/objects.h" | 16 #include "src/objects.h" |
| 17 | 17 |
| 18 namespace v8 { | 18 namespace v8 { |
| 19 | 19 |
| 20 namespace base { | 20 struct TickSample; |
| 21 class Semaphore; | |
| 22 } | |
| 23 | 21 |
| 24 namespace sampler { | 22 namespace sampler { |
| 25 class Sampler; | 23 class Sampler; |
| 26 } | 24 } |
| 27 | 25 |
| 28 namespace internal { | 26 namespace internal { |
| 29 | 27 |
| 30 // Logger is used for collecting logging information from V8 during | 28 // Logger is used for collecting logging information from V8 during |
| 31 // execution. The result is dumped to a file. | 29 // execution. The result is dumped to a file. |
| 32 // | 30 // |
| (...skipping 25 matching lines...) Expand all Loading... |
| 58 // Specify the name of the logfile, default is "v8.log". | 56 // Specify the name of the logfile, default is "v8.log". |
| 59 // | 57 // |
| 60 // --prof | 58 // --prof |
| 61 // Collect statistical profiling information (ticks), default is off. The | 59 // Collect statistical profiling information (ticks), default is off. The |
| 62 // tick profiler requires code events, so --prof implies --log-code. | 60 // tick profiler requires code events, so --prof implies --log-code. |
| 63 | 61 |
| 64 // Forward declarations. | 62 // Forward declarations. |
| 65 class CodeEventListener; | 63 class CodeEventListener; |
| 66 class CpuProfiler; | 64 class CpuProfiler; |
| 67 class Isolate; | 65 class Isolate; |
| 66 class JitLogger; |
| 68 class Log; | 67 class Log; |
| 68 class LowLevelLogger; |
| 69 class PerfBasicLogger; |
| 70 class PerfJitLogger; |
| 69 class Profiler; | 71 class Profiler; |
| 72 class ProfilerListener; |
| 73 class RuntimeCallTimer; |
| 70 class Ticker; | 74 class Ticker; |
| 71 class RuntimeCallTimer; | |
| 72 struct TickSample; | |
| 73 | 75 |
| 74 #undef LOG | 76 #undef LOG |
| 75 #define LOG(isolate, Call) \ | 77 #define LOG(isolate, Call) \ |
| 76 do { \ | 78 do { \ |
| 77 v8::internal::Logger* logger = (isolate)->logger(); \ | 79 v8::internal::Logger* logger = (isolate)->logger(); \ |
| 78 if (logger->is_logging()) logger->Call; \ | 80 if (logger->is_logging()) logger->Call; \ |
| 79 } while (false) | 81 } while (false) |
| 80 | 82 |
| 81 #define LOG_CODE_EVENT(isolate, Call) \ | 83 #define LOG_CODE_EVENT(isolate, Call) \ |
| 82 do { \ | 84 do { \ |
| 83 v8::internal::Logger* logger = (isolate)->logger(); \ | 85 v8::internal::Logger* logger = (isolate)->logger(); \ |
| 84 if (logger->is_logging_code_events()) logger->Call; \ | 86 if (logger->is_logging_code_events()) logger->Call; \ |
| 85 } while (false) | 87 } while (false) |
| 86 | 88 |
| 87 class JitLogger; | |
| 88 class PerfBasicLogger; | |
| 89 class LowLevelLogger; | |
| 90 class PerfJitLogger; | |
| 91 class ProfilerListener; | |
| 92 | |
| 93 class Logger : public CodeEventListener { | 89 class Logger : public CodeEventListener { |
| 94 public: | 90 public: |
| 95 enum StartEnd { START = 0, END = 1 }; | 91 enum StartEnd { START = 0, END = 1 }; |
| 96 | 92 |
| 97 // Acquires resources for logging if the right flags are set. | 93 // Acquires resources for logging if the right flags are set. |
| 98 bool SetUp(Isolate* isolate); | 94 bool SetUp(Isolate* isolate); |
| 99 | 95 |
| 100 // Sets the current code event handler. | 96 // Sets the current code event handler. |
| 101 void SetCodeEventHandler(uint32_t options, | 97 void SetCodeEventHandler(uint32_t options, |
| 102 JitCodeEventHandler event_handler); | 98 JitCodeEventHandler event_handler); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 419 |
| 424 NameBuffer* name_buffer_; | 420 NameBuffer* name_buffer_; |
| 425 }; | 421 }; |
| 426 | 422 |
| 427 | 423 |
| 428 } // namespace internal | 424 } // namespace internal |
| 429 } // namespace v8 | 425 } // namespace v8 |
| 430 | 426 |
| 431 | 427 |
| 432 #endif // V8_LOG_H_ | 428 #endif // V8_LOG_H_ |
| OLD | NEW |