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

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: 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
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 void Start() { time_ = base::TimeDelta(); } 321 void Start() { time_ = base::TimeDelta(); }
322 void Stop() { AddSample(static_cast<int>(time_.InMicroseconds())); } 322 void Stop() { AddSample(static_cast<int>(time_.InMicroseconds())); }
323 323
324 // Add a time value ("inner" scope). 324 // Add a time value ("inner" scope).
325 void Add(base::TimeDelta other) { time_ += other; } 325 void Add(base::TimeDelta other) { time_ += other; }
326 326
327 private: 327 private:
328 base::TimeDelta time_; 328 base::TimeDelta time_;
329 }; 329 };
330 330
331 331 // A helper class for use with AggregatableHistogramTimer. This is the
332 // A helper class for use with AggregatableHistogramTimer. 332 // outer-most timer scope used with an AggregatableHistogramTimer. It will
333 // aggregate the information from the inner AggregatedHistogramTimerScope.
333 class AggregatingHistogramTimerScope { 334 class AggregatingHistogramTimerScope {
334 public: 335 public:
335 explicit AggregatingHistogramTimerScope(AggregatableHistogramTimer* histogram) 336 explicit AggregatingHistogramTimerScope(AggregatableHistogramTimer* histogram)
336 : histogram_(histogram) { 337 : histogram_(histogram) {
337 histogram_->Start(); 338 histogram_->Start();
338 } 339 }
339 ~AggregatingHistogramTimerScope() { histogram_->Stop(); } 340 ~AggregatingHistogramTimerScope() { histogram_->Stop(); }
340 341
341 private: 342 private:
342 AggregatableHistogramTimer* histogram_; 343 AggregatableHistogramTimer* histogram_;
343 }; 344 };
344 345
345 346 // A helper class for use with AggregatableHistogramTimer, the "inner" scope
346 // A helper class for use with AggregatableHistogramTimer. 347 // which defines the events to be timed.
347 class AggregatedHistogramTimerScope { 348 class AggregatedHistogramTimerScope {
348 public: 349 public:
349 explicit AggregatedHistogramTimerScope(AggregatableHistogramTimer* histogram) 350 explicit AggregatedHistogramTimerScope(AggregatableHistogramTimer* histogram)
350 : histogram_(histogram) { 351 : histogram_(histogram) {
351 timer_.Start(); 352 timer_.Start();
352 } 353 }
353 ~AggregatedHistogramTimerScope() { histogram_->Add(timer_.Elapsed()); } 354 ~AggregatedHistogramTimerScope() { histogram_->Add(timer_.Elapsed()); }
354 355
355 private: 356 private:
356 base::ElapsedTimer timer_; 357 base::ElapsedTimer timer_;
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 897
897 explicit Counters(Isolate* isolate); 898 explicit Counters(Isolate* isolate);
898 899
899 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); 900 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
900 }; 901 };
901 902
902 } // namespace internal 903 } // namespace internal
903 } // namespace v8 904 } // namespace v8
904 905
905 #endif // V8_COUNTERS_H_ 906 #endif // V8_COUNTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698