Commit 3ee3794e authored by Eric Seckler's avatar Eric Seckler Committed by Commit Bot

perfetto: Copy some recent fixes to TrackEvent sink

These were only applied to the ChromeEventBundle sink originally, but
should also affect the TrackEvent sink.

Bug: 928738
Change-Id: I8ea1c3baa2c70b2b224c890025b5f92fa74da95e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1541091Reviewed-by: default avataroysteine <oysteine@chromium.org>
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644901}
parent 657012ea
......@@ -392,8 +392,20 @@ void TrackEventThreadLocalEventSink::UpdateDuration(
return;
}
DCHECK_EQ(handle.event_index, current_stack_depth_);
DCHECK_GE(current_stack_depth_, 1u);
// During trace shutdown, as the list of enabled categories are
// non-monotonically shut down, there's the possibility that events higher in
// the stack will have their category disabled prior to events lower in the
// stack, hence we get misaligned here. In this case, as we know we're
// shutting down, we leave the events unfinished.
if (handle.event_index != current_stack_depth_) {
DCHECK(handle.event_index > 0 &&
handle.event_index < current_stack_depth_ &&
!base::trace_event::TraceLog::GetInstance()->IsEnabled());
current_stack_depth_ = handle.event_index - 1;
return;
}
current_stack_depth_--;
complete_event_stack_[current_stack_depth_].UpdateDuration(now, thread_now);
AddTraceEvent(&complete_event_stack_[current_stack_depth_], nullptr);
......
......@@ -51,7 +51,7 @@ class COMPONENT_EXPORT(TRACING_CPP) TrackEventThreadLocalEventSink
base::trace_event::ConvertableToTraceFormat* value,
perfetto::protos::pbzero::DebugAnnotation* annotation);
static constexpr size_t kMaxCompleteEventDepth = 20;
static constexpr size_t kMaxCompleteEventDepth = 30;
// TODO(eseckler): Make it possible to register new indexes for use from
// TRACE_EVENT macros.
......
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