| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_LOG_H_ | 28 #ifndef V8_LOG_H_ |
| 29 #define V8_LOG_H_ | 29 #define V8_LOG_H_ |
| 30 | 30 |
| 31 #include "allocation.h" | 31 #include "allocation.h" |
| 32 #include "objects.h" | 32 #include "objects.h" |
| 33 #include "platform.h" | 33 #include "platform.h" |
| 34 #include "log-utils.h" | |
| 35 | 34 |
| 36 namespace v8 { | 35 namespace v8 { |
| 37 namespace internal { | 36 namespace internal { |
| 38 | 37 |
| 39 // Logger is used for collecting logging information from V8 during | 38 // Logger is used for collecting logging information from V8 during |
| 40 // execution. The result is dumped to a file. | 39 // execution. The result is dumped to a file. |
| 41 // | 40 // |
| 42 // Available command line flags: | 41 // Available command line flags: |
| 43 // | 42 // |
| 44 // --log | 43 // --log |
| (...skipping 19 matching lines...) Expand all Loading... |
| 64 // --log-regexp implies --log. | 63 // --log-regexp implies --log. |
| 65 // | 64 // |
| 66 // --logfile <filename> | 65 // --logfile <filename> |
| 67 // Specify the name of the logfile, default is "v8.log". | 66 // Specify the name of the logfile, default is "v8.log". |
| 68 // | 67 // |
| 69 // --prof | 68 // --prof |
| 70 // Collect statistical profiling information (ticks), default is off. The | 69 // Collect statistical profiling information (ticks), default is off. The |
| 71 // tick profiler requires code events, so --prof implies --log-code. | 70 // tick profiler requires code events, so --prof implies --log-code. |
| 72 | 71 |
| 73 // Forward declarations. | 72 // Forward declarations. |
| 74 class LogMessageBuilder; | 73 class CompilationInfo; |
| 74 class CpuProfiler; |
| 75 class Isolate; |
| 76 class Log; |
| 77 class PositionsRecorder; |
| 75 class Profiler; | 78 class Profiler; |
| 76 class Semaphore; | 79 class Semaphore; |
| 80 class Ticker; |
| 77 struct TickSample; | 81 struct TickSample; |
| 78 class Ticker; | |
| 79 class Isolate; | |
| 80 class PositionsRecorder; | |
| 81 class CpuProfiler; | |
| 82 class CompilationInfo; | |
| 83 | 82 |
| 84 #undef LOG | 83 #undef LOG |
| 85 #define LOG(isolate, Call) \ | 84 #define LOG(isolate, Call) \ |
| 86 do { \ | 85 do { \ |
| 87 v8::internal::Logger* logger = \ | 86 v8::internal::Logger* logger = \ |
| 88 (isolate)->logger(); \ | 87 (isolate)->logger(); \ |
| 89 if (logger->is_logging()) \ | 88 if (logger->is_logging()) \ |
| 90 logger->Call; \ | 89 logger->Call; \ |
| 91 } while (false) | 90 } while (false) |
| 92 | 91 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 401 |
| 403 // Helper method. It resets name_buffer_ and add tag name into it. | 402 // Helper method. It resets name_buffer_ and add tag name into it. |
| 404 void InitNameBuffer(LogEventsAndTags tag); | 403 void InitNameBuffer(LogEventsAndTags tag); |
| 405 | 404 |
| 406 // Helper method. It push recorded buffer into different handlers. | 405 // Helper method. It push recorded buffer into different handlers. |
| 407 void LogRecordedBuffer(Code*, SharedFunctionInfo*); | 406 void LogRecordedBuffer(Code*, SharedFunctionInfo*); |
| 408 | 407 |
| 409 // Helper method. It dumps name into name_buffer_. | 408 // Helper method. It dumps name into name_buffer_. |
| 410 void AppendName(Name* name); | 409 void AppendName(Name* name); |
| 411 | 410 |
| 412 // Appends standard code header. | |
| 413 void AppendCodeCreateHeader(LogMessageBuilder*, LogEventsAndTags, Code*); | |
| 414 | |
| 415 // Appends symbol for the name. | |
| 416 void AppendSymbolName(LogMessageBuilder*, Symbol*); | |
| 417 | |
| 418 void RegisterSnapshotCodeName(Code* code, const char* name, int name_size); | 411 void RegisterSnapshotCodeName(Code* code, const char* name, int name_size); |
| 419 | 412 |
| 420 // Emits a profiler tick event. Used by the profiler thread. | 413 // Emits a profiler tick event. Used by the profiler thread. |
| 421 void TickEvent(TickSample* sample, bool overflow); | 414 void TickEvent(TickSample* sample, bool overflow); |
| 422 | 415 |
| 423 void ApiEvent(const char* name, ...); | 416 void ApiEvent(const char* name, ...); |
| 424 | 417 |
| 425 // Logs a StringEvent regardless of whether FLAG_log is true. | 418 // Logs a StringEvent regardless of whether FLAG_log is true. |
| 426 void UncheckedStringEvent(const char* name, const char* value); | 419 void UncheckedStringEvent(const char* name, const char* value); |
| 427 | 420 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 439 // of samples. | 432 // of samples. |
| 440 Profiler* profiler_; | 433 Profiler* profiler_; |
| 441 | 434 |
| 442 // An array of log events names. | 435 // An array of log events names. |
| 443 const char* const* log_events_; | 436 const char* const* log_events_; |
| 444 | 437 |
| 445 // Internal implementation classes with access to | 438 // Internal implementation classes with access to |
| 446 // private members. | 439 // private members. |
| 447 friend class EventLog; | 440 friend class EventLog; |
| 448 friend class Isolate; | 441 friend class Isolate; |
| 449 friend class LogMessageBuilder; | |
| 450 friend class TimeLog; | 442 friend class TimeLog; |
| 451 friend class Profiler; | 443 friend class Profiler; |
| 452 template <StateTag Tag> friend class VMState; | 444 template <StateTag Tag> friend class VMState; |
| 453 | 445 |
| 454 friend class LoggerTestHelper; | 446 friend class LoggerTestHelper; |
| 455 | 447 |
| 456 | 448 |
| 457 int logging_nesting_; | 449 int logging_nesting_; |
| 458 int cpu_profiler_nesting_; | 450 int cpu_profiler_nesting_; |
| 459 | 451 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 483 int64_t epoch_; | 475 int64_t epoch_; |
| 484 | 476 |
| 485 friend class CpuProfiler; | 477 friend class CpuProfiler; |
| 486 }; | 478 }; |
| 487 | 479 |
| 488 | 480 |
| 489 } } // namespace v8::internal | 481 } } // namespace v8::internal |
| 490 | 482 |
| 491 | 483 |
| 492 #endif // V8_LOG_H_ | 484 #endif // V8_LOG_H_ |
| OLD | NEW |