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