Closed
Bug 1349801
Opened 8 years ago
Closed 8 years ago
Support sub-millisecond profiling intervals on Windows
Categories
(Core :: Gecko Profiler, enhancement)
Core
Gecko Profiler
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: mstange, Assigned: away)
References
Details
Attachments
(3 files)
7.57 KB,
patch
|
mstange
:
review+
|
Details | Diff | Splinter Review |
4.49 KB,
patch
|
mstange
:
review+
|
Details | Diff | Splinter Review |
1.77 KB,
patch
|
mstange
:
review+
|
Details | Diff | Splinter Review |
Profiles collected on Windows usually have an effective sampling interval of about 2ms. We should find out whether it's possible to reduce this.
The Windows Sleep function only accepts integer milliseconds. It looks like creating an accurate SleepMicro function is a bit of work: http://stackoverflow.com/a/11470617
We should also check how much time it takes to walk the stack. Maybe inaccurate sleeps aren't even the problem.
If we request a Sleep(1) and end up sleeping longer than 1ms, we should check whether it helps to supply lower numbers to timeBeginPeriod / timeEndPeriod.
Bug 1344169 will make us try to dynamically adjust the sleep length on Windows, but I doubt it's going to help as long as we can't sleep less than 1ms.
I was going to suggest that we warn if timeBeginPeriod fails, but on my machine, timeBeginPeriod(1) returns TIMERR_NOERROR even though I can't capture samples that fast.
Reporter | ||
Comment 2•8 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #0)
> If we request a Sleep(1) and end up sleeping longer than 1ms, we should
> check whether it helps to supply lower numbers to timeBeginPeriod /
> timeEndPeriod.
Oh, timeBeginPeriod only accepts integer milliseconds. So going below 1 isn't even an option.
Reporter | ||
Comment 4•8 years ago
|
||
David, would you like to investigate this some more? It might be worth using a busy-loop just as an experiment and seeing whether that even yields useful data. (Apparently there's a "pause" instruction that makes busy loops not waste as much CPU as it usually would, that seems worth trying out.)
Flags: needinfo?(dmajor)
Ok, I'll try to play around with it if/when I have a chance.
This is on my list to look at, currently behind profiler crash/hang fixes.
Flags: needinfo?(dmajor)
I tried using SetWaitableTimer which claims to have 100ns resolution, but it always returned immediately for me. Maybe there is some implicit minimum. I guess "pause" is the best we can do. :(
Assignee: nobody → dmajor
Attachment #8865033 -
Flags: review?(mstange)
Attachment #8865034 -
Flags: review?(mstange)
![]() |
Assignee | |
Comment 10•8 years ago
|
||
Because this is going to devour one core per Firefox process, I'm not comfortable unleashing it on the whole world. I've made it so that we don't use this code, not even for overshoots, unless your sampling interval is explicitly <1ms. (And checking that variable is why I made SleepMicro a method of SamplerThread.)
Attachment #8865036 -
Flags: review?(mstange)
Reporter | ||
Updated•8 years ago
|
Attachment #8865033 -
Flags: review?(mstange) → review+
Reporter | ||
Updated•8 years ago
|
Attachment #8865034 -
Flags: review?(mstange) → review+
Reporter | ||
Updated•8 years ago
|
Attachment #8865036 -
Flags: review?(mstange) → review+
Comment 11•8 years ago
|
||
Pushed by dmajor@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0aae6f865e8d
Make SleepMicro a method of SamplerThread. r=mstange
https://hg.mozilla.org/integration/mozilla-inbound/rev/cde48b1034b6
Make aMicroseconds unsigned to avoid a bunch of checks. r=mstange
https://hg.mozilla.org/integration/mozilla-inbound/rev/fdfb138fa1a1
Allow sub-millisecond profiler intervals with a busy wait on Windows. r=mstange
Comment 12•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/0aae6f865e8d
https://hg.mozilla.org/mozilla-central/rev/cde48b1034b6
https://hg.mozilla.org/mozilla-central/rev/fdfb138fa1a1
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•