| 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 #include "src/counters.h" | 5 #include "src/counters.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 uint64_t total_call_count = 0; | 266 uint64_t total_call_count = 0; |
| 267 base::TimeDelta total_time; | 267 base::TimeDelta total_time; |
| 268 std::vector<Entry> entries; | 268 std::vector<Entry> entries; |
| 269 }; | 269 }; |
| 270 | 270 |
| 271 void RuntimeCallCounter::Reset() { | 271 void RuntimeCallCounter::Reset() { |
| 272 count = 0; | 272 count = 0; |
| 273 time = base::TimeDelta(); | 273 time = base::TimeDelta(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void RuntimeCallCounter::Dump(std::stringstream& out) { |
| 277 out << "\"" << name << "\":[" << count << "," << time.InMicroseconds() |
| 278 << "],"; |
| 279 } |
| 280 |
| 276 // static | 281 // static |
| 277 void RuntimeCallStats::Enter(Isolate* isolate, RuntimeCallTimer* timer, | 282 void RuntimeCallStats::Enter(Isolate* isolate, RuntimeCallTimer* timer, |
| 278 CounterId counter_id) { | 283 CounterId counter_id) { |
| 279 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); | 284 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); |
| 280 RuntimeCallCounter* counter = &(stats->*counter_id); | 285 RuntimeCallCounter* counter = &(stats->*counter_id); |
| 281 timer->Start(counter, stats->current_timer_); | 286 timer->Start(counter, stats->current_timer_); |
| 282 stats->current_timer_ = timer; | 287 stats->current_timer_ = timer; |
| 283 } | 288 } |
| 284 | 289 |
| 285 // static | 290 // static |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 FOR_EACH_API_COUNTER(RESET_COUNTER) | 356 FOR_EACH_API_COUNTER(RESET_COUNTER) |
| 352 #undef RESET_COUNTER | 357 #undef RESET_COUNTER |
| 353 | 358 |
| 354 #define RESET_COUNTER(name) this->Handler_##name.Reset(); | 359 #define RESET_COUNTER(name) this->Handler_##name.Reset(); |
| 355 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER) | 360 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER) |
| 356 #undef RESET_COUNTER | 361 #undef RESET_COUNTER |
| 357 } | 362 } |
| 358 | 363 |
| 359 } // namespace internal | 364 } // namespace internal |
| 360 } // namespace v8 | 365 } // namespace v8 |
| OLD | NEW |