| 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 timer_.Stop(); | 514 timer_.Stop(); |
| 515 counter_->count++; | 515 counter_->count++; |
| 516 counter_->time += delta; | 516 counter_->time += delta; |
| 517 if (parent_ != NULL) { | 517 if (parent_ != NULL) { |
| 518 // Adjust parent timer so that it does not include sub timer's time. | 518 // Adjust parent timer so that it does not include sub timer's time. |
| 519 parent_->counter_->time -= delta; | 519 parent_->counter_->time -= delta; |
| 520 } | 520 } |
| 521 return parent_; | 521 return parent_; |
| 522 } | 522 } |
| 523 | 523 |
| 524 inline void Elapsed() { |
| 525 base::TimeDelta delta = timer_.Elapsed(); |
| 526 counter_->time += delta; |
| 527 if (parent_ != nullptr) { |
| 528 parent_->counter_->time -= delta; |
| 529 parent_->Elapsed(); |
| 530 } |
| 531 timer_.Restart(); |
| 532 } |
| 533 |
| 524 RuntimeCallCounter* counter_ = nullptr; | 534 RuntimeCallCounter* counter_ = nullptr; |
| 525 RuntimeCallTimer* parent_ = nullptr; | 535 RuntimeCallTimer* parent_ = nullptr; |
| 526 base::ElapsedTimer timer_; | 536 base::ElapsedTimer timer_; |
| 527 }; | 537 }; |
| 528 | 538 |
| 529 #define FOR_EACH_API_COUNTER(V) \ | 539 #define FOR_EACH_API_COUNTER(V) \ |
| 530 V(ArrayBuffer_Cast) \ | 540 V(ArrayBuffer_Cast) \ |
| 531 V(ArrayBuffer_Neuter) \ | 541 V(ArrayBuffer_Neuter) \ |
| 532 V(ArrayBuffer_New) \ | 542 V(ArrayBuffer_New) \ |
| 533 V(Array_CloneElementAt) \ | 543 V(Array_CloneElementAt) \ |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 } | 1284 } |
| 1275 | 1285 |
| 1276 Isolate* isolate_ = nullptr; | 1286 Isolate* isolate_ = nullptr; |
| 1277 RuntimeCallTimer timer_; | 1287 RuntimeCallTimer timer_; |
| 1278 }; | 1288 }; |
| 1279 | 1289 |
| 1280 } // namespace internal | 1290 } // namespace internal |
| 1281 } // namespace v8 | 1291 } // namespace v8 |
| 1282 | 1292 |
| 1283 #endif // V8_COUNTERS_H_ | 1293 #endif // V8_COUNTERS_H_ |
| OLD | NEW |