profiler icon indicating copy to clipboard operation
profiler copied to clipboard

The Chrome importer loses precision by sampling with a 0.5ms interval

Open mstange opened this issue 3 years ago • 2 comments

Profile: https://share.firefox.dev/3rl69ub

Chrome's profiler seems to use a 0.1ms sampling interval, at least on macOS. Importing those Chrome profiles into the Firefox profiler creates a profile that pretends to be sampled at a 0.5ms interval. This loses information.

We do the re-sampling because Chrome's format is a list of "enter function, enter function, exit function, enter function" and it's a bit tricky to convert that into samples. But since the Chrome profiling data is originally based on samples, those "exit" and "enter" events happen at the same timestamp. So we should be able to do a better job here and be able to create a sampled profile with the correct original timestamps.

I think the ART importer does this better.

mstange avatar Apr 12 '22 19:04 mstange

I think you could use the sample weights now to accurately do this.

gregtatum avatar Apr 12 '22 21:04 gregtatum

True. But since the original data was sampling based, I think it would be preferable to emit a profile that's a closer representation of that original truth. So you'd want a single sample to have weight 1 instead of, say, 1.234ms. But anyway, both solutions would work and would fix this bug.

mstange avatar Apr 14 '22 15:04 mstange