unity8+Mir draws more current and wakes up 100 times more often than unity8 with surfaceflinger

Bug #1236508 reported by Colin Ian King
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Expired
High
Unassigned
The Ubuntu Power Consumption Project
Expired
Undecided
Unassigned
unity-mir
Incomplete
Medium
Unassigned
unity8 (Ubuntu)
Expired
Medium
Unassigned

Bug Description

I've looked at the CPU, wakeup event and current drawn on a LG Nexus 4 comparing the Mir enabled and non-Mir versions of Unity8 with today's image + updates (at 18:00 UTC, 7th Oct 2013).

I ran a 5 minute idle soak test with the screen set to be un-blanked at full brightness and measured the current drawn at 0.5 second intervals. The Mir enabled version of Unity is drawing on average ~143.7mA where as the non-Mir version is drawing 138.7mA, or around 5mA less current (~3.6% difference)

Measuring CPU load (just Mir)
Mir:
  0.70% user, 0.63% system, 1.33% total CPU usage
Non-Mir:
  0.17% user, 0.07% system, 0.23% total CPU usage

Context Switches:
Mir:
    219.24 context switches/sec
Non-Mir:
    22.32 context switches/sec

poll/epoll/nanosleeps
Mir:
   4.9664/sec
Non-Mir:
   3.1333/sec

Total CPU of system:
Mir:
   0.87%
Non-Mir:
   0.70%

So it seems that the Mir variant of Unity8 is busier and consumes more power than the non-Mir variety when idle.

affects: ubuntu → unity8 (Ubuntu)
Revision history for this message
Michał Sawicz (saviq) wrote :

You'd need to take surfaceflinger into account when comparing those, as there's no separate display server process now.

Revision history for this message
Colin Ian King (colin-king) wrote :

Even factoring out surface flinger, the overall phone is drawing more current now. I will capture the full system activity and report back.

Revision history for this message
Colin Ian King (colin-king) wrote :

I've re-measured Mir and non-Mir configurations and double checked my data to include surface flinger. For 300 seconds of complete idle I measured:

Context Switches/sec:
Mir:
   Voluntary: 214.88
   Involuntary: 1.85
   Total: 216.73
Non-Mir + Surface Flinger
   Voluntary: 28.56
   Involuntary: 1.45
   Total: 30.01

..so the Mir variant is context switching over 7 times more than the non-Mir variant.

CPU utilisation:
Mir:
   User: 0.15%
   System: 0.08%
   Total: 0.23%
Non-Mir + Surface Flinger
   User: 0.04%
   System: 0.01%
   Total: 0.05%

..so the Mir variant is consuming ~4.6 times more CPU than the non-Mir variant.

Total System Wakeup Events/sec:
Mir:
  Wakeup Events: 23.57
Non-Mir + Surface Flinger
  Wakeup Events: 0.20

..the Mir variant is creating >100 times more wakeup events than the non-Mir variant

Zero-timeout poll/epoll_wait calls/sec
Mir:
  Zero timeout polls: 2.32
Non-Mir + Surface Flinger
  Zero timeout polls: 1.23

..these are where poll() or epoll_wait() are called with a zero timeout, effectively like doing an immediate peek, which is wasteful because one could be doing a non-blocking read. It may indicate a bug somewhere, as normally one expects poll to be called with a blocking timeout > 0. Anyhow, the Mir variant is worse than the non-Mir variant.

Measured using:
  health-check, cpustat, eventstat from PPA:colin-king/white

Hope that contextualises the bug report.

Revision history for this message
Michał Sawicz (saviq) wrote :

Not sure what unity8 itself can do to be better here, as it's almost exactly the same codebase running on both. Have added mir and unity-mir as that's where the investigation needs to go to.

Another component that was replaced by unity-mir (and, in effect, unity8) is ubuntuappmanager, but I doubt that one was eating a lot of power.

Changed in unity8:
status: New → Triaged
Changed in unity-mir:
status: New → Triaged
Changed in unity8 (Ubuntu):
status: New → Confirmed
Changed in unity8:
status: Triaged → Incomplete
Changed in unity-mir:
importance: Undecided → High
Changed in unity8 (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

At this early stage a difference of 3.6% is quite good, I think.

A potential fix is in bug 1227739, but see also comment 10 of that.

Changed in mir:
importance: Undecided → Medium
Changed in unity8:
importance: Undecided → Medium
Changed in unity-mir:
importance: High → Medium
Changed in unity8 (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Although the difference in wakeups is quite bad.

summary: - unity8 (+Mir) draws more current and uses more CPU than non-Mir variant
+ unity8+Mir draws more current and wakes up 100 times more often than
+ unity8 with surfaceflinger
Changed in mir:
importance: Medium → High
Changed in unity-mir:
status: Triaged → Incomplete
Changed in mir:
status: New → Triaged
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Speaking with kgunn the other day he seemed to mention this bug and said the problem was actually a change in the kernel and other packages. Not Mir. Was that the case?

Changed in mir:
status: Triaged → Incomplete
Michał Sawicz (saviq)
no longer affects: unity8
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Do we have any way to retest this any more?

Revision history for this message
Kevin DuBois (kdub) wrote :

Not that I know of, the surfaceflinger/unity8 route isn't supported anymore.

Changed in ubuntu-power-consumption:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Mir because there has been no activity for 60 days.]

Changed in mir:
status: Incomplete → Expired
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for unity8 (Ubuntu) because there has been no activity for 60 days.]

Changed in unity8 (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for The Ubuntu Power Consumption Project because there has been no activity for 60 days.]

Changed in ubuntu-power-consumption:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.