Open Bug 1540762 Opened 6 years ago Updated 3 years ago

Telemetry for lock wait time on the main thread

Categories

(Core :: XPCOM, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox68 --- affected

People

(Reporter: mayhemer, Unassigned)

References

(Depends on 1 open bug)

Details

This could be an interesting thing to collect. We name all our mutexes so we could sum the time spent waiting and find any mutexes that are too offending.

We could also collect this lock wait time in the profiler, as well as the locked duration, which could help find sources of long wait times.

Note that I filed this to find in-the-field issues. I'd like to find those that may significantly (tm) stand out for significant (tm) amount of hits. On weaker or extra busy hardware 5ms+ average can be quite expected. On i7@4Ghz not so much.

It'd be interesting to see how much this slows things down, as the vast vast majority of locks are uncontended. (jesup did measurements on this in bug 1498643.) If somebody does decide to have a crack at this--maybe doing the profiler first to see if any obvious things turn up--don't forget that you also need to handle condition variables.

Severity: normal → enhancement
Priority: -- → P3
See Also: → 1498643

(In reply to Nathan Froyd [:froydnj] from comment #3)

If somebody does decide to have a crack at this--maybe doing the profiler first to see if any obvious things turn up--don't forget that you also need to handle condition variables.

I believe condvars are a different story (or at least a story on its own). If a thread just waits for a job to get, then it's fine to wait even indefinitely. More interesting would be to measure the time between notify and wakeup, where possible. Was that what what you had in mind, Nathan?

Sure, the behavior of condition variables doesn't need to be altered, but you probably want to take into account that the mutex is not actually held while you are waiting on the condition variable. I suppose that doesn't matter so much for wait time, but it does matter for lock duration (comment 2).

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