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

Side by Side Diff: src/counters.cc

Issue 1771323003: [counter] reducing the overhead of RuntimeCallTimerScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: further reducing overhead Created 4 years, 9 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/counters.h ('k') | src/d8.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/counters.h" 5 #include "src/counters.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 base::TimeDelta total_time; 266 base::TimeDelta total_time;
267 std::vector<Entry> entries; 267 std::vector<Entry> entries;
268 }; 268 };
269 269
270 void RuntimeCallCounter::Reset() { 270 void RuntimeCallCounter::Reset() {
271 count = 0; 271 count = 0;
272 time = base::TimeDelta(); 272 time = base::TimeDelta();
273 } 273 }
274 274
275 void RuntimeCallStats::Enter(RuntimeCallCounter* counter) { 275 void RuntimeCallStats::Enter(RuntimeCallCounter* counter) {
276 Enter(new RuntimeCallTimer(counter, current_timer_)); 276 RuntimeCallTimer* timer = new RuntimeCallTimer();
277 timer->Initialize(counter, current_timer_);
278 Enter(timer);
277 } 279 }
278 280
279 void RuntimeCallStats::Enter(RuntimeCallTimer* timer_) { 281 void RuntimeCallStats::Enter(RuntimeCallTimer* timer_) {
280 current_timer_ = timer_; 282 current_timer_ = timer_;
281 current_timer_->Start(); 283 current_timer_->Start();
282 } 284 }
283 285
284 void RuntimeCallStats::Leave() { 286 void RuntimeCallStats::Leave() {
285 RuntimeCallTimer* timer = current_timer_; 287 RuntimeCallTimer* timer = current_timer_;
286 Leave(timer); 288 Leave(timer);
(...skipping 22 matching lines...) Expand all
309 } 311 }
310 312
311 void RuntimeCallStats::Reset() { 313 void RuntimeCallStats::Reset() {
312 if (!FLAG_runtime_call_stats) return; 314 if (!FLAG_runtime_call_stats) return;
313 #define RESET_COUNTER(name, nargs, ressize) this->Runtime_##name.Reset(); 315 #define RESET_COUNTER(name, nargs, ressize) this->Runtime_##name.Reset();
314 FOR_EACH_INTRINSIC(RESET_COUNTER) 316 FOR_EACH_INTRINSIC(RESET_COUNTER)
315 #undef RESET_COUNTER 317 #undef RESET_COUNTER
316 #define RESET_COUNTER(name, type) this->Builtin_##name.Reset(); 318 #define RESET_COUNTER(name, type) this->Builtin_##name.Reset();
317 BUILTIN_LIST_C(RESET_COUNTER) 319 BUILTIN_LIST_C(RESET_COUNTER)
318 #undef RESET_COUNTER 320 #undef RESET_COUNTER
321 this->ExternalCallback.Reset();
322 this->UnexpectedStubMiss.Reset();
319 } 323 }
320 324
321 RuntimeCallTimerScope::RuntimeCallTimerScope(Isolate* isolate, 325 void RuntimeCallTimerScope::Enter(Isolate* isolate,
322 RuntimeCallCounter* counter) 326 RuntimeCallCounter* counter) {
323 : isolate_(isolate), 327 isolate_ = isolate;
324 timer_(counter, 328 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats();
325 isolate->counters()->runtime_call_stats()->current_timer()) { 329 timer_.Initialize(counter, stats->current_timer());
326 if (!FLAG_runtime_call_stats) return; 330 stats->Enter(&timer_);
327 isolate->counters()->runtime_call_stats()->Enter(&timer_);
328 } 331 }
329 332
330 RuntimeCallTimerScope::~RuntimeCallTimerScope() { 333 void RuntimeCallTimerScope::Leave() {
331 if (!FLAG_runtime_call_stats) return;
332 isolate_->counters()->runtime_call_stats()->Leave(&timer_); 334 isolate_->counters()->runtime_call_stats()->Leave(&timer_);
333 } 335 }
334 336
335 } // namespace internal 337 } // namespace internal
336 } // namespace v8 338 } // namespace v8
OLDNEW
« no previous file with comments | « src/counters.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698