New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 618054 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

tracing: demistify "metadata" events

Project Member Reported by primiano@chromium.org, Jun 7 2016

Issue description

In the context of https://codereview.chromium.org/2040663002/ oysteine@ and I realised that the current state of "metadata" event is an utter mess. "metadata" became an extremely overloaded term in tracing.

When we speak of metadata events there are four, completely orthogonal, things in play:
1) The fact that the event is unconditionally added to the trace, regardless of the fact that the default categories are enabled or not (i.e. category filter "-*")
2) The fact that the event, if added, is guaranteed to be emitted in the final trace and never pushed out from the ring buffer
3) The category of the event itself (__metadata or something else).
4) The phase of the event itself (TRACE_EVENT_PHASE_METADATA or something else)

All these three concepts today are inconsistently intermixed, leading to confusing situations like https://github.com/catapult-project/catapult/issues/2341.

Some concrete examples:
-----------------------

- metadata events like "process_name" which are added in TraceLog::AddMetadataEventsWhileLocked() satisfy 1+2+3+4

- TRACE_EVENT_API_ADD_METADATA_EVENT, which is used by memory-infra heap profiler and for IsTimeTicksHighResolution, satistifes only 1,2,4. It also satisfies 3 if it is called with GetCategoryGroupEnabled("__metadata") as argument.

- TRACE_EVENT_METADATA1, which is used by v8.cpu_profile, satisfies 1,4, but not 2,3. In particular, if the category filter is "-*" the event will be dropped on the floor event for the "__metadata" category.

- TRACE_EVENT_CLOCK_SYNC_* satisfy only 3. Clock sync markers are NOT added to the trace in presence of "-*". They Are not guaranteed to be persistent in the trace (even though the current implementation makes it very unlikely to get dropped as they are added before stopping the trace). They have ph:TRACE_EVENT_PHASE_CLOCK_SYNC. They have cat: __metadata though.

Oystein and I are discussing and will figure out a plan.
In the meantime the most urgent thing to fix is guaranteeing that TRACE_EVENT_CLOCK_SYNC_* satisfy 1. I'll send out a temporary fix to that.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jun 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d5fbde04754b74a75c0d75878f275e37791118b1

commit d5fbde04754b74a75c0d75878f275e37791118b1
Author: primiano <primiano@chromium.org>
Date: Tue Jun 07 22:16:41 2016

tracing: ensure __metadata events are always added to the trace

This is a temporary workaround to deal with the fact that some
metadata events, such as TRACE_EVENT_CLOCK_SYNC_*, are not added to
the trace if the category filter disables the default categories (-*).
A proper long-term fix is being discussd in the attached bug.

BUG=618054

Review-Url: https://codereview.chromium.org/2047793002
Cr-Commit-Position: refs/heads/master@{#398398}

[modify] https://crrev.com/d5fbde04754b74a75c0d75878f275e37791118b1/base/trace_event/trace_event_unittest.cc
[modify] https://crrev.com/d5fbde04754b74a75c0d75878f275e37791118b1/base/trace_event/trace_log.cc

Comment 2 by zh...@chromium.org, Jun 29 2016

Cc: zh...@chromium.org
Components: Speed>Tracing
Components: -Internals>Tracing

Comment 5 by ofrobots@google.com, May 15 2018

> Oystein and I are discussing and will figure out a plan.

Did a plan end up getting materialized?
There's been some shakeups in the tracing space since then; currently we're working on deprecating TraceLog in favor of Perfetto (https://bugs.chromium.org/p/chromium/issues/list?can=2&q=label%3APerfetto) and figuring out how to do metadata would be part of that.

Sign in to add a comment