Auto-Submit | +1 |
Commit-Queue | +1 |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
+Mikhail for review as well, but I think this should be fine.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
auto phase = trace_event->phase();
Actually minor nit: Can we move this `phase` local outside of the write_args lambda?
Looks like it (and the logic to override it to PHASE_BEGIN for PHASE_COMPLETE) already exists a few lines down, so all we need to do is move it above the lambda and capture it into it?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Auto-Submit | +1 |
Commit-Queue | +2 |
Actually minor nit: Can we move this `phase` local outside of the write_args lambda?
Looks like it (and the logic to override it to PHASE_BEGIN for PHASE_COMPLETE) already exists a few lines down, so all we need to do is move it above the lambda and capture it into it?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
3 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: base/trace_event/trace_log.cc
Insertions: 7, Deletions: 9.
@@ -259,15 +259,16 @@
TraceLog::GetInstance()->GetCategoryGroupName(
trace_event->category_group_enabled()));
- auto write_args = [trace_event](perfetto::EventContext ctx) {
+ auto phase = trace_event->phase();
+ if (phase == TRACE_EVENT_PHASE_COMPLETE) {
+ phase = TRACE_EVENT_PHASE_BEGIN;
+ }
+
+ auto write_args = [trace_event, phase](perfetto::EventContext ctx) {
WriteDebugAnnotations(trace_event, ctx.event());
uint32_t id_flags = trace_event->flags() & (TRACE_EVENT_FLAG_HAS_ID |
TRACE_EVENT_FLAG_HAS_LOCAL_ID |
TRACE_EVENT_FLAG_HAS_GLOBAL_ID);
- auto phase = trace_event->phase();
- if (phase == TRACE_EVENT_PHASE_COMPLETE) {
- phase = TRACE_EVENT_PHASE_BEGIN;
- }
if (!id_flags &&
perfetto::internal::TrackEventLegacy::PhaseToType(phase) !=
perfetto::protos::pbzero::TrackEvent::TYPE_UNSPECIFIED) {
@@ -290,14 +291,11 @@
}
};
- auto phase = trace_event->phase();
auto flags = trace_event->flags();
base::TimeTicks timestamp = trace_event->timestamp().is_null()
? TRACE_TIME_TICKS_NOW()
: trace_event->timestamp();
- if (phase == TRACE_EVENT_PHASE_COMPLETE) {
- phase = TRACE_EVENT_PHASE_BEGIN;
- } else if (phase == TRACE_EVENT_PHASE_INSTANT) {
+ if (phase == TRACE_EVENT_PHASE_INSTANT) {
auto scope = flags & TRACE_EVENT_FLAG_SCOPE_MASK;
switch (scope) {
case TRACE_EVENT_SCOPE_GLOBAL:
```
base: Fix trace events with TRACE_EVENT_PHASE_COMPLETE
Skia uses TRACE_EVENT_PHASE_COMPLETE and UpdateTraceEventDuration() for
scoped trace events. This isn't working correctly - the traces show up
with zero duration and can mess up subsequent non-Skia trace events too.
This can be traced to a bug in OnAddLegacyTraceEvent() - it first tries
to patch TRACE_EVENT_PHASE_COMPLETE to TRACE_EVENT_PHASE_BEGIN so that
perfetto can record the event, but later it annotates the event with
`set_legacy_event` if the original phase doesn't have a perfetto
equivalent type which is the case with TRACE_EVENT_PHASE_COMPLETE.
This CL fixes that bug by overriding TRACE_EVENT_PHASE_COMPLETE to
TRACE_EVENT_PHASE_BEGIN before checking for annotating the event as a
legacy event. This ensures the code works like before for other kinds
of non-perfetto phase types like async begin/end, arg metadata, etc.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |