Open Bug 1195790 Opened 9 years ago Updated 1 year ago

[meta] YouTube uses a lot more power in FF than Safari on OS X

Categories

(Core :: Audio/Video: Playback, defect, P3)

defect

Tracking

()

Tracking Status
platform-rel --- -

People

(Reporter: jrmuizel, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: meta, power, Whiteboard: [Power:P1] [platform-rel-Youtube])

Attachments

(1 file)

This is a tracking/metabug

From just looking at Activity Monitor we spend more time in the WindowServer and more time in FF. It would be nice to do better.
Depends on: 1195767
Jeff - is this a graphics issue or a media playback issue?
Probably a combination of a different things. I chose the component arbitrarily.
Component: Audio/Video → Audio/Video: Playback
Keywords: meta, power
Priority: -- → P2
I did some measurements during a 30 second window while watching https://www.youtube.com/watch?v=1Y1ya-yF35g using tools/power/rapl and powermetrics.

Nightly:

>     total W = _pkg_ (cores + _gpu_ + other) + _ram_ W
> #01 12.56 W =  9.79 ( 1.59 +  1.22 +  6.98) +  2.77 W
> 
> Name                          ID     CPU ms/s  User%  Deadlines (<2 ms, 2-5 ms)  Wakeups (Intr, Pkg idle)
> firefox                       84433  154.49    65.00  13.96   2.90               90.82   44.26             
> plugin-container              84435  407.53    42.52  47.82   28.66              196.23  94.75             

Safari:

>     total W = _pkg_ (cores + _gpu_ + other) + _ram_ W
> #01  7.53 W =  5.60 ( 0.44 +  0.24 +  4.92) +  1.92 W
> 
> Name                          ID     CPU ms/s  User%  Deadlines (<2 ms, 2-5 ms)  Wakeups (Intr, Pkg idle)
> com.apple.WebKit.WebContent   84463  67.84     82.77  0.00    0.00               162.86  130.37            
> com.apple.WebKit.Networking   84462  46.93     47.22  0.03    0.00               0.50    0.40              
> Safari                        84460  0.38      43.24  0.00    0.00               0.27    0.20              
> com.apple.Safari.SearchHelper 84466  0.13      52.02  0.00    0.00               0.07    0.03              

Chrome:

>     total W = _pkg_ (cores + _gpu_ + other) + _ram_ W
> #01 11.94 W =  9.38 ( 1.36 +  1.63 +  6.38) +  2.56 W
> 
> Name                          ID     CPU ms/s  User%  Deadlines (<2 ms, 2-5 ms)  Wakeups (Intr, Pkg idle)
> Google Chrome Helper          84483  379.27    89.58  0.00    0.00               128.37  86.68             
> Google Chrome Helper          84481  79.01     66.29  0.33    0.00               110.34  74.59             
> Google Chrome                 84476  95.33     70.31  1.20    0.47               75.89   52.22             

Interesting that Safari is much better for all power estimates: cores, GPU, other and RAM.
Safari would also typically have a VT service process running which is where the h264 decoding would be happening. Though it should also have been used with Firefox (chrome uses ffmpeg instead)
Attached file powermetrics output
(In reply to [PTO Until 08/Sep] Jean-Yves Avenard [:jya] from comment #4)
> Safari would also typically have a VT service process running which is where
> the h264 decoding would be happening. Though it should also have been used
> with Firefox (chrome uses ffmpeg instead)

If I run this command:

> sudo powermetrics --samplers tasks --show-process-coalitions --show-process-gpu -n 1 -i 5000

then processes get grouped into "coalitions", like this:

> Name                               ID     CPU ms/s  User%  Deadlines (<2 ms, 2-5 ms)  Wakeups (Intr, Pkg idle)  GPU ms/s
> com.apple.Safari                   488    44.27                                       95.57   56.06             15.74
>   com.apple.WebKit.WebContent      84679  43.77     86.64  0.00    0.00               94.59   55.88             15.17
>   com.apple.WebKit.Networking      84678  0.41      64.68  0.00    0.00               0.20    0.20              0.00
>   Safari                           84676  0.35      29.93  0.00    0.00               0.40    0.00              0.00

In the full output (attached) I don't see any process with a name like "VT service".
Whiteboard: [Power]
What is the difference in the system power consumption measured at the wall? Does disabling e10s make a difference to Firefox?
(In reply to Anthony Jones (:kentuckyfriedtakahe, :k17e) from comment #6)
> What is the difference in the system power consumption measured at the wall?

I don't know. These measurements are just processor (include integrated GPU) and memory. Other hardware, esp. the screen, will use more power.

> Does disabling e10s make a difference to Firefox?

It causes a slight improvement. More numbers shortly...
Bug 1195767 appears to have helped a bit here. I did a 30 second sample with
tools/power/rapl and powermetrics on the video at
https://www.youtube.com/watch?v=P8pjd1QEA0c:

Before bug 1195767:

>     total W = _pkg_ (cores + _gpu_ + other) + _ram_ W
> #01 12.99 W = 10.19 ( 1.64 +  1.28 +  7.27) +  2.80 W
> 
> 1 sample taken over a period of 30.000 seconds
> 
> Name                               ID     CPU ms/s  User%  Deadlines (<2 ms, 2-5 ms)  Wakeups (Intr, Pkg idle)  GPU ms/s
> com.apple.Terminal                 293    566.98                                      290.32  138.78            236.26
>   firefox                          24984  177.74    60.63  12.70   2.50               88.07   42.78             205.36
>   plugin-container                 24985  401.25    43.83  50.81   30.32              201.76  95.73             30.83
>   Terminal                         694    5.75      90.85  0.00    0.00               0.40    0.23              0.00
>   com.apple.WebKit.WebContent      86444  0.17      62.04  0.00    0.00               0.00    0.00              0.00

After bug 1195767:

>     total W = _pkg_ (cores + _gpu_ + other) + _ram_ W
> #01 12.34 W =  9.53 ( 1.23 +  1.27 +  7.03) +  2.82 W
> 
> 1 sample taken over a period of 30.000 seconds
> 
> Name                               ID     CPU ms/s  User%  Deadlines (<2 ms, 2-5 ms)  Wakeups (Intr, Pkg idle)  GPU ms/s
> com.apple.Terminal                 293    390.97                                      283.30  142.93            237.81
>   firefox                          27178  174.26    61.63  14.19   1.90               89.46   46.31             205.20
>   plugin-container                 27179  215.00    68.13  51.78   25.06              193.42  96.43             32.62
>   Terminal                         694    5.93      88.76  0.00    0.00               0.37    0.17              0.00
>   com.apple.WebKit.WebContent      86444  0.12      62.42  0.00    0.00               0.00    0.00              0.00

The reduced CPU usage in the content process almost halved, which translated to a 0.65 Watt reduction.

I also tried disabling e10s. After bug 1195767, e10s disabled:

>     total W = _pkg_ (cores + _gpu_ + other) + _ram_ W
> #01 11.90 W =  9.09 ( 0.98 +  1.26 +  6.84) +  2.82 W
> 
> 1 sample taken over a period of 30.000 seconds
> 
> Name                               ID     CPU ms/s  User%  Deadlines (<2 ms, 2-5 ms)  Wakeups (Intr, Pkg idle)  GPU ms/s
> com.apple.Terminal                 293    351.94                                      260.63  142.28            241.54  
>   firefox                          27248  350.58    71.77  52.65   27.29              260.14  142.05            241.54  
>   Terminal                         694    5.09      91.65  0.00    0.00               0.40    0.17              0.00    
>   com.apple.WebKit.WebContent      86444  0.13      62.06  0.00    0.00               0.03    0.03              0.00

A little better.

(BTW, see
https://developer.mozilla.org/en-US/docs/Mozilla/Performance/tools_power_rapl
and https://developer.mozilla.org/en-US/docs/Mozilla/Performance/powermetrics
to understand exactly the measurements shown here.)
(In reply to Nicholas Nethercote [:njn] from comment #7)
> (In reply to Anthony Jones (:kentuckyfriedtakahe, :k17e) from comment #6)
> > What is the difference in the system power consumption measured at the wall?
> 
> I don't know. These measurements are just processor (include integrated GPU)
> and memory. Other hardware, esp. the screen, will use more power.

The system total isn't the right thing to optimise. However measuring it gives you two pieces of information:

1. An estimate in the impact of the difference in CPU usage. i.e. a comparison of watch hours
2. A cross check to make sure we're not missing some part of the total

> > Does disabling e10s make a difference to Firefox?
> 
> It causes a slight improvement. More numbers shortly...

Both numbers are informative. We want to consider how we compare to Safari without e10s and how we compare to Chrome with e10s.
> The system total isn't the right thing to optimise. However measuring it
> gives you two pieces of information:
> 
> 1. An estimate in the impact of the difference in CPU usage. i.e. a
> comparison of watch hours
> 2. A cross check to make sure we're not missing some part of the total

Sure. The other factor is ease of measurement. I wrote about this in some detail at https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Power_profiling_overview#Power_and_power-related_measurements
Whiteboard: [Power] → [Power:P1]
For completeness, I've been looking at playback perf for VP9 on OS X.

I've measured using Intel Power Gadget to graph power usage and CPU/GPU frequency.  I'm new to power profiling, so there maybe flaws in my methodology, but I'll summarize what I think I discovered.

Instead of making tables of values, I took screenshots: http://people.mozilla.org/~dglastonbury/Power/

The quadrants are:
TL: Firefox playback
TR: Chrome playback
BL: Firefox playback with blank decoder module
BR: Firefox playback with VP9 decoding but skip inserting frame into ImageContainer (So the frame is never composited)

Looking at 1080p 60fps shows that while the CPU power usage is higher by ~5W (I suspect from the higher avg. CPU frequency), system power usage is almost double. Comparing "blank decoder" to "no compositing of video", demonstrates that the current path for getting frames into the compositor is inefficient.
Flags: needinfo?(milan)
Depends on: 1233585
Depends on: 1231564
Blocks: 971269
platform-rel: --- → ?
Whiteboard: [Power:P1] → [Power:P1] [platform-rel-Youtube]
Mass change P2 -> P3
Priority: P2 → P3
platform-rel: ? → -
Flags: needinfo?(milan)
Summary: YouTube uses a lot more power in FF than Safari on OS X → [meta] YouTube uses a lot more power in FF than Safari on OS X
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: