Commit d246e65b authored by Eric Seckler's avatar Eric Seckler Committed by Commit Bot

perfetto: Add some CHECKs to help debug crbug.com/983307

Bug: 983307
Change-Id: I7976df41d85268287757afd86af6f9bc4c52e814
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1758065
Commit-Queue: oysteine <oysteine@chromium.org>
Auto-Submit: Eric Seckler <eseckler@chromium.org>
Reviewed-by: default avataroysteine <oysteine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687703}
parent 5c4c8350
...@@ -193,6 +193,9 @@ void TrackEventThreadLocalEventSink::ClearIncrementalState() { ...@@ -193,6 +193,9 @@ void TrackEventThreadLocalEventSink::ClearIncrementalState() {
void TrackEventThreadLocalEventSink::AddTraceEvent( void TrackEventThreadLocalEventSink::AddTraceEvent(
base::trace_event::TraceEvent* trace_event, base::trace_event::TraceEvent* trace_event,
base::trace_event::TraceEventHandle* handle) { base::trace_event::TraceEventHandle* handle) {
// TODO(eseckler): Remove after crbug.com/991126 is fixed.
CHECK(trace_event);
// TODO(eseckler): Support splitting COMPLETE events into BEGIN/END pairs. // TODO(eseckler): Support splitting COMPLETE events into BEGIN/END pairs.
// For now, we emit them as legacy events so that the generated JSON trace // For now, we emit them as legacy events so that the generated JSON trace
// size remains small. // size remains small.
...@@ -211,6 +214,10 @@ void TrackEventThreadLocalEventSink::AddTraceEvent( ...@@ -211,6 +214,10 @@ void TrackEventThreadLocalEventSink::AddTraceEvent(
} }
complete_event_stack_[current_stack_depth_] = std::move(*trace_event); complete_event_stack_[current_stack_depth_] = std::move(*trace_event);
// TODO(eseckler): Remove after crbug.com/991126 is fixed.
CHECK(complete_event_stack_[current_stack_depth_].category_group_enabled());
handle->event_index = ++current_stack_depth_; handle->event_index = ++current_stack_depth_;
handle->chunk_index = kMagicChunkIndex; handle->chunk_index = kMagicChunkIndex;
handle->chunk_seq = session_id_; handle->chunk_seq = session_id_;
...@@ -235,6 +242,9 @@ void TrackEventThreadLocalEventSink::AddTraceEvent( ...@@ -235,6 +242,9 @@ void TrackEventThreadLocalEventSink::AddTraceEvent(
DoResetIncrementalState(trace_event, explicit_timestamp); DoResetIncrementalState(trace_event, explicit_timestamp);
} }
// TODO(eseckler): Remove after crbug.com/991126 is fixed.
CHECK(trace_event->category_group_enabled());
const char* category_name = const char* category_name =
TraceLog::GetCategoryGroupName(trace_event->category_group_enabled()); TraceLog::GetCategoryGroupName(trace_event->category_group_enabled());
InterningIndexEntry interned_category = InterningIndexEntry interned_category =
...@@ -572,16 +582,18 @@ void TrackEventThreadLocalEventSink::UpdateDuration( ...@@ -572,16 +582,18 @@ void TrackEventThreadLocalEventSink::UpdateDuration(
return; return;
} }
DCHECK_GE(current_stack_depth_, 1u); // TODO(eseckler): Revert to DCHECK after crbug.com/983307 is fixed.
CHECK_GE(current_stack_depth_, 1u);
// During trace shutdown, as the list of enabled categories are // During trace shutdown, as the list of enabled categories are
// non-monotonically shut down, there's the possibility that events higher in // 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 // 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 // stack, hence we get misaligned here. In this case, as we know we're
// shutting down, we leave the events unfinished. // shutting down, we leave the events unfinished.
if (handle.event_index != current_stack_depth_) { if (handle.event_index != current_stack_depth_) {
DCHECK(handle.event_index > 0 && // TODO(eseckler): Revert to DCHECKs after crbug.com/983307 is fixed.
handle.event_index < current_stack_depth_ && CHECK(handle.event_index > 0);
!base::trace_event::TraceLog::GetInstance()->IsEnabled()); CHECK(handle.event_index < current_stack_depth_);
CHECK(!base::trace_event::TraceLog::GetInstance()->IsEnabled());
current_stack_depth_ = std::min( current_stack_depth_ = std::min(
current_stack_depth_, static_cast<uint32_t>(handle.event_index - 1)); current_stack_depth_, static_cast<uint32_t>(handle.event_index - 1));
return; return;
......
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