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