Commit 5dd94008 authored by fmeawad's avatar fmeawad Committed by Commit bot

[RuntimeCallStats] Fix reset scope for tracing

https://codereview.chromium.org/2296243002/ introduced 2 minor bugs
related to the Reset scope.

The tracing version requires that we reset the counters everytime we
start a new top level trace event, unless the top level one is not
really a top level (i.e. has the right type but called in a nested way)

Bugs are:
1- Reseting was guarded behind a check for the runtime call stats
version only.
2- We never set that we are already inside a scope, so the nested
case would fail as well.

R=lpy@chromium.org, cbruni@chromium.org
BUG=642373

Review-Url: https://codereview.chromium.org/2311033002
Cr-Commit-Position: refs/heads/master@{#39214}
parent eca8a5eb
......@@ -338,7 +338,9 @@ void RuntimeCallStats::Print(std::ostream& os) {
}
void RuntimeCallStats::Reset() {
if (!FLAG_runtime_call_stats) return;
if (!FLAG_runtime_call_stats &&
!TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED())
return;
#define RESET_COUNTER(name) this->name.Reset();
FOR_EACH_MANUAL_COUNTER(RESET_COUNTER)
#undef RESET_COUNTER
......@@ -358,6 +360,8 @@ void RuntimeCallStats::Reset() {
#define RESET_COUNTER(name) this->Handler_##name.Reset();
FOR_EACH_HANDLER_COUNTER(RESET_COUNTER)
#undef RESET_COUNTER
in_use_ = true;
}
const char* RuntimeCallStats::Dump() {
......
......@@ -804,6 +804,7 @@ class RuntimeCallStats {
size_t len_ = 0;
// Counter to track recursive time events.
RuntimeCallTimer* current_timer_ = NULL;
// Used to track nested tracing scopes.
bool in_use_;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment