Skip to content

ui: Support filtering Day Explorer flamegraph by selected tracks - #7031

Open
sanath099 wants to merge 1 commit into
mainfrom
dev/sanath099/dev/sanathku/day-explorer-labels
Open

ui: Support filtering Day Explorer flamegraph by selected tracks#7031
sanath099 wants to merge 1 commit into
mainfrom
dev/sanath099/dev/sanathku/day-explorer-labels

Conversation

@sanath099

Copy link
Copy Markdown
Contributor

Pass track_id and root status to Day Explorer tracks, and use them in computeDayExplorerFlameGraph to construct a recursive query filtering by selected tracks and their descendants.

Bug: 482033855

Welcome to Perfetto!
Make sure your PR has a bug/issue attached or has at least
a clear description of the problem you are trying to fix.

For more details please see
https://perfetto.dev/docs/contributing/getting-started

Pass track_id and root status to Day Explorer tracks, and use them in
computeDayExplorerFlameGraph to construct a recursive query filtering
by selected tracks and their descendants.

Bug: 482033855
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

🎨 Perfetto UI Builds

renderer,
tags: {
kinds: [DAY_EXPLORER_TRACK_KIND],
trackId: trackId.toString(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be a string? Does Perfetto not accept this being a number?

tags: {
kinds: [DAY_EXPLORER_TRACK_KIND],
trackId: trackId.toString(),
isLabelRoot: isRoot && name.startsWith('[Label]'),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty tightly coupled with the google3 side. I think it would make more sense to encode this into the hierarchy. For example, it could be that every hierarchy root is a single root that avoids overlapping count. E.g.

- Regular (root 1)
  - Screen on
  - Screen off
- [Label] Media playback (root 2)
  - etc

trackInfo?.tags?.kinds?.includes(DAY_EXPLORER_TRACK_KIND) &&
trackInfo.tags.trackId !== undefined
) {
if (trackInfo.tags.isPhysicalRoot === true) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why the additional nested if?

if (
  trackInfo?.tags?.kinds?.includes(DAY_EXPLORER_TRACK_KIND) &&
  trackInfo.tags.trackId !== undefined &&
  trackInfo.tags.isPhysicalRoot === true) {

// to only include energy from the selected tracks and their recursive descendants.
// If a physical track is selected, we exclude label roots to avoid double-counting.
const selectedTrackIds: bigint[] = [];
let hasPhysicalSelected = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only looking for roots, so this can still overcount. For example:

[ ] - Screen on
[x]     - Compute
[x]     - Networking
[ ] - Screen off
[ ]     - Compute
[ ]     - Networking
[ ] - [Label] Media
[x]     - Compute
[ ]     - Networking

And this is probably worse even, since you lose the context of being under the label. Though, it's arguably a bad idea for someone to select like this :)

The original motivation for not filtering by track was to ensure all area selections had context. Additional filtering could be done on the flame chart.

I wonder if a better solution is to try to find the root for every track in the area selection. It would still allow overcounting, but only if you explicitly select tracks from regular and label tracks. And, if you do, you would at least have the appropriate context. But it would be better than today where it always shows the label tracks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants