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); |
485 | 486 |
486 const char* name; | 487 const char* name; |
487 int64_t count = 0; | 488 int64_t count = 0; |
488 base::TimeDelta time; | 489 base::TimeDelta time; |
489 }; | 490 }; |
490 | 491 |
491 // RuntimeCallTimer is used to keep track of the stack of currently active | 492 // RuntimeCallTimer is used to keep track of the stack of currently active |
492 // timers used for properly measuring the own time of a RuntimeCallCounter. | 493 // timers used for properly measuring the own time of a RuntimeCallCounter. |
493 class RuntimeCallTimer { | 494 class RuntimeCallTimer { |
494 public: | 495 public: |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 | 1235 |
1235 explicit Counters(Isolate* isolate); | 1236 explicit Counters(Isolate* isolate); |
1236 | 1237 |
1237 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 1238 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
1238 }; | 1239 }; |
1239 | 1240 |
1240 } // namespace internal | 1241 } // namespace internal |
1241 } // namespace v8 | 1242 } // namespace v8 |
1242 | 1243 |
1243 #endif // V8_COUNTERS_H_ | 1244 #endif // V8_COUNTERS_H_ |
OLD | NEW |