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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 parent_ = parent; | 498 parent_ = parent; |
499 } | 499 } |
500 | 500 |
501 inline void Start() { | 501 inline void Start() { |
502 timer_.Start(); | 502 timer_.Start(); |
503 counter_->count++; | 503 counter_->count++; |
504 } | 504 } |
505 | 505 |
506 inline RuntimeCallTimer* Stop() { | 506 inline RuntimeCallTimer* Stop() { |
507 base::TimeDelta delta = timer_.Elapsed(); | 507 base::TimeDelta delta = timer_.Elapsed(); |
| 508 timer_.Stop(); |
508 counter_->time += delta; | 509 counter_->time += delta; |
509 if (parent_ != NULL) { | 510 if (parent_ != NULL) { |
510 parent_->AdjustForSubTimer(delta); | 511 parent_->AdjustForSubTimer(delta); |
511 } | 512 } |
512 return parent_; | 513 return parent_; |
513 } | 514 } |
514 | 515 |
515 inline void AdjustForSubTimer(base::TimeDelta delta) { | 516 inline void AdjustForSubTimer(base::TimeDelta delta) { |
516 counter_->time -= delta; | 517 counter_->time -= delta; |
517 } | 518 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 | 990 |
990 explicit Counters(Isolate* isolate); | 991 explicit Counters(Isolate* isolate); |
991 | 992 |
992 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 993 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
993 }; | 994 }; |
994 | 995 |
995 } // namespace internal | 996 } // namespace internal |
996 } // namespace v8 | 997 } // namespace v8 |
997 | 998 |
998 #endif // V8_COUNTERS_H_ | 999 #endif // V8_COUNTERS_H_ |
OLD | NEW |