AutoProfileRunnable uses TimeStamp::Now even when the profiler isn't running
Categories
(Core :: Gecko Profiler, defect)
Tracking
()
People
(Reporter: smaug, Assigned: julienw)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression, Whiteboard: [sp3])
Attachments
(1 file)
This shows up in speedometer, especially on linux where ::Now() is slow
https://share.firefox.dev/3kOggYb VanillaJS-TodoMVC
Reporter | ||
Updated•1 year ago
|
Updated•1 year ago
|
Comment 1•1 year ago
|
||
Set release status flags based on info from the regressing bug 1688300
:florian, since you are the author of the regressor, bug 1688300, could you take a look?
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Comment 2•1 year ago
|
||
Should we check at [1] if profiler_thread_is_being_profiled_for_markers()
before adding this RAII? My understanding is that most Runnable are quick so it would be better to check it here rather than in the constructor and destructor. Thoughts?
Reporter | ||
Comment 3•1 year ago
|
||
The particular case in the profile is even about a script runner. Those are synchronous from main event loop point of view, and there can be lots of them.
Comment 4•1 year ago
|
||
(In reply to Julien Wajsberg [:julienw] from comment #2)
Should we check at [1] if
profiler_thread_is_being_profiled_for_markers()
before adding this RAII?
That would work, yes. You can do it with mozilla::Maybe
and .emplace
(example here: https://searchfox.org/mozilla-central/rev/7a9e3bbab8f81c2cbc72a394047f948da9cfef9a/tools/profiler/public/ProfilerLabels.h#111,114)
My understanding is that most Runnable are quick so it would be better to check it here rather than in the constructor and destructor. Thoughts?
My thought when reading the question was that it would be nice to see markers for long runnables if the profiler was started during the runnable... but that case already doesn't work, so doing what you suggested wouldn't be a regression.
Assignee | ||
Comment 5•1 year ago
|
||
BTW this is happening in nightly but not release or beta:
https://searchfox.org/mozilla-central/rev/8e9b4484408154b80d7ede9e1b035819fda48fd2/xpcom/threads/nsThreadUtils.h#369-371
So I'm not sure this should block speedometer 3.
I'm still working on this though.
Assignee | ||
Comment 6•1 year ago
|
||
In Bug 1688300, we implemented that we emit markers when a Runnable
runs. But this has some performance consequences because we instanciate
the RAII even when the profiler doesn't run, even though we don't do
anything in it. Especially we're running TimeStamp::Now() which can be
slow on some platforms.
This patch avoids this by instanciating the RAII only when the profiler
runs.
Updated•1 year ago
|
Pushed by jwajsberg@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e1ddb6a2c5e1 Do not instanciate the Profiler Runnable RAII if the profiler isn't running r=florian
Comment 8•1 year ago
|
||
bugherder |
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Description
•