profiler icon indicating copy to clipboard operation
profiler copied to clipboard

Convert `threadCPUDelta` values into `cpuRatio`s in the Thread process pipeline with strong types

Open canova opened this issue 3 years ago • 0 comments

From Markus' review here: https://github.com/firefox-devtools/profiler/pull/4067#pullrequestreview-993791688

Option 4 would take the maxThreadCPUDeltaPerMs into account when computing the thread's processed threadCPUDelta, and compute a cpuRatio per sample. Now activity graph drawing wouldn't even need to know the maxThreadCPUDeltaPerMs, and it can directly get the cpuRatio values from the derived thread.

and

I think option 3 is a bit of an in-between state. I think I would prefer option 2 or option 4. But if we take option 4, I'd like to go all the way and have strong types. This would mean that, instead of reusing the Thread type, we'd have a DerivedThread type with a cpuRatio field instead of a threadCPUDelta field. It would be a fairly invasive change because the Thread type is used in many places. But having a DerivedThread (or FilteredThread) type would have other advantages too, for example it would make it easier to share a stringTable or a stackTable between threads, see the end of this comment: #3919 (comment)

Currently #4067 implements the Option 2, which is less invasive. But it would be good to do this change and implement Option 4.

canova avatar Jun 07 '22 17:06 canova