High CPU Usage on Video Playback and XRE_StartupTimelineRecord




4 years ago
3 years ago


(Reporter: nspammail, Unassigned, NeedInfo)


39 Branch

Firefox Tracking Flags

(Not tracked)



(2 attachments)



4 years ago
Created attachment 8635676 [details]
Sample of Firefox (tabbed, discrete).txt

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:39.0) Gecko/20100101 Firefox/39.0
Build ID: 20150630154324

Steps to reproduce:

1) Watch HTML 5 video on Youtube.

Actual results:

1) CPU usage holds steady at approximately 45% despite backgrounding the tab. (Reduction from about 60%) Note that using integrated graphics rather than discrete reduces the CPU load by approximately 5-10%. 
Tabbed Skype video chat uses 36% with discrete and integrated graphics for comparison. 

2) The majority of time (99.943%) (based on OS X's sample utility) is spent in XRE_StartupTimelineRecord. Based on this there may be a relation with bug 666219 or 66500. Results from OS X's sample 

Expected results:

1) Larger reduction in CPU usage.
2) Less time spent in timer.

Comment 1

4 years ago
Re-running the same test in safe mode yielded the following results:

CPU usage sat at about 132% using integrated graphics when watching the video in-tab. Upon tabbing out of the Youtube tab, CPU usage sat at around 40% as before. As before, TimelineRecord seemed to be absorbing most of the cycles.

Comment 2

4 years ago
Created attachment 8635677 [details]
Sample of Firefox (tabbed, safemode).txt
The samples from Activity monitor are not useful for the release builds: the symbolic names are misleading.

1) test in a new profile: https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles
2) If you can still reproduce, test with the latest development version (still using the test profile): http://nightly.mozilla.org/
3) The nightly version should produce useful samples in the Activity monitor.

Please also:
A) add a link to the specific video you're testing,
B) paste the contents of the right-click "stats for nerds" menu on the video (indicating what format of the video you get from youtube)
C) compare with another browser (comparing with Skype is like apples to oranges), noting if it gets the same video stream (via stats for nerds).
D) note the specific hardware you're running on
Component: Untriaged → Audio/Video
Flags: needinfo?(nspammail)
Product: Firefox → Core
A bit off-topic, but if you're interested in interpreting the 'sample process' output: XRE_StartupTimelineRecord (the actual name will be different once you run the build with symbols) is not actually "using" the CPU. What you see is the observed call stacks (which function called what function) with a number indicating how many times was this stack observed. So this:
> 2220 Thread_1044408
> ...
> + !         2215 XRE_StartupTimelineRecord  (in XUL) + 1844  [0x10379a0b4]
> ...
> + !             :   |     +   ! :     2132 mach_msg_trap  (in libsystem_kernel.dylib) + 10 
... should be interpreted as "out of 2220 times the profiler looked at the process, 2215 times the call stack contained the [0x10379a0b4] frame, and 2132 times out of those the thread was actually waiting for input (in mach_msg_trap)".

You want to look at the things actually using CPU (below in a different thread) -- leaf items that do not indicate sleeping (you can look them up in Google).
Video still gets decoded when playing in a background tab.
Component: Audio/Video → Audio/Video: Playback
Priority: -- → P2
We want to fix this, but it's difficult.
Mass change P2 -> P3
Priority: P2 → P3
You need to log in before you can comment on or make changes to this bug.