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

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

Issue 2618503002: Add a flag for printf debugging the compiler dispatcher (Closed)
Patch Set: updates Created 3 years, 11 months 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/compiler-dispatcher/compiler-dispatcher-tracer.h ('k') | src/flag-definitions.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 #include "src/utils.h"
8 9
9 namespace v8 { 10 namespace v8 {
10 namespace internal { 11 namespace internal {
11 12
12 namespace { 13 namespace {
13 14
14 double MonotonicallyIncreasingTimeInMs() { 15 double MonotonicallyIncreasingTimeInMs() {
15 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * 16 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() *
16 static_cast<double>(base::Time::kMillisecondsPerSecond); 17 static_cast<double>(base::Time::kMillisecondsPerSecond);
17 } 18 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 size_t ast_size_in_bytes) const { 137 size_t ast_size_in_bytes) const {
137 base::LockGuard<base::Mutex> lock(&mutex_); 138 base::LockGuard<base::Mutex> lock(&mutex_);
138 return Estimate(compile_events_, ast_size_in_bytes); 139 return Estimate(compile_events_, ast_size_in_bytes);
139 } 140 }
140 141
141 double CompilerDispatcherTracer::EstimateFinalizeCompilingInMs() const { 142 double CompilerDispatcherTracer::EstimateFinalizeCompilingInMs() const {
142 base::LockGuard<base::Mutex> lock(&mutex_); 143 base::LockGuard<base::Mutex> lock(&mutex_);
143 return Average(finalize_compiling_events_); 144 return Average(finalize_compiling_events_);
144 } 145 }
145 146
147 void CompilerDispatcherTracer::DumpStatistics() const {
148 PrintF(
149 "CompilerDispatcherTracer: "
150 "prepare_parsing=%.2lfms parsing=%.2lfms/kb finalize_parsing=%.2lfms "
151 "prepare_compiling=%.2lfms compiling=%.2lfms/kb "
152 "finalize_compilig=%.2lfms\n",
153 EstimatePrepareToParseInMs(), EstimateParseInMs(1 * KB),
154 EstimateFinalizeParsingInMs(), EstimatePrepareToCompileInMs(),
155 EstimateCompileInMs(1 * KB), EstimateFinalizeCompilingInMs());
156 }
157
146 double CompilerDispatcherTracer::Average( 158 double CompilerDispatcherTracer::Average(
147 const base::RingBuffer<double>& buffer) { 159 const base::RingBuffer<double>& buffer) {
148 if (buffer.Count() == 0) return 0.0; 160 if (buffer.Count() == 0) return 0.0;
149 double sum = buffer.Sum([](double a, double b) { return a + b; }, 0.0); 161 double sum = buffer.Sum([](double a, double b) { return a + b; }, 0.0);
150 return sum / buffer.Count(); 162 return sum / buffer.Count();
151 } 163 }
152 164
153 double CompilerDispatcherTracer::Estimate( 165 double CompilerDispatcherTracer::Estimate(
154 const base::RingBuffer<std::pair<size_t, double>>& buffer, size_t num) { 166 const base::RingBuffer<std::pair<size_t, double>>& buffer, size_t num) {
155 if (buffer.Count() == 0) return kEstimatedRuntimeWithoutData; 167 if (buffer.Count() == 0) return kEstimatedRuntimeWithoutData;
156 std::pair<size_t, double> sum = buffer.Sum( 168 std::pair<size_t, double> sum = buffer.Sum(
157 [](std::pair<size_t, double> a, std::pair<size_t, double> b) { 169 [](std::pair<size_t, double> a, std::pair<size_t, double> b) {
158 return std::make_pair(a.first + b.first, a.second + b.second); 170 return std::make_pair(a.first + b.first, a.second + b.second);
159 }, 171 },
160 std::make_pair(0, 0.0)); 172 std::make_pair(0, 0.0));
161 return num * (sum.second / sum.first); 173 return num * (sum.second / sum.first);
162 } 174 }
163 175
164 } // namespace internal 176 } // namespace internal
165 } // namespace v8 177 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-tracer.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698