Skip to content

ref(perfetto): Rework perfetto conversions#6243

Open
Dav1dde wants to merge 2 commits into
masterfrom
dav1d/improve-perfetto
Open

ref(perfetto): Rework perfetto conversions#6243
Dav1dde wants to merge 2 commits into
masterfrom
dav1d/improve-perfetto

Conversation

@Dav1dde

@Dav1dde Dav1dde commented Jul 16, 2026

Copy link
Copy Markdown
Member

No (or very minimal) functional changes intended.

  • Better de-duplication, slightly more efficient through HashTable use for images, frames and stacks, instead of just frames.
  • Slightly less allocations, again through HashTable referencing strings already allocated elsewhere.
  • Introduction of builder types, used to build up our own sample format.
  • Introduction of cache types, used just to cache data for a single sequence id
  • InternTables is no longer also abused for caches.
  • More modules to have proper type visibility, important for a follow-up to introduce better/stricter limits.
  • Rework of most of the Rust code to actually make it Rusty not Codex Rust.
  • Introduces a StackId and FrameId new-type wrapper instead of passing indices around, may prevent a bug at some point.
  • Removes a bunch of useless extra intermediate types (like ResolvedFrame)
  • Also happens to fix the precision for some timestamps, less precision loss (even if ms precision is enough).
  • Caches are retained until there is a clear flag, instead of always clearing.

And yes there are some off-by-ones when it comes to the limits, they don't matter, if it messes with someone's OCD, I can fix them.

@Dav1dde
Dav1dde requested a review from a team as a code owner July 16, 2026 18:20
@Dav1dde Dav1dde self-assigned this Jul 16, 2026
@Dav1dde
Dav1dde requested a review from markushi July 16, 2026 18:20
cursor[bot]

This comment was marked as low quality.

Comment thread relay-profiling/src/perfetto/convert/build.rs
Comment thread relay-profiling/src/perfetto/convert.rs
@Dav1dde
Dav1dde force-pushed the dav1d/improve-perfetto branch from f90f5ae to a0224f8 Compare July 16, 2026 18:34
Comment thread relay-profiling/src/perfetto/convert/consts.rs
@Dav1dde
Dav1dde force-pushed the dav1d/improve-perfetto branch from a0224f8 to 4bcb84d Compare July 16, 2026 19:11
cursor[bot]

This comment was marked as low quality.

@Dav1dde
Dav1dde force-pushed the dav1d/improve-perfetto branch from 4bcb84d to fade150 Compare July 16, 2026 19:23

@loewenheim loewenheim left a comment

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.

Looks very good, just some minor things.

pub const CLOCK_BOOTTIME: u32 = 6;

/// Maximum number of raw samples we collect from a Perfetto trace before
/// bailing out. At 100 Hz across multiple threads, a 66-second chunk

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.

Why is a 66-second chunk relevant in particular?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Presumably due to the max profile length we support:

/// For continuous profiles, each chunk can be at most 1 minute.
/// In certain circumstances (e.g. high cpu load) the profiler
/// the profiler may be stopped slightly after 60, hence here we
/// give it a bit more room to handle such cases (66 instead of 60)
const MAX_PROFILE_CHUNK_DURATION: Duration = Duration::from_secs(66);

Comment thread relay-profiling/src/perfetto/convert/intern.rs Outdated
Comment thread relay-profiling/src/perfetto/convert/mod.rs Outdated
Comment thread relay-profiling/src/perfetto/convert/utils.rs Outdated
Comment thread relay-profiling/src/perfetto/convert/utils.rs Outdated
@Dav1dde
Dav1dde requested a review from loewenheim July 17, 2026 10:45
cursor[bot]

This comment was marked as low quality.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants