OLD | NEW |
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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // The aggregate_value_ is the average for [start_ms_; last_ms_]. | 475 // The aggregate_value_ is the average for [start_ms_; last_ms_]. |
476 // The value is the average for [last_ms_; current_ms]. | 476 // The value is the average for [last_ms_; current_ms]. |
477 // Return the weighted average of the aggregate_value_ and the value. | 477 // Return the weighted average of the aggregate_value_ and the value. |
478 return aggregate_value_ * ((last_ms_ - start_ms_) / interval_ms) + | 478 return aggregate_value_ * ((last_ms_ - start_ms_) / interval_ms) + |
479 value * ((current_ms - last_ms_) / interval_ms); | 479 value * ((current_ms - last_ms_) / interval_ms); |
480 } | 480 } |
481 | 481 |
482 struct RuntimeCallCounter { | 482 struct RuntimeCallCounter { |
483 explicit RuntimeCallCounter(const char* name) : name(name) {} | 483 explicit RuntimeCallCounter(const char* name) : name(name) {} |
484 void Reset(); | 484 void Reset(); |
485 V8_NOINLINE void Dump(std::stringstream& out); | |
486 | 485 |
487 const char* name; | 486 const char* name; |
488 int64_t count = 0; | 487 int64_t count = 0; |
489 base::TimeDelta time; | 488 base::TimeDelta time; |
490 }; | 489 }; |
491 | 490 |
492 // RuntimeCallTimer is used to keep track of the stack of currently active | 491 // RuntimeCallTimer is used to keep track of the stack of currently active |
493 // timers used for properly measuring the own time of a RuntimeCallCounter. | 492 // timers used for properly measuring the own time of a RuntimeCallCounter. |
494 class RuntimeCallTimer { | 493 class RuntimeCallTimer { |
495 public: | 494 public: |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 | 1234 |
1236 explicit Counters(Isolate* isolate); | 1235 explicit Counters(Isolate* isolate); |
1237 | 1236 |
1238 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 1237 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
1239 }; | 1238 }; |
1240 | 1239 |
1241 } // namespace internal | 1240 } // namespace internal |
1242 } // namespace v8 | 1241 } // namespace v8 |
1243 | 1242 |
1244 #endif // V8_COUNTERS_H_ | 1243 #endif // V8_COUNTERS_H_ |
OLD | NEW |