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" |
30 #include "src/vm-state-inl.h" | 31 #include "src/vm-state-inl.h" |
31 | 32 |
32 namespace v8 { | 33 namespace v8 { |
33 namespace internal { | 34 namespace internal { |
34 | 35 |
35 #define DECLARE_EVENT(ignore1, name) name, | 36 #define DECLARE_EVENT(ignore1, name) name, |
36 static const char* kLogEventsNames[CodeEventListener::NUMBER_OF_LOG_EVENTS] = { | 37 static const char* kLogEventsNames[CodeEventListener::NUMBER_OF_LOG_EVENTS] = { |
37 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)}; | 38 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)}; |
38 #undef DECLARE_EVENT | 39 #undef DECLARE_EVENT |
39 | 40 |
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 RuntimeCallCounter* counter = timer->counter(); | 1277 RuntimeCallCounter* counter = timer->counter(); |
1277 if (counter == nullptr) return; | 1278 if (counter == nullptr) return; |
1278 Log::MessageBuilder msg(log_); | 1279 Log::MessageBuilder msg(log_); |
1279 msg.Append("active-runtime-timer,"); | 1280 msg.Append("active-runtime-timer,"); |
1280 msg.AppendDoubleQuotedString(counter->name); | 1281 msg.AppendDoubleQuotedString(counter->name); |
1281 msg.WriteToLogFile(); | 1282 msg.WriteToLogFile(); |
1282 } | 1283 } |
1283 | 1284 |
1284 void Logger::TickEvent(v8::TickSample* sample, bool overflow) { | 1285 void Logger::TickEvent(v8::TickSample* sample, bool overflow) { |
1285 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; | 1286 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; |
1286 if (FLAG_runtime_call_stats) { | 1287 if (V8_UNLIKELY(FLAG_runtime_stats == |
| 1288 v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE)) { |
1287 RuntimeCallTimerEvent(); | 1289 RuntimeCallTimerEvent(); |
1288 } | 1290 } |
1289 Log::MessageBuilder msg(log_); | 1291 Log::MessageBuilder msg(log_); |
1290 msg.Append("%s,", kLogEventsNames[CodeEventListener::TICK_EVENT]); | 1292 msg.Append("%s,", kLogEventsNames[CodeEventListener::TICK_EVENT]); |
1291 msg.AppendAddress(reinterpret_cast<Address>(sample->pc)); | 1293 msg.AppendAddress(reinterpret_cast<Address>(sample->pc)); |
1292 msg.Append(",%d", static_cast<int>(timer_.Elapsed().InMicroseconds())); | 1294 msg.Append(",%d", static_cast<int>(timer_.Elapsed().InMicroseconds())); |
1293 if (sample->has_external_callback) { | 1295 if (sample->has_external_callback) { |
1294 msg.Append(",1,"); | 1296 msg.Append(",1,"); |
1295 msg.AppendAddress( | 1297 msg.AppendAddress( |
1296 reinterpret_cast<Address>(sample->external_callback_entry)); | 1298 reinterpret_cast<Address>(sample->external_callback_entry)); |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 | 1779 |
1778 if (profiler_listener_.get() != nullptr) { | 1780 if (profiler_listener_.get() != nullptr) { |
1779 removeCodeEventListener(profiler_listener_.get()); | 1781 removeCodeEventListener(profiler_listener_.get()); |
1780 } | 1782 } |
1781 | 1783 |
1782 return log_->Close(); | 1784 return log_->Close(); |
1783 } | 1785 } |
1784 | 1786 |
1785 } // namespace internal | 1787 } // namespace internal |
1786 } // namespace v8 | 1788 } // namespace v8 |
OLD | NEW |