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

Side by Side Diff: src/counters.cc

Issue 2311033002: [RuntimeCallStats] Fix reset scope for tracing (Closed)
Patch Set: Created 4 years, 3 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') | no next file » | 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 #undef PRINT_COUNTER 331 #undef PRINT_COUNTER
332 332
333 #define PRINT_COUNTER(name) entries.Add(&this->Handler_##name); 333 #define PRINT_COUNTER(name) entries.Add(&this->Handler_##name);
334 FOR_EACH_HANDLER_COUNTER(PRINT_COUNTER) 334 FOR_EACH_HANDLER_COUNTER(PRINT_COUNTER)
335 #undef PRINT_COUNTER 335 #undef PRINT_COUNTER
336 336
337 entries.Print(os); 337 entries.Print(os);
338 } 338 }
339 339
340 void RuntimeCallStats::Reset() { 340 void RuntimeCallStats::Reset() {
341 if (!FLAG_runtime_call_stats) return; 341 if (!FLAG_runtime_call_stats &&
342 !TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED())
343 return;
342 #define RESET_COUNTER(name) this->name.Reset(); 344 #define RESET_COUNTER(name) this->name.Reset();
343 FOR_EACH_MANUAL_COUNTER(RESET_COUNTER) 345 FOR_EACH_MANUAL_COUNTER(RESET_COUNTER)
344 #undef RESET_COUNTER 346 #undef RESET_COUNTER
345 347
346 #define RESET_COUNTER(name, nargs, result_size) this->Runtime_##name.Reset(); 348 #define RESET_COUNTER(name, nargs, result_size) this->Runtime_##name.Reset();
347 FOR_EACH_INTRINSIC(RESET_COUNTER) 349 FOR_EACH_INTRINSIC(RESET_COUNTER)
348 #undef RESET_COUNTER 350 #undef RESET_COUNTER
349 351
350 #define RESET_COUNTER(name) this->Builtin_##name.Reset(); 352 #define RESET_COUNTER(name) this->Builtin_##name.Reset();
351 BUILTIN_LIST_C(RESET_COUNTER) 353 BUILTIN_LIST_C(RESET_COUNTER)
352 #undef RESET_COUNTER 354 #undef RESET_COUNTER
353 355
354 #define RESET_COUNTER(name) this->API_##name.Reset(); 356 #define RESET_COUNTER(name) this->API_##name.Reset();
355 FOR_EACH_API_COUNTER(RESET_COUNTER) 357 FOR_EACH_API_COUNTER(RESET_COUNTER)
356 #undef RESET_COUNTER 358 #undef RESET_COUNTER
357 359
358 #define RESET_COUNTER(name) this->Handler_##name.Reset(); 360 #define RESET_COUNTER(name) this->Handler_##name.Reset();
359 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER) 361 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER)
360 #undef RESET_COUNTER 362 #undef RESET_COUNTER
363
364 in_use_ = true;
361 } 365 }
362 366
363 const char* RuntimeCallStats::Dump() { 367 const char* RuntimeCallStats::Dump() {
364 buffer_.str(std::string()); 368 buffer_.str(std::string());
365 buffer_.clear(); 369 buffer_.clear();
366 buffer_ << "{"; 370 buffer_ << "{";
367 #define DUMP_COUNTER(name) \ 371 #define DUMP_COUNTER(name) \
368 if (this->name.count > 0) this->name.Dump(buffer_); 372 if (this->name.count > 0) this->name.Dump(buffer_);
369 FOR_EACH_MANUAL_COUNTER(DUMP_COUNTER) 373 FOR_EACH_MANUAL_COUNTER(DUMP_COUNTER)
370 #undef DUMP_COUNTER 374 #undef DUMP_COUNTER
(...skipping 24 matching lines...) Expand all
395 buffer_c_str_.reset(new char[length + 1]); 399 buffer_c_str_.reset(new char[length + 1]);
396 len_ = length; 400 len_ = length;
397 } 401 }
398 strncpy(buffer_c_str_.get(), buffer_str.c_str(), length + 1); 402 strncpy(buffer_c_str_.get(), buffer_str.c_str(), length + 1);
399 in_use_ = false; 403 in_use_ = false;
400 return buffer_c_str_.get(); 404 return buffer_c_str_.get();
401 } 405 }
402 406
403 } // namespace internal 407 } // namespace internal
404 } // namespace v8 408 } // namespace v8
OLDNEW
« no previous file with comments | « src/counters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698