Closed Bug 947617 Opened 12 years ago Closed 12 years ago

Clock app consuming too much power

Categories

(Firefox OS Graveyard :: Gaia::Clock, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED FIXED
1.4 S2 (28feb)

People

(Reporter: huseby, Assigned: jhylands)

Details

(Keywords: perf, power, Whiteboard: [c=power p=2 s= u=])

Attachments

(9 files)

Using a yoctopuce ammeter and mozilla battery harnesses for the nexus s and hamachi devices, I measured the launch and idle power consumption of the clock app. It appears that there is ample opportunity to optimize the app for lower power consumption. For the launch test, I started the ammeter, touched the clock icon to launch it and then stopped the ammeter after 10 seconds. I then killed the clock app and repeated the test. For the idle test, I started the clock app, let it run for 5 seconds, then ran the ammeter for 30 seconds. I then killed the clock app and repeated. I did this on a Nexus S running FxOS 1.3, a Nexus S running Android 2.3.4, and a Hamachi running FxOS 1.3. The raw data is attached to this bug. Here are the mean values for each test: App Launch: FxOS Nexus S: 228 mA Android Nexus S: 198 mA FxOS Hamachi: 143 mA App Idle: FxOS Nexus S: 175 mA Android Nexus S: 147 mA FxOS Hamachi: 128 mA This might be a little hardware dependent in that the Nexus S's clock hardware just consumes more data. But if you compare the FxOS and Android numbers on the Nexus S, we should at least be 5%. For the app launch, we're 15% more, and for the idle, we're 19% more.
Attached image fxos_clock_app_30s.png
screen shot of FxOS nexus s 30 second data run.
screen shot of android nexus s 30 seconds data run.
screen shot of fxos hamachi 30 second data run.
the raw data measured during the FxOS Nexus S tests.
raw data measured during the Android Nexus S tests.
raw data measured during FxOS Hamachi tests
Although we don't have the ammeter data integrated into the profiler UI yet, it is possible to do manual correlation of the data. As expected, there is a fairly big jump in both CPU and power usage for ~50ms every second, but there is another jump in both about 300-400 ms before each second count, and the same code is being called from an actual Timer tick (nsDisplayList::PaitRoot takes most of the time in each case). Since the actual clock GUI is only updating once per second, we should be able to almost cut the extra power usage in half by eliminating this second refresh. Turning on the "Flash repainted area" option, its pretty clear that the clock face is updating twice a second, even though it is only changing once. Perhaps it is redrawing the entire clock face without the second hand, and then redrawing again with the second hand in the new spot.
Assignee: nobody → jhylands
Status: NEW → ASSIGNED
Attached image Before Fix
This shows the ammeter readings, before the fix.
Attached image After Fix
This shows the ammeter readings, after the fix was applied.
Attached file Pull Request for fix
See before & after pic attachments for power impact
Attachment #8378442 - Flags: review?(m)
Whiteboard: [c=power p=1 s= u=] → [c=power p=2 s= u=]
Comment on attachment 8378442 [details] Pull Request for fix Thanks! This looks good, but could you explain what the translateZ(1px) does, and why it addresses the problem? In the past I've seen translateZ(0) used to trick browsers into GPU rendering; is that what's going on here or is this something different? Ideally it'd be good to have a comment in the CSS to explain why, otherwise r+ from me.
Attachment #8378442 - Flags: review?(m) → review+
Yes, this invokes the GPU, and thus cuts way down on both CPU and power usage. The GPU is apparently much smarter about drawing stuff multiple times (which was happening before), so it ends up doing much less work.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Reverted due to an unexpected unit test failure; landing again momentarily after Travis passes.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.4 S2 (28feb)
Keywords: perf
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: