

What Does the OS X Activity Monitor’s “Energy Impact” Actually Measure? - nnethercote
https://blog.mozilla.org/nnethercote/2015/08/26/what-does-the-os-x-activity-monitors-energy-impact-actually-measure/

======
icefox
I'm surprised that the author hasn't mentioned the positive effect it has had.
After upgrading the OS and seeing the new menu entries I reported a number of
applications that would show up as using a lot of energy and within a few
releases there was a change note usually mentioning some simple fix which
dramatically reduces the wake up's of the application or removing a long
running animation that didn't add any value. This little menu addition has
probably helped the battery life for macbook users more than any other change.

~~~
wmf
I suspect that's the real reason why Apple is weighting wakeups heavily and
exaggerating the energy impact: it shames developers into making their apps
more efficient.

~~~
anologwintermut
Except Chrome, which on every laptop I've ever used seems to decrease battery
life by about a 1/3rd compared to Safari and is always marked as using
significant power. (Currently 10.9.5 with chrome 44 on a 2014 macbook air, but
I've had the issue on newer computers at work)

~~~
bentruyman
This can be seen exceptionally when watching videos where some implementations
prefer Flash. I often fall asleep to documentaries (maybe not a typical use
case) and I've seen massive gains in battery life using Safari (using HTML5
video) vs. Chrome (using Flash). Granted, this isn't a fair comparison as one
is using a "native" implementation and one is using Flash. But I've seen
something like 250% gain in battery life – which sometimes means the
difference between seeing the ending and not.

It's interesting watching one's projected battery life climb from 40m to 1h
40m simply by swapping one application for another. However, it's unfortunate
some websites prefer Flash-based implementations over their native
counterparts. Although this trend seems to be shifting in favor of those that
are native. And I assume the smart folks at Google are taking note. YouTube,
for example, has done a particularly spectacular job at adding AirPlay
functionality to their HTML5 player.

(Disclaimer: I work for Apple)

~~~
suddenlyme
There is currently no good browser for apple. Safari (8.0.8) struggles with
HTML5. Firefox (40.0.2) struggles with video/media of any sort and bogs down
with multiple tabs. Chrome (44.0.2403.157 (64-bit)) drains your battery. I'm
on a MacBook Pro (10.10.5, 13-inch, Early 2015). They are all uniformly
disappointing.

~~~
coldtea
> _Safari (8.0.8) struggles with HTML5._

What?

~~~
suddenlyme
Struggles may have been the wrong verb. I meant this:

[https://html5test.com/compare/browser/chrome-44/safari-8.0.h...](https://html5test.com/compare/browser/chrome-44/safari-8.0.html)

Straightforward things like pattern matching on form inputs

[http://caniuse.com/#feat=input-color](http://caniuse.com/#feat=input-color)

[http://caniuse.com/#feat=download](http://caniuse.com/#feat=download)

~~~
coldtea
> _pattern matching on form inputs_

That's hardly "struggles", it's just a not very prominent feature that wasn't
implemented, or not done properly.

------
qiushihe
The first sentence of the article:

> Activity Monitor is a tool that was introduced in Mac OS X 10.9.

Activity Monitor was introduced with OS X 10.3
([https://en.wikipedia.org/wiki/Activity_Monitor](https://en.wikipedia.org/wiki/Activity_Monitor)).
And was significantly revamped with OS X 10.9 to receive the various energy
related measurements.

~~~
nnethercote
I'm the author of the post. You're right. I corrected the first paragraph.

Thank you for the suggestion.

------
cbsmith
Wakeups are a bit tricky to actively measure, because with the Power Nap
feature, the actual # of wakeups triggered by a particular application is a
bit trickier to measure and _varies based on what other activities are going
on the system_.

In general, from the get go, it is a bit of a myth that you can really know
how much of a power budget is a consequence of a particular application. You
can get a rough sense of relative impact on the overall power budget, but even
that can be seriously skewed by a LOT of factors. At best, you can get a sense
of, "if I sampled at the moment power stores hit a multiple of X, how often
would I see the system doing something on behalf of each app that was draining
power at that moment". Even that, is bloody hard to pull off, but it is your
best "rough" approximation of what is going on.

------
ejdyksen
I could have sworn I read somewhere that Activity Monitor also included GPU
usage in its measurements—naturally, using the GPU more uses more
power/battery.

~~~
comex
It does. I found a list of factors and posted it as a comment on the blog
post:

[https://blog.mozilla.org/nnethercote/2015/08/26/what-does-
th...](https://blog.mozilla.org/nnethercote/2015/08/26/what-does-the-os-x-
activity-monitors-energy-impact-actually-measure/comment-
page-1/#comment-46775)

In the data I posted, which is from /usr/share/pmenergy/default.plist,
kgpu_time is 0.0, but in all the other plists it's nonzero.

~~~
ejdyksen
Oh wow, nice find. It looks like that calculation is pretty comprehensive,
then.

------
grecy
> _Recent Intel hardware provides high-quality estimates of processor and
> memory power consumption ... But the big problem is that they are machine-
> wide measures that cannot be used on a per-process basis._

Would it not be possible for the OS to poll the CPU for these power
consumption stats, and attribute the value returned to the currently running
process?

Over time, I think it would be possible to see how much power the Intel CPU
thinks each process is using.

~~~
nnethercote
If you poll with high frequency you'll be causing lots of additional wake-ups
which will badly skew what you're measuring.

~~~
pjc50
Ideally you'd do an accounting update on task switch, along with all the other
housekeeping. Then you don't need to do any polling. There's a "process
accounting" infrastructure which perhaps could be adapted for this.

------
rainforest
Work in bootstrapping energy consumption exists in academia; for example
Pathak et al[0]. The changes in 10.10.4 could be an implementation of
something along the same lines, by fitting a model to the measured power
consumption.

As comex notes in the comments on the article, there appears to be a table of
weights for various features, presumably obtained by regression.

[0]: [http://research.microsoft.com/en-
us/people/mzh/eurosys-2012....](http://research.microsoft.com/en-
us/people/mzh/eurosys-2012.pdf)

------
travjones
Take home point: "In fact, POWER* is a unitless measure because it is a semi-
arbitrary combination of two measures with incompatible units."

*POWER = "Energy Impact."

~~~
kevinchen
Since the formula is

Power = ((used_us + IDLEW * 500) * 100.0) / elapsed_us

If you believe that each idle wake costs you on average the same energy as
500us of computation, then the units are compatible right?

------
digitalengineer
Is there anything like this for iOS? I'd love to know the consumption of
energy (and data) for all my iOS apps!

~~~
shalmanese
Power: Settings->General->Usage->Battery Usage

Data: Settings->Cellular, scroll to the bottom

------
AnthonBerg
Surely we can also measure actual heat and actual electricity usage? If not
per program obviously, then as a reference or benchmark or calibration.

~~~
AnthonBerg
Downvote?

Let me rephrase: There are temperature and battery charge sensors in the
machines. We can use these to better calibrate the "virtual" energy usage
metrics.

~~~
DasIch
These only help you determine the state of the entire system. They provide no
information about the impact individual applications or processes have
especially not relative to each other.

