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

Side by Side Diff: src/counters.h

Issue 1661883003: [counters] adding more counters and log-events (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixing compilation issues Created 4 years, 10 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.cc ('k') | src/deoptimizer.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 #ifndef V8_COUNTERS_H_ 5 #ifndef V8_COUNTERS_H_
6 #define V8_COUNTERS_H_ 6 #define V8_COUNTERS_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/allocation.h" 9 #include "src/allocation.h"
10 #include "src/base/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 void Start() { time_ = base::TimeDelta(); } 323 void Start() { time_ = base::TimeDelta(); }
324 void Stop() { AddSample(static_cast<int>(time_.InMicroseconds())); } 324 void Stop() { AddSample(static_cast<int>(time_.InMicroseconds())); }
325 325
326 // Add a time value ("inner" scope). 326 // Add a time value ("inner" scope).
327 void Add(base::TimeDelta other) { time_ += other; } 327 void Add(base::TimeDelta other) { time_ += other; }
328 328
329 private: 329 private:
330 base::TimeDelta time_; 330 base::TimeDelta time_;
331 }; 331 };
332 332
333 333 // A helper class for use with AggregatableHistogramTimer. This is the
334 // A helper class for use with AggregatableHistogramTimer. 334 // outer-most timer scope used with an AggregatableHistogramTimer. It will
335 // aggregate the information from the inner AggregatedHistogramTimerScope.
335 class AggregatingHistogramTimerScope { 336 class AggregatingHistogramTimerScope {
336 public: 337 public:
337 explicit AggregatingHistogramTimerScope(AggregatableHistogramTimer* histogram) 338 explicit AggregatingHistogramTimerScope(AggregatableHistogramTimer* histogram)
338 : histogram_(histogram) { 339 : histogram_(histogram) {
339 histogram_->Start(); 340 histogram_->Start();
340 } 341 }
341 ~AggregatingHistogramTimerScope() { histogram_->Stop(); } 342 ~AggregatingHistogramTimerScope() { histogram_->Stop(); }
342 343
343 private: 344 private:
344 AggregatableHistogramTimer* histogram_; 345 AggregatableHistogramTimer* histogram_;
345 }; 346 };
346 347
347 348 // A helper class for use with AggregatableHistogramTimer, the "inner" scope
348 // A helper class for use with AggregatableHistogramTimer. 349 // which defines the events to be timed.
349 class AggregatedHistogramTimerScope { 350 class AggregatedHistogramTimerScope {
350 public: 351 public:
351 explicit AggregatedHistogramTimerScope(AggregatableHistogramTimer* histogram) 352 explicit AggregatedHistogramTimerScope(AggregatableHistogramTimer* histogram)
352 : histogram_(histogram) { 353 : histogram_(histogram) {
353 timer_.Start(); 354 timer_.Start();
354 } 355 }
355 ~AggregatedHistogramTimerScope() { histogram_->Add(timer_.Elapsed()); } 356 ~AggregatedHistogramTimerScope() { histogram_->Add(timer_.Elapsed()); }
356 357
357 private: 358 private:
358 base::ElapsedTimer timer_; 359 base::ElapsedTimer timer_;
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 916
916 explicit Counters(Isolate* isolate); 917 explicit Counters(Isolate* isolate);
917 918
918 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); 919 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
919 }; 920 };
920 921
921 } // namespace internal 922 } // namespace internal
922 } // namespace v8 923 } // namespace v8
923 924
924 #endif // V8_COUNTERS_H_ 925 #endif // V8_COUNTERS_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698