| 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/objects.h" | 14 #include "src/objects.h" |
| 15 | 15 |
| 16 namespace v8 { | 16 namespace v8 { |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class Semaphore; | 19 class Semaphore; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace sampler { | |
| 23 class Sampler; | |
| 24 } | |
| 25 | |
| 26 namespace internal { | 22 namespace internal { |
| 27 | 23 |
| 28 // Logger is used for collecting logging information from V8 during | 24 // Logger is used for collecting logging information from V8 during |
| 29 // execution. The result is dumped to a file. | 25 // execution. The result is dumped to a file. |
| 30 // | 26 // |
| 31 // Available command line flags: | 27 // Available command line flags: |
| 32 // | 28 // |
| 33 // --log | 29 // --log |
| 34 // Minimal logging (no API, code, or GC sample events), default is off. | 30 // Minimal logging (no API, code, or GC sample events), default is off. |
| 35 // | 31 // |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ | 134 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ |
| 139 V(NATIVE_SCRIPT_TAG, "Script") | 135 V(NATIVE_SCRIPT_TAG, "Script") |
| 140 // Note that 'NATIVE_' cases for functions and scripts are mapped onto | 136 // Note that 'NATIVE_' cases for functions and scripts are mapped onto |
| 141 // original tags when writing to the log. | 137 // original tags when writing to the log. |
| 142 | 138 |
| 143 | 139 |
| 144 class JitLogger; | 140 class JitLogger; |
| 145 class PerfBasicLogger; | 141 class PerfBasicLogger; |
| 146 class LowLevelLogger; | 142 class LowLevelLogger; |
| 147 class PerfJitLogger; | 143 class PerfJitLogger; |
| 144 class Sampler; |
| 148 | 145 |
| 149 class Logger { | 146 class Logger { |
| 150 public: | 147 public: |
| 151 enum StartEnd { START = 0, END = 1 }; | 148 enum StartEnd { START = 0, END = 1 }; |
| 152 | 149 |
| 153 #define DECLARE_ENUM(enum_item, ignore) enum_item, | 150 #define DECLARE_ENUM(enum_item, ignore) enum_item, |
| 154 enum LogEventsAndTags { | 151 enum LogEventsAndTags { |
| 155 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) | 152 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) |
| 156 NUMBER_OF_LOG_EVENTS | 153 NUMBER_OF_LOG_EVENTS |
| 157 }; | 154 }; |
| 158 #undef DECLARE_ENUM | 155 #undef DECLARE_ENUM |
| 159 | 156 |
| 160 // Acquires resources for logging if the right flags are set. | 157 // Acquires resources for logging if the right flags are set. |
| 161 bool SetUp(Isolate* isolate); | 158 bool SetUp(Isolate* isolate); |
| 162 | 159 |
| 163 // Sets the current code event handler. | 160 // Sets the current code event handler. |
| 164 void SetCodeEventHandler(uint32_t options, | 161 void SetCodeEventHandler(uint32_t options, |
| 165 JitCodeEventHandler event_handler); | 162 JitCodeEventHandler event_handler); |
| 166 | 163 |
| 167 sampler::Sampler* sampler(); | 164 Sampler* sampler(); |
| 168 | 165 |
| 169 // Frees resources acquired in SetUp. | 166 // Frees resources acquired in SetUp. |
| 170 // When a temporary file is used for the log, returns its stream descriptor, | 167 // When a temporary file is used for the log, returns its stream descriptor, |
| 171 // leaving the file open. | 168 // leaving the file open. |
| 172 FILE* TearDown(); | 169 FILE* TearDown(); |
| 173 | 170 |
| 174 // Emits an event with a string value -> (name, value). | 171 // Emits an event with a string value -> (name, value). |
| 175 void StringEvent(const char* name, const char* value); | 172 void StringEvent(const char* name, const char* value); |
| 176 | 173 |
| 177 // Emits an event with an int value -> (name, value). | 174 // Emits an event with an int value -> (name, value). |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 517 |
| 521 NameBuffer* name_buffer_; | 518 NameBuffer* name_buffer_; |
| 522 }; | 519 }; |
| 523 | 520 |
| 524 | 521 |
| 525 } // namespace internal | 522 } // namespace internal |
| 526 } // namespace v8 | 523 } // namespace v8 |
| 527 | 524 |
| 528 | 525 |
| 529 #endif // V8_LOG_H_ | 526 #endif // V8_LOG_H_ |
| OLD | NEW |