Add CPU time usage to profiler
Categories
(Core :: Gecko Profiler, enhancement, P3)
Tracking
()
People
(Reporter: sinker, Assigned: gerald)
References
(Blocks 4 open bugs)
Details
Attachments
(4 files)
Running of a task does not mean that it is served for 100% of CPU time. In another word, a task may be scheduled out for having a lower priority and other high priority tasks. It would be useful to understand how much CPU time the kernel actually allocated for a thread. For linux (MacOS?), getrusage(2) can be used to determine how much time a thread is scheduled for. I am not sure, but there must be some similar API in Windows.
Updated•4 years ago
|
Assignee | ||
Comment 2•1 year ago
|
||
In bug 1621407, :snorp wrote:
AFAIK we currently only record real time with each sample. If we also recorded the CPU time (CLOCK_THREAD_CPUTIME_ID on Linux), we would know how long the thread was scheduled by the OS. This may help developers to spot thread or process priority problems.
And coincidentally I've been thinking about this recently, and also for Windows (with e.g., https://docs.microsoft.com/en-au/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreadtimes ), so I'm reviving this bug here, I'm hoping I'll have time later this year -- patches always welcome before that, of course!
Updated•1 year ago
|
Assignee | ||
Updated•9 months ago
|
Assignee | ||
Updated•3 months ago
|
Assignee | ||
Comment 3•3 months ago
|
||
The RunningTimes
class stores CPU measurements. It may seem overkill for only one value, but in the future more measurements will be added.
During sampling, CPU measurements are collected by platform-specific code. This patch doesn't produce anything yet, see later patches.
These are stored with the samples.
Note that for duplicated samples (when a thread is known to be "asleep"), we still need to collect new measurements, because there could potentially be some activity happening, e.g. in system calls.
Finally the measurements are output as extra "samples" values.
Units for these values may platform-specific, so they are stored in the top-level JSON "meta" object.
We don't collect running times in the Base Profiler (yet), but we still need to add the appropriate field names in the samples' "schema", as expected by profiler.firefox.com.
Depends on D99054
Assignee | ||
Comment 4•3 months ago
|
||
Depends on D99413
Assignee | ||
Comment 5•3 months ago
|
||
Depends on D99414
Assignee | ||
Comment 6•3 months ago
|
||
ThreadCPUCycles are in nanoseconds, ThreadKernel/UserTimes in milliseconds with 10ms precision only.
Depends on D99415
Updated•3 months ago
|
Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b9ff676042a8 Scaffolding to output CPU measurements in samples - r=canaltinova https://hg.mozilla.org/integration/autoland/rev/6fc163c0f438 Capture CPU usage on Windows - r=canaltinova https://hg.mozilla.org/integration/autoland/rev/86a42eeb5d85 Capture CPU usage on macos - r=canaltinova https://hg.mozilla.org/integration/autoland/rev/c7e440ee02f8 Capture CPU usage on Linux - r=canaltinova,gcp
Comment 8•2 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b9ff676042a8
https://hg.mozilla.org/mozilla-central/rev/6fc163c0f438
https://hg.mozilla.org/mozilla-central/rev/86a42eeb5d85
https://hg.mozilla.org/mozilla-central/rev/c7e440ee02f8
Updated•2 months ago
|
Description
•