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 |
279 // static | 284 // static |
280 void RuntimeCallStats::Enter(Isolate* isolate, RuntimeCallTimer* timer, | 285 void RuntimeCallStats::Enter(Isolate* isolate, RuntimeCallTimer* timer, |
281 CounterId counter_id) { | 286 CounterId counter_id) { |
282 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); | 287 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); |
283 RuntimeCallCounter* counter = &(stats->*counter_id); | 288 RuntimeCallCounter* counter = &(stats->*counter_id); |
284 timer->Start(counter, stats->current_timer_); | 289 timer->Start(counter, stats->current_timer_); |
285 stats->current_timer_ = timer; | 290 stats->current_timer_ = timer; |
286 } | 291 } |
287 | 292 |
288 // static | 293 // static |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 FOR_EACH_API_COUNTER(RESET_COUNTER) | 359 FOR_EACH_API_COUNTER(RESET_COUNTER) |
355 #undef RESET_COUNTER | 360 #undef RESET_COUNTER |
356 | 361 |
357 #define RESET_COUNTER(name) this->Handler_##name.Reset(); | 362 #define RESET_COUNTER(name) this->Handler_##name.Reset(); |
358 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER) | 363 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER) |
359 #undef RESET_COUNTER | 364 #undef RESET_COUNTER |
360 } | 365 } |
361 | 366 |
362 } // namespace internal | 367 } // namespace internal |
363 } // namespace v8 | 368 } // namespace v8 |
OLD | NEW |