Page MenuHomePhabricator

Collect battery level
Closed, ResolvedPublic

Description

Using the Battery Status API. Combined with the CPU benchmark, that would allow us to see the impact of battery saving modes on different phones, as a follow-up to the Akamai study: https://arxiv.org/pdf/2003.06477.pdf

navigator.getBattery().then(function(battery) { console.log( battery.level ); });

This works on desktop as well, interestingly.

Event Timeline

Gilles created this task.Jun 18 2020, 2:16 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 18 2020, 2:16 PM
Gilles triaged this task as Medium priority.Jun 18 2020, 2:17 PM

Change 606452 had a related patch set uploaded (by Gilles; owner: Gilles):
[mediawiki/extensions/NavigationTiming@master] Store battery level alongside CPU benchmark

https://gerrit.wikimedia.org/r/606452

Peter added a subscriber: Peter.Jun 22 2020, 7:39 AM
Gilles moved this task from Inbox to Doing on the Performance-Team board.Jun 22 2020, 7:57 PM

Change 606452 merged by jenkins-bot:
[mediawiki/extensions/NavigationTiming@master] Store battery level alongside CPU benchmark

https://gerrit.wikimedia.org/r/606452

Gilles closed this task as Resolved.Aug 3 2020, 1:06 PM

The data is being collected correctly. Here are some quick initial findings, looking at the July data.

Median battery levels by OS:

Android59%
KaiOS60%
Chrome OS81%
Mac OS X98%
Windows100%
Ubuntu100%
Linux100%
iOS100%
Windows Phone100%

The iOS and Windows phone figures are bizarre. Possibly the API is censored/broken and always reports 100% there?

Then let's look at the breakdown per country (top 10 and bottom 10). Source of GDP data: https://en.wikipedia.org/wiki/List_of_countries_by_GDP_(nominal)_per_capita

For the following table we're only looking at Chrome Mobile on Android.

CountryMedian battery levelMedian CPU benchmark score GDP per capita
Japan72%203$38220
Taiwan70%217$24827
Hong Kong69%193$46390
Macao68%188$80893
Myanmar67%266$1257
Suriname66%378$6757
Bhutan66%289$3173
South Korea66%180$30025
Puerto Rico65%278$28451
United States64%198$60055
............
Papua New Guinea52.5%392$2667
Kazakhstan52%275$8756
Uzbekistan52%270$1557
Niger51.5%496$378
Somalia51%329n/a, likely lowest in the world
Namibia51%372$5227
Mongolia50.5%263$3620
Kyrgyzstan50%269$1251
Botswana50%539$7596
Malawi50%330$340

While it's clear that lower median battery countries have a tendency to have a very low GDP per capita, there are some anomalies in the top 10 for which it's also the case: Myanmar, Suriname and Bhutan.

Myanmar and Bhutan having good CPU benchmark scores as well suggests that we might have a high prevalence of tourists among Wikipedia visitors, equipped with more powerful devices sporting better battery life than devices locals use and as tourists might have better access to electricity.

Suriname is more of a mystery, since it has CPU benchmark scores suggesting slower devices, in line with the developing countries found in the bottom 10. Some local knowledge would probably be necessary to understand that outlier.

Finally, let's look at the effect of low battery level on CPU benchmark scores (still restricted to Chrome Mobile on Android):

Battery level (b)Median CPU benchmark score Sample size Portion of pageviews
b < 10%3242109922.62%
10% <= b < 20%2825061956.28%
20% <= b < 30%2726883098.53%
30% <= b < 40%26882845510.27%
40% <= b < 50%26895035311.78%
50% <= b < 60%26997498312.09%
60% <= b < 70%26895857811.88%
70% <= b < 80%26799863712.38%
80% <= b < 90%26694611211.73%
90% <= b < 100%26480912710.03%
100%2621948282.42%

Battery level seems to only affect processing power below 20% and only significantly below 10%. That 0-10% battery level is only experienced for 2.62% of page views. Some of that could be due to the fact that users actively avoid having their mobile device go to such extreme lows, where they know it becomes sluggish. Some of it could also be that when their battery goes below 10% they avoid browsing Wikipedia as an activity (maybe focusing on more "vital" activities).