Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: src/counters.cc

Issue 2187693002: [Tracing] Embed V8 runtime call stats into tracing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix memory leak Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/counters.h ('k') | src/d8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/counters.h ('k') | src/d8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698