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 <memory> | 8 #include <memory> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
11 #include "src/bailout-reason.h" | 11 #include "src/bailout-reason.h" |
12 #include "src/base/platform/platform.h" | 12 #include "src/base/platform/platform.h" |
13 #include "src/bootstrapper.h" | 13 #include "src/bootstrapper.h" |
14 #include "src/code-stubs.h" | 14 #include "src/code-stubs.h" |
15 #include "src/counters.h" | 15 #include "src/counters.h" |
16 #include "src/deoptimizer.h" | 16 #include "src/deoptimizer.h" |
17 #include "src/global-handles.h" | 17 #include "src/global-handles.h" |
18 #include "src/interpreter/bytecodes.h" | 18 #include "src/interpreter/bytecodes.h" |
19 #include "src/interpreter/interpreter.h" | 19 #include "src/interpreter/interpreter.h" |
20 #include "src/libsampler/sampler.h" | 20 #include "src/libsampler/sampler.h" |
21 #include "src/log-inl.h" | 21 #include "src/log-inl.h" |
22 #include "src/log-utils.h" | 22 #include "src/log-utils.h" |
23 #include "src/macro-assembler.h" | 23 #include "src/macro-assembler.h" |
24 #include "src/perf-jit.h" | 24 #include "src/perf-jit.h" |
25 #include "src/profiler/profiler-listener.h" | 25 #include "src/profiler/profiler-listener.h" |
26 #include "src/profiler/tick-sample.h" | 26 #include "src/profiler/tick-sample.h" |
27 #include "src/runtime-profiler.h" | 27 #include "src/runtime-profiler.h" |
28 #include "src/source-position-table.h" | 28 #include "src/source-position-table.h" |
29 #include "src/string-stream.h" | 29 #include "src/string-stream.h" |
30 #include "src/tracing/tracing-category-observer.h" | |
31 #include "src/vm-state-inl.h" | 30 #include "src/vm-state-inl.h" |
32 | 31 |
33 namespace v8 { | 32 namespace v8 { |
34 namespace internal { | 33 namespace internal { |
35 | 34 |
36 #define DECLARE_EVENT(ignore1, name) name, | 35 #define DECLARE_EVENT(ignore1, name) name, |
37 static const char* kLogEventsNames[CodeEventListener::NUMBER_OF_LOG_EVENTS] = { | 36 static const char* kLogEventsNames[CodeEventListener::NUMBER_OF_LOG_EVENTS] = { |
38 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)}; | 37 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)}; |
39 #undef DECLARE_EVENT | 38 #undef DECLARE_EVENT |
40 | 39 |
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 RuntimeCallCounter* counter = timer->counter(); | 1276 RuntimeCallCounter* counter = timer->counter(); |
1278 if (counter == nullptr) return; | 1277 if (counter == nullptr) return; |
1279 Log::MessageBuilder msg(log_); | 1278 Log::MessageBuilder msg(log_); |
1280 msg.Append("active-runtime-timer,"); | 1279 msg.Append("active-runtime-timer,"); |
1281 msg.AppendDoubleQuotedString(counter->name); | 1280 msg.AppendDoubleQuotedString(counter->name); |
1282 msg.WriteToLogFile(); | 1281 msg.WriteToLogFile(); |
1283 } | 1282 } |
1284 | 1283 |
1285 void Logger::TickEvent(v8::TickSample* sample, bool overflow) { | 1284 void Logger::TickEvent(v8::TickSample* sample, bool overflow) { |
1286 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; | 1285 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; |
1287 if (V8_UNLIKELY(FLAG_runtime_stats == | 1286 if (FLAG_runtime_call_stats) { |
1288 v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE)) { | |
1289 RuntimeCallTimerEvent(); | 1287 RuntimeCallTimerEvent(); |
1290 } | 1288 } |
1291 Log::MessageBuilder msg(log_); | 1289 Log::MessageBuilder msg(log_); |
1292 msg.Append("%s,", kLogEventsNames[CodeEventListener::TICK_EVENT]); | 1290 msg.Append("%s,", kLogEventsNames[CodeEventListener::TICK_EVENT]); |
1293 msg.AppendAddress(reinterpret_cast<Address>(sample->pc)); | 1291 msg.AppendAddress(reinterpret_cast<Address>(sample->pc)); |
1294 msg.Append(",%d", static_cast<int>(timer_.Elapsed().InMicroseconds())); | 1292 msg.Append(",%d", static_cast<int>(timer_.Elapsed().InMicroseconds())); |
1295 if (sample->has_external_callback) { | 1293 if (sample->has_external_callback) { |
1296 msg.Append(",1,"); | 1294 msg.Append(",1,"); |
1297 msg.AppendAddress( | 1295 msg.AppendAddress( |
1298 reinterpret_cast<Address>(sample->external_callback_entry)); | 1296 reinterpret_cast<Address>(sample->external_callback_entry)); |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 | 1777 |
1780 if (profiler_listener_.get() != nullptr) { | 1778 if (profiler_listener_.get() != nullptr) { |
1781 removeCodeEventListener(profiler_listener_.get()); | 1779 removeCodeEventListener(profiler_listener_.get()); |
1782 } | 1780 } |
1783 | 1781 |
1784 return log_->Close(); | 1782 return log_->Close(); |
1785 } | 1783 } |
1786 | 1784 |
1787 } // namespace internal | 1785 } // namespace internal |
1788 } // namespace v8 | 1786 } // namespace v8 |
OLD | NEW |