Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP share more between threads #5273

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

mstange
Copy link
Contributor

@mstange mstange commented Dec 19, 2024

No description provided.

@mstange mstange force-pushed the push-wsuwrvunnvmr branch 2 times, most recently from a5c010a to f036db9 Compare January 2, 2025 22:35
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 91.05099% with 86 lines in your changes missing coverage. Please review.

Project coverage is 86.04%. Comparing base (f07cfdc) to head (eaa6409).

Files with missing lines Patch % Lines
src/profile-logic/processed-profile-versioning.js 78.70% 21 Missing and 2 partials ⚠️
src/profile-logic/sanitize.js 92.44% 19 Missing and 2 partials ⚠️
src/profile-logic/merge-compare.js 87.20% 15 Missing and 1 partial ⚠️
src/profile-logic/profile-data.js 90.37% 11 Missing and 2 partials ⚠️
src/profile-logic/cpu.js 50.00% 5 Missing and 3 partials ⚠️
src/profile-logic/process-profile.js 97.40% 2 Missing ⚠️
src/actions/receive-profile.js 92.30% 1 Missing ⚠️
src/profile-logic/tracks.js 92.85% 1 Missing ⚠️
src/test/fixtures/profiles/processed-profile.js 97.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5273      +/-   ##
==========================================
- Coverage   86.07%   86.04%   -0.04%     
==========================================
  Files         311      311              
  Lines       29657    30153     +496     
  Branches     8196     8262      +66     
==========================================
+ Hits        25528    25944     +416     
- Misses       3547     3617      +70     
- Partials      582      592      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mstange mstange force-pushed the push-wsuwrvunnvmr branch from f036db9 to 5f8c157 Compare January 3, 2025 20:26
@mstange mstange force-pushed the push-wsuwrvunnvmr branch 3 times, most recently from e016a6d to 60854ff Compare January 15, 2025 15:54
This variable is always non-null.
We likely wanted to check markerSchemaName but that's also always non-null at the moment.
…looking up the schema.

The usefulness of this special case appears to have been limited to
writing tests: Our tests contained many markers which only match a
schema due to their name.

So this patch moves the special case to the handling of TestDefinedMarkers:
When the payload is absent, we synthesize a { type: <markerName> } payload
for convenience.

Markers from Firefox never needed this special case. And the special
handling caused some trouble when markers were mistakenly matched
against a schema with a custom label that was referring to fields
which weren't present on the marker (because the marker doesn't have
a payload).
I found two cases of this in the wild, with "CPUSpeed" and "Awake"
markers:

The first CPUSpeed marker on https://share.firefox.dev/4gmLaif
has a null data field.
Before this patch, it matched a CPUSpeed schema. This gave it a
broken tableLabel ("CPUSpeed Speed = GHz").

For Awake markers (e.g. on https://share.firefox.dev/403suOD ), the
code in Firefox which emits these markers uses the typed marker API
for the IntervalStart marker, and the payload-less API for the IntervalEnd
marker:
https://searchfox.org/mozilla-central/rev/43ce3de32b3a946bceac74c3badf442af9f245c0/tools/profiler/core/platform.cpp#7496-7497
So unpaired end markers got a broken tableLabel from the Awake schema
before this patch ("Awake - CPU Id = " on https://share.firefox.dev/4fx8cSf ).

These two cases are fixed by this patch - the two markers get the
default tableLabel, which does not refer to these absent fields.
RefreshDriverTick markers from Firefox are Text markers.
Firefox (as of Jan 2025) has never emitted a 'RefreshDriverTick' schema.

Only pre-schema profiles have a 'RefreshDriverTick' schema, which they
get from the v33 upgrader.

Post-schema profiles don't display RefreshDriverTick markers in the
timeline-overview area, because Text markers aren't displayed there.

This commit makes the marker test consistent with what Firefox outputs.
Now it no longer relies on a special case in getMarkerSchemaName which
looks up schemas for Text markers based on the marker name.

To test timeline-overview filtering, a new marker is introduced, with
schema name 'VisibleInTimelineOverview'.
Just use data.type, like for other normal markers.

This mostly just affects the RefreshDriverTick marker from upgraded profiles:

 - Pre-schema profiles which get their schema from the v33 upgrader have a
   schema with name 'RefreshDriverTick' with 'timeline-overview' in the display array.
 - Post-schema profiles from Firefox do not have a 'RefreshDriverTick' schema.
   The RefreshDriverTick markers in such profiles is a regular Text marker,
   and Text markers do not show up in the 'timeline-overview' area.

This change makes it so that the 'RefreshDriverTick' schema from
upgraded pre-schema profiles becomes unused, and the markers vanish from
the timeline-overview area.
This is consistent with post-schema profiles.
This adjusts some markers and schemas to be more consistent with
what Firefox outputs:

Markers with { type: "Paint" / "Navigation" / "Layout" } aren't present
in any existing profiles, they were neither emitted by Firefox nor generated
by an upgrader.
Instead, these markers have { type: "tracing" } in their payload.

DOMEvent markers were tracing markers in the past, and have their own
schema today. The test now uses both variants.

CC markers were tracing markers in the past, and have their own schema
today. This test now uses the former.

Post-schema profiles from Firefox have schema with name 'tracing'.
This makes tracing markers visible in the 'timeline-overview' area.
This patch adds the tracing schema to the test profile.

This affects a test which was expecting that 'RandomTracingMarker' was not
visible in the timeline-overview area. The test expectation is adjusted.

Upgraded pre-schema profiles do not have a 'tracing' schema. This will
be fixed in the next commit.
…emas.

This adds an upgrader so that old profiles still get their CC markers
displayed in the memory track and non-CC tracing markers displayed in
the timeline-overview area.

Newer profiles don't need this special case because their CC markers have
a CC schema which correctly puts them in the memory track, and because
they include a 'tracing' schema which puts non-CC tracing markers into
the timeline-overview area.
This removes the distinction between the "serializable"
and the "unserialized" / in-memory format.

The raw profile is now always serializable to JSON.

The format stays unchanged - samples and counter samples are still
allowed to have their timestamps stored as either timestamps or
as time deltas.

We now convert the samples and counter samples into the
timeDeltas format during processing and in the upgrader. This
matches the previous behavior where we did this conversion during
profile serialization.
@mstange mstange force-pushed the push-wsuwrvunnvmr branch 2 times, most recently from 2735b45 to 3779d4d Compare January 20, 2025 19:40
Stop storing them in the file, compute them at runtime.
This reduces profile sizes.
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.

1 participant