Fix mean/stddev computations in rapl

RESOLVED FIXED in Firefox 43

Status

()

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: njn, Assigned: njn)

Tracking

Trunk
mozilla43
Points:
---

Firefox Tracking Flags

(firefox43 fixed)

Details

(Whiteboard: [Power])

Attachments

(2 attachments)

Assignee

Description

4 years ago
Here's some rapl output.

>     total W = _pkg_ (cores + _gpu_ + other) + _ram_ W
> #01 12.94 W =  8.64 ( 3.99 +  0.11 +  4.54) +  4.30 W
> 
> 1 sample taken over a period of 1.000 second
> 
> Distribution of 'total' values:
>             mean = 12.00 W
>          std dev =  0.94 W
>   0th percentile = 12.94 W (min)
>   5th percentile = 12.94 W
>  25th percentile = 12.94 W
>  50th percentile = 12.94 W
>  75th percentile = 12.94 W
>  95th percentile = 12.94 W
> 100th percentile = 12.94 W (max)

Whoa, those "mean" and "std dev" values are wrong, and look a lot like some
integer arithmetic is happening instead of floating point arithmetic.
Assignee

Comment 1

4 years ago
This one surprised me. Despite gTotals_W being a vector<double>, I guess
somehow the integer accumulator value forces all the computations to be
integral. Weird.

Sample output with the patch applied:

>     total W = _pkg_ (cores + _gpu_ + other) + _ram_ W
> #01  5.47 W =  2.04 ( 0.22 +  0.09 +  1.72) +  3.43 W
> 
> 1 sample taken over a period of 1.000 second
> 
> Distribution of 'total' values:
>             mean =  5.47 W
>          std dev =  0.00 W
>   0th percentile =  5.47 W (min)
>   5th percentile =  5.47 W
>  25th percentile =  5.47 W
>  50th percentile =  5.47 W
>  75th percentile =  5.47 W
>  95th percentile =  5.47 W
> 100th percentile =  5.47 W (max)
Attachment #8657004 - Flags: review?(erahm)
Comment on attachment 8657004 [details] [diff] [review]
(part 1) - Don't use integer arithmetic when summing totals in rapl

Review of attachment 8657004 [details] [diff] [review]:
-----------------------------------------------------------------

r=me
Attachment #8657004 - Flags: review?(erahm) → review+
Comment on attachment 8657012 [details] [diff] [review]
(part 2) - Don't print distribution stats if there was only 1 sample

Review of attachment 8657012 [details] [diff] [review]:
-----------------------------------------------------------------

r=me
Attachment #8657012 - Flags: review?(erahm) → review+
https://hg.mozilla.org/mozilla-central/rev/37c9cc67c1e9
https://hg.mozilla.org/mozilla-central/rev/b77b0bda0503
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.