Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: src/compiler-dispatcher/compiler-dispatcher-tracer.cc

Issue 2469403005: Revert of [Tracing] Use TracingCategoryObserver in runtime statistics (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/builtins-utils.h ('k') | src/counters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/compiler-dispatcher/compiler-dispatcher-tracer.h" 5 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h"
6 6
7 #include "src/isolate.h" 7 #include "src/isolate.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 11
12 namespace { 12 namespace {
13 13
14 double MonotonicallyIncreasingTimeInMs() { 14 double MonotonicallyIncreasingTimeInMs() {
15 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * 15 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() *
16 static_cast<double>(base::Time::kMillisecondsPerSecond); 16 static_cast<double>(base::Time::kMillisecondsPerSecond);
17 } 17 }
18 18
19 } // namespace 19 } // namespace
20 20
21 CompilerDispatcherTracer::Scope::Scope(CompilerDispatcherTracer* tracer, 21 CompilerDispatcherTracer::Scope::Scope(CompilerDispatcherTracer* tracer,
22 ScopeID scope_id, size_t num) 22 ScopeID scope_id, size_t num)
23 : tracer_(tracer), scope_id_(scope_id), num_(num) { 23 : tracer_(tracer), scope_id_(scope_id), num_(num) {
24 start_time_ = MonotonicallyIncreasingTimeInMs(); 24 start_time_ = MonotonicallyIncreasingTimeInMs();
25 // TODO(cbruni): remove once we fully moved to a trace-based system. 25 // TODO(cbruni): remove once we fully moved to a trace-based system.
26 if (V8_UNLIKELY(FLAG_runtime_stats)) { 26 if (TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() ||
27 FLAG_runtime_call_stats) {
27 RuntimeCallStats::Enter(tracer_->runtime_call_stats_, &timer_, 28 RuntimeCallStats::Enter(tracer_->runtime_call_stats_, &timer_,
28 &RuntimeCallStats::CompilerDispatcher); 29 &RuntimeCallStats::CompilerDispatcher);
29 } 30 }
30 } 31 }
31 32
32 CompilerDispatcherTracer::Scope::~Scope() { 33 CompilerDispatcherTracer::Scope::~Scope() {
33 double elapsed = MonotonicallyIncreasingTimeInMs() - start_time_; 34 double elapsed = MonotonicallyIncreasingTimeInMs() - start_time_;
34 switch (scope_id_) { 35 switch (scope_id_) {
35 case ScopeID::kPrepareToParse: 36 case ScopeID::kPrepareToParse:
36 tracer_->RecordPrepareToParse(elapsed); 37 tracer_->RecordPrepareToParse(elapsed);
37 break; 38 break;
38 case ScopeID::kParse: 39 case ScopeID::kParse:
39 tracer_->RecordParse(elapsed, num_); 40 tracer_->RecordParse(elapsed, num_);
40 break; 41 break;
41 case ScopeID::kFinalizeParsing: 42 case ScopeID::kFinalizeParsing:
42 tracer_->RecordFinalizeParsing(elapsed); 43 tracer_->RecordFinalizeParsing(elapsed);
43 break; 44 break;
44 case ScopeID::kPrepareToCompile: 45 case ScopeID::kPrepareToCompile:
45 tracer_->RecordPrepareToCompile(elapsed); 46 tracer_->RecordPrepareToCompile(elapsed);
46 break; 47 break;
47 case ScopeID::kCompile: 48 case ScopeID::kCompile:
48 tracer_->RecordCompile(elapsed, num_); 49 tracer_->RecordCompile(elapsed, num_);
49 break; 50 break;
50 case ScopeID::kFinalizeCompiling: 51 case ScopeID::kFinalizeCompiling:
51 tracer_->RecordFinalizeCompiling(elapsed); 52 tracer_->RecordFinalizeCompiling(elapsed);
52 break; 53 break;
53 } 54 }
54 // TODO(cbruni): remove once we fully moved to a trace-based system. 55 // TODO(cbruni): remove once we fully moved to a trace-based system.
55 if (V8_UNLIKELY(FLAG_runtime_stats)) { 56 if (TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() ||
57 FLAG_runtime_call_stats) {
56 RuntimeCallStats::Leave(tracer_->runtime_call_stats_, &timer_); 58 RuntimeCallStats::Leave(tracer_->runtime_call_stats_, &timer_);
57 } 59 }
58 } 60 }
59 61
60 // static 62 // static
61 const char* CompilerDispatcherTracer::Scope::Name(ScopeID scope_id) { 63 const char* CompilerDispatcherTracer::Scope::Name(ScopeID scope_id) {
62 switch (scope_id) { 64 switch (scope_id) {
63 case ScopeID::kPrepareToParse: 65 case ScopeID::kPrepareToParse:
64 return "V8.BackgroundCompile_PrepareToParse"; 66 return "V8.BackgroundCompile_PrepareToParse";
65 case ScopeID::kParse: 67 case ScopeID::kParse:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 std::pair<size_t, double> sum = buffer.Sum( 164 std::pair<size_t, double> sum = buffer.Sum(
163 [](std::pair<size_t, double> a, std::pair<size_t, double> b) { 165 [](std::pair<size_t, double> a, std::pair<size_t, double> b) {
164 return std::make_pair(a.first + b.first, a.second + b.second); 166 return std::make_pair(a.first + b.first, a.second + b.second);
165 }, 167 },
166 std::make_pair(0, 0.0)); 168 std::make_pair(0, 0.0));
167 return num * (sum.second / sum.first); 169 return num * (sum.second / sum.first);
168 } 170 }
169 171
170 } // namespace internal 172 } // namespace internal
171 } // namespace v8 173 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-utils.h ('k') | src/counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698