-
Notifications
You must be signed in to change notification settings - Fork 4
Battery drain and network usage on Android
The goal of the evaluation was to determine the drain of battery and the data usage of PTP on Android.
- Two devices: Android smartphone (Nexus 5X) and a server running Linux
- Android smartphone: runs Tor 0.2.8.9, Doze disabled for PTP (Settings -> Battery -> Battery Optimization -> PTPEvaluationApp -> Not optimized), screen was off during evaluation, started with fully charged battery
- Server: runs Tor 0.2.8.11
- The devices send messages to each other. Meanwhile the battery consumption and mobile data gets recorded.
- The default message size is 64 bytes.
- PTP settings: IsAliveTimeout 30s, IsAliveSendTimeout 20s
Both devices send a message every interval seconds (default is 1 hour). The Android device sends it's first message immediately, the server sends it's first message half of the interval later.
- Connection times out after some time. For each message a new connection had to be opened. (overhead of Tor + authentication data)
- PTP on the server closes the connection, because it doesn't receive an IsAliveMessage when Android is in doze mode. (adjusted IsAlive settings)
- Authentication messages expire, because Android forwards them too late to the app. (Increase validity time of auth messages)
- Connect the device to the computer
- Execute
./run.sh start(Logs and battery history are cleared) - Disconnect device when requested ("Disconnect device to start!")
- Evaluation is running now!
- Execute
./run.sh stop resultdirwhen you are finished - Connect the device when requested ("Connect device")
- Logs (from Android and server) and bugreport get saved
- Done
- Use battery-historian to analyze the bugreport.zip file
- Exec
./messageStat.sh resultdirto analyze how many messages were sent/received
| date | runtime | network | ptp | bytes sent | bytes received | bytes total | battery | Device estimated power use | messages sent (Server) | messages received (Android) | messages sent (Android) | messages received (Server) | user data | ratio |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13.12.16 | 6h11m12.576s | wifi | on | 2.17 MB | 4.23 MB | 6.39 MB | 2 pct drop @ 0.32 %/hr | 0.13 % | 6 | 6/6 | 6 | 6/6 | 768 bytes | 0.0115% |
| 14.12.16 | 3h55m25.843s | 4g | on | 1.89 MB | 2.74 MB | 4.64 MB | 1 pct drop @ 0.25 %/hr | 3.62 % | 4 | 4/4 | 4 | 4/4 | 512 bytes | 0.0152 % |
| 15.12.16 | 9h31m3.922s | 4g | on | 4.88 MB | 7.82 MB | 12.71 MB | 10 pct drop @ 1.05 %/hr | 8.59% | 10 | 9/10 | 10 | 10/10 | 1280 bytes | 0.0096 % |
| 16.12.16 | 9h14m54.352s | 4g | off | - | - | - | 2 pct drop @ 0.22 %/hr | - | - | - | - | - | - | - |
| 19.12.16 | 9h8m14.784s | 4g | on | 4.01 MB | 6.85 MB | 10.85 MB | 8 pct drop @ 0.88 %/hr | 8.00% | 9 | 8/9 | 10 | 10/10 | 1216 bytes | 0.0106 % |
| 21.12.16* | 3h12m45.259s | 4g | on | 1.35 MB | 2.38 MB | 3.73 MB | 1 pct drop @ 0.31 %/hr | 3.85 % | 10 | 10/10 | 10 | 10/10 | 1280 bytes | 0.0327 % |
| 21.12.16* | 9h7m39.74s | 4g | on | 4.29 MB | 6.37 MB | 10.66 MB | 6 pct drop @ 0.66 %/hr | 12 % | 27 | 26/27 | 28 | 28/28 | 3520 bytes | 0.0315 % |
| 15.02.17** | 3h26m56s | wifi | on | 1,33 MB | 2,49 MB | 3,82 MB | 1 pct drop @ 0.29 %/hr | 0.17% | 210 | 210/210 | 210 | 201/210 | 26880 bytes | 0.6711 % |
ratio = (user data / bytes total) * 100
user data = (messages sent (Server) + messages sent (Android)) * 64 bytes
* different settings: Android (IsAliveTimeout: 3min, IsAliveSendTimeout: 0s), both (interval: 20 min)
** different settings: Android (IsAliveSendTimeout: 0s), both (IsAliveTimeout: 1min, interval: 20 min, increased validity of authentication messages to 3min ), different traffic model (sending bursts of 10 ping messages, each ping messages is answered by a pong message)
Battery usage doesn't seem to be a problem. The total data consumed by PTP is too big (about 1MB/h). When PTP only sends a little amount of messages, the ratio of user data to total data is about 0.01 - 0.015%. The ratio gets better, when PTP sends more messages. The overhead for each message doesn't seem to be big, but the general traffic of Tor seems to be high. Another evaluation has been done to identify how much traffic Tor uses when PTP doesn't send any message.