Open Bug 1518949 Opened 5 years ago Updated 2 years ago

Coordinate profiler sampling between processes so that samplers in different processes don't starve each other

Categories

(Core :: Gecko Profiler, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox66 --- affected

People

(Reporter: mstange, Unassigned)

References

(Blocks 1 open bug)

Details

At the moment, profiler sampling works like this: Every process has a sampler thread, which does the following:

  1. Iterate over all profiled threads:
    Pause the thread, collect the thread's stack, resume the thread.
  2. Sleep for "interval" milliseconds.
  3. Go to 1.

This means that, as we add more processes, we put a lot of strain on the OS thread scheduler, especially on low-core machines. It also means that adding another process has more profiler overhead than adding another thread.

It would be much nicer if we had one global sampler which did the following:

  1. Iterate over all profiled threads in all profiled processes, sequentially:
    Pause the thread, collect the thread's stack, resume the thread.
  2. Sleep for "interval" milliseconds.
  3. Go to 1.

We can't remotely grab a stack from a different process, but maybe we can find another way of scheduling sampling across processes that gives us an equivalent solution.

Having only one thread that does the timed sleep would also help with sub-millisecond sampling on Windows, which does a busy-wait.

Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.