3 ms·
To expand on this a bit, look at location services on a phone. A "fine" location access event is a "high power" event, it takes a lot of battery and should be
by Klathmon 9y ago
To expand on this a bit, look at location services on a phone.
A "fine" location access event is a "high power" event, it takes a lot of battery and should be done as infrequently as possible.
Apps on android have the ability to say "i want to get location at least once every 30 minutes". A naive implementation would give every app that asks for this a timer, and when that timer ticks off, that app gets location information. For 5 apps, that could mean 5 times every 30 minutes!
But android is a bit "smarter", it will do it once in the 30 minute period, then give that same info to all 5 apps.
But then the question is, who caused that battery usage? None of them? All of them? Should adding a 6th app into the mix cause all of the battery usage of the other 5 to go down proportionally? Technically that 6th app is pretty much "free" in terms of actual power usage...
What about if an app says "I want location whenever you get it, but I never want to trigger it on my own", where do you allocate it's usage?
And that's just one API. Now imagine that with wakelocks, radio usage, accelerometer/gyroscope usage, etc...
- kllrnohj 9y agoOr even CPUs & GPUs also power-gate chunks of their internal features. A CPU's power draw at a given voltage & frequency is not fixed. It depends on the actual instructions being executed. Taken to the extreme you end up with things like Intel's AVX512. So how do you calculate the app's CPU power draw? If they are using highly optimized SIMD power draw is going to be much higher than that of a CPU that's constantly stalled out waiting on dependent memory loads (aka, typical Java code)