Closed
Bug 1244491
Opened 9 years ago
Closed 9 years ago
percentages reported by about:performance are off by a factor of 10
Categories
(Toolkit :: Performance Monitoring, defect)
Toolkit
Performance Monitoring
Tracking
()
RESOLVED
FIXED
mozilla48
| Tracking | Status | |
|---|---|---|
| firefox48 | --- | fixed |
People
(Reporter: pipcet, Assigned: pipcet)
Details
Attachments
(1 file, 1 obsolete file)
|
3.05 KB,
patch
|
Yoric
:
review+
|
Details | Diff | Splinter Review |
about:performance contains code like the following:
cachedElements.eltCPU.textContent = `CPU usage: ${Math.ceil(delta.diff.jank.totalCPUTime/delta.diff.deltaT)}%.`;
which divides a microsecond value by a millisecond value, then reports that as a percentage. That's off by a factor of ten.
Testing with
window.setInterval(function () {
var now = Date.now();
while (Date.now() - now < 250.0);
}, 1000.0);
(which busy-waits for 250 ms once a second, and should thus consume 25% of the CPU) reports
CPU usage: 247%.
So it appears we never correct for this factor.
Oops, I didn't notice this bug report. Thanks for the patch.
That's weird. I'm quite willing to believe that the code divides microseconds by milliseconds, but shouldn't it be off by a factor of 1000, rather than 10?
Flags: needinfo?(pipcet)
No (In reply to David Rajchenbach-Teller [:Yoric] (please use "needinfo") from comment #2)
> That's weird. I'm quite willing to believe that the code divides
> microseconds by milliseconds, but shouldn't it be off by a factor of 1000,
> rather than 10?
We want the result to be 100 if the two time intervals are the same, because 100% is easier to read than 1.00, I think. So divide microseconds by microseconds and multiply by 100 to get a percentage, or divide microseconds by milliseconds, then divide by 1000, then multiply by 100. The last two steps can be combined into a division by 10.
For a single process using all of one CPU, the micro-by-milli division will yield 1000, but we want 100 (percent), thus the factor of 10.
(Another question is whether we want to divide by the number of CPU cores. I think with worker threads we can see numbers up to 400% on a quad-core system, which might confuse users; however, by far the most common case is to have a single main thread do all the work, and displaying 25% for a single blocked thread is more confusing than displaying 400% for an all-CPU-cores workload, so the current code makes the most sense to me.)
Flags: needinfo?(pipcet)
Ah, of course. For the moment, we have not activated performance monitoring for workers, so we are not going to see anything > 100%.
By the way, if you want someone to notice a patch, you should mark it for review.
Assignee: nobody → pipcet
Comment on attachment 8714039 [details] [diff] [review]
0001-Bug-1244491-about-performance-percentages-off-by-a-f.patch
Review of attachment 8714039 [details] [diff] [review]:
-----------------------------------------------------------------
Patch looks good to me. Just one change before I can accept it.
Can you change the first line of the commit message to 1/ Remove the word [Patch]; 2/ Add ", r=Yoric" at the end, to mark that I was the reviewer?
Attachment #8714039 -
Flags: review+
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Fix commit message, add reviewer.
Attachment #8714039 -
Attachment is obsolete: true
Flags: needinfo?(dteller)
Comment on attachment 8730664 [details] [diff] [review]
0001-Bug-1244491-about-performance-percentages-off-by-a-f.patch
Review of attachment 8730664 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me. Let's see how it behaves in tests.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=75a8a2a4b50d
Attachment #8730664 -
Flags: review+
And... let's land it!
Keywords: checkin-needed
Comment 10•9 years ago
|
||
Keywords: checkin-needed
Comment 11•9 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in
before you can comment on or make changes to this bug.
Description
•