| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include "src/log.h" | 5 #include "src/log.h" |
| 6 | 6 |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| 11 #include "src/base/platform/platform.h" | 11 #include "src/base/platform/platform.h" |
| 12 #include "src/bootstrapper.h" | 12 #include "src/bootstrapper.h" |
| 13 #include "src/code-stubs.h" | 13 #include "src/code-stubs.h" |
| 14 #include "src/counters.h" |
| 14 #include "src/deoptimizer.h" | 15 #include "src/deoptimizer.h" |
| 15 #include "src/global-handles.h" | 16 #include "src/global-handles.h" |
| 16 #include "src/interpreter/bytecodes.h" | 17 #include "src/interpreter/bytecodes.h" |
| 17 #include "src/interpreter/interpreter.h" | 18 #include "src/interpreter/interpreter.h" |
| 18 #include "src/libsampler/v8-sampler.h" | 19 #include "src/libsampler/v8-sampler.h" |
| 19 #include "src/log-inl.h" | 20 #include "src/log-inl.h" |
| 20 #include "src/log-utils.h" | 21 #include "src/log-utils.h" |
| 21 #include "src/macro-assembler.h" | 22 #include "src/macro-assembler.h" |
| 22 #include "src/perf-jit.h" | 23 #include "src/perf-jit.h" |
| 23 #include "src/profiler/cpu-profiler-inl.h" | 24 #include "src/profiler/cpu-profiler-inl.h" |
| (...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 s.AddCharacter(static_cast<char>(parameter[i])); | 1417 s.AddCharacter(static_cast<char>(parameter[i])); |
| 1417 } | 1418 } |
| 1418 char* parameter_string = s.Finalize(); | 1419 char* parameter_string = s.Finalize(); |
| 1419 Log::MessageBuilder msg(log_); | 1420 Log::MessageBuilder msg(log_); |
| 1420 msg.Append("debug-queue-event,%s,%15.3f,%s", event_type, | 1421 msg.Append("debug-queue-event,%s,%15.3f,%s", event_type, |
| 1421 base::OS::TimeCurrentMillis(), parameter_string); | 1422 base::OS::TimeCurrentMillis(), parameter_string); |
| 1422 DeleteArray(parameter_string); | 1423 DeleteArray(parameter_string); |
| 1423 msg.WriteToLogFile(); | 1424 msg.WriteToLogFile(); |
| 1424 } | 1425 } |
| 1425 | 1426 |
| 1427 void Logger::RuntimeCallTimerEvent() { |
| 1428 RuntimeCallStats* stats = isolate_->counters()->runtime_call_stats(); |
| 1429 RuntimeCallTimer* timer = stats->current_timer(); |
| 1430 if (timer == nullptr) return; |
| 1431 RuntimeCallCounter* counter = timer->counter(); |
| 1432 if (counter == nullptr) return; |
| 1433 Log::MessageBuilder msg(log_); |
| 1434 msg.Append("active-runtime-timer,"); |
| 1435 msg.AppendDoubleQuotedString(counter->name); |
| 1436 msg.WriteToLogFile(); |
| 1437 } |
| 1426 | 1438 |
| 1427 void Logger::TickEvent(TickSample* sample, bool overflow) { | 1439 void Logger::TickEvent(TickSample* sample, bool overflow) { |
| 1428 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; | 1440 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; |
| 1441 if (FLAG_runtime_call_stats) { |
| 1442 RuntimeCallTimerEvent(); |
| 1443 } |
| 1429 Log::MessageBuilder msg(log_); | 1444 Log::MessageBuilder msg(log_); |
| 1430 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); | 1445 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); |
| 1431 msg.AppendAddress(sample->pc); | 1446 msg.AppendAddress(sample->pc); |
| 1432 msg.Append(",%d", static_cast<int>(timer_.Elapsed().InMicroseconds())); | 1447 msg.Append(",%d", static_cast<int>(timer_.Elapsed().InMicroseconds())); |
| 1433 if (sample->has_external_callback) { | 1448 if (sample->has_external_callback) { |
| 1434 msg.Append(",1,"); | 1449 msg.Append(",1,"); |
| 1435 msg.AppendAddress(sample->external_callback_entry); | 1450 msg.AppendAddress(sample->external_callback_entry); |
| 1436 } else { | 1451 } else { |
| 1437 msg.Append(",0,"); | 1452 msg.Append(",0,"); |
| 1438 msg.AppendAddress(sample->tos); | 1453 msg.AppendAddress(sample->tos); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 removeCodeEventListener(jit_logger_); | 1910 removeCodeEventListener(jit_logger_); |
| 1896 delete jit_logger_; | 1911 delete jit_logger_; |
| 1897 jit_logger_ = NULL; | 1912 jit_logger_ = NULL; |
| 1898 } | 1913 } |
| 1899 | 1914 |
| 1900 return log_->Close(); | 1915 return log_->Close(); |
| 1901 } | 1916 } |
| 1902 | 1917 |
| 1903 } // namespace internal | 1918 } // namespace internal |
| 1904 } // namespace v8 | 1919 } // namespace v8 |
| OLD | NEW |