-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
misc(timing): move timing-trace to async events #6440
Conversation
const startEvt = { | ||
// 1) Remove 'lh:' for readability | ||
// 2) Colons in user_timing names get special handling in traceviewer we don't want. https://goo.gl/m23Vz7 | ||
// Replace with a 'Modifier letter colon' ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆
pid: 0, | ||
tid: trackName === 'measures' ? 50 : 75, | ||
ph: 'X', | ||
tid: threadId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like I'm missing something.
I only see one call to this method changed with a threadId isn't this basically the same as what was happening before then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah totally the same as before. trackName => threadId has no functional changes, really. with these new events we can't label the track.
not a huge deal anyway.
expect(consoleError.mock.calls[0][0]).toContain('measures overlap'); | ||
it('generates a pair of trace event', () => { | ||
const events = generateTraceEvents(mockEntries[0]); | ||
expect(events).toMatchSnapshot(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
] | ||
`; | ||
|
||
exports[`generateTraceEvents generates a pair of trace event 1`] = `Array []`; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
2af3faf
to
444be63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code seems fine to me other than test Q!
expect(consoleError.mock.calls[0][0]).toContain('measures overlap'); | ||
it('generates a pair of trace events', () => { | ||
const events = generateTraceEvents([mockEntries[0]]); | ||
expect(events.slice(0, 1)).toMatchSnapshot(); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: zero duration test cov not hit.
expect(consoleError.mock.calls[0][0]).toContain('measures overlap'); | ||
it('generates a pair of trace events', () => { | ||
const events = generateTraceEvents([mockEntries[0]]); | ||
expect(events.slice(0, 1)).toMatchSnapshot(); | ||
}); | ||
}); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call. actually we dont need the ph:'n'
now that we're on async events.
problem solved. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
} | ||
} | ||
} | ||
|
||
/** | ||
* Generates a chromium trace file from user timing measures | ||
* Adapted from https://github.com/tdresser/performance-observer-tracing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a note about how threadId
is used?
// 1) Remove 'lh:' for readability | ||
// 2) Colons in user_timing names get special handling in traceviewer we don't want. https://goo.gl/m23Vz7 | ||
// Replace with a 'Modifier letter colon' ;) | ||
name: entry.name.replace('lh:', '').replace(/:/g, '꞉'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆
maybe do an explicit .replace(/:/g, '\ua789'),
just to make it doubly clear that the character is different?
// 2) Colons in user_timing names get special handling in traceviewer we don't want. https://goo.gl/m23Vz7 | ||
// Replace with a 'Modifier letter colon' ;) | ||
name: entry.name.replace('lh:', '').replace(/:/g, '꞉'), | ||
cat: 'blink.user_timing', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it feels like doing this should be possible without faking out a browser trace but w/e traceviewer :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
traceviewer wont group these but give each measure its own track otherwise
and devtools needs it to view them.
@@ -50,7 +50,7 @@ function saveTraceFromCLI() { | |||
// eslint-disable-next-line no-console | |||
console.log(` | |||
> Timing trace file saved to: ${traceFilePath} | |||
> Open this file in chrome://tracing | |||
> Open this file in DevTools perf panel (or if it's a -G/A run, use chrome://tracing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does -G/A run
refer to a "-G
or an -A
run", or a -GA
run or a regular run (that did both gathering and auditing)?
(with nits :) |
Motivated by #6410
I was avoiding async events for .. mysterious reasons before. But really these will be overlapping, so it makes more sense to be async.
Overlapping happens in promise.all()s often:
Here's how a few timing traces look now: