OSDN Git Service

Connectivity metrics: add WakeupStats events
authorHugo Benichi <hugobenichi@google.com>
Tue, 5 Sep 2017 04:34:48 +0000 (13:34 +0900)
committerHugo Benichi <hugobenichi@google.com>
Thu, 14 Sep 2017 04:29:56 +0000 (13:29 +0900)
commit60c9f63b66926745603978e1bd6372b3a44561d1
treed86e49aebd595a3965696bb42cbaa4a4ef19f0d9
parentf562ac34a51da55e4d15e34f0cd1cb597e7d926c
Connectivity metrics: add WakeupStats events

This patch defines a new WakeupStats event in ipconnectivity.proto and
populates these events from the NFLOG wakeup events stored in
NetdEventListenerService.

There is one WakeupStats object per known interface on which ingress
packets arrive and may wake the system up.

Example from $ adb shell dumpsys connmetrics list:

UPDATEME
...
WakeupStats(wlan0, total: 58, root: 0, system: 3, apps: 38, non-apps: 0, unrouted: 17, 6111s)
WakeupEvent(13:36:31.686, iface wlan0, uid -1)
WakeupEvent(13:38:50.846, iface wlan0, uid -1)
WakeupEvent(13:39:16.676, iface wlan0, uid 10065)
WakeupEvent(13:40:32.144, iface wlan0, uid 1000)
WakeupEvent(13:40:35.827, iface wlan0, uid 1000)
WakeupEvent(13:40:47.913, iface wlan0, uid 10004)
WakeupEvent(13:40:52.622, iface wlan0, uid 10014)
WakeupEvent(13:41:06.036, iface wlan0, uid 10004)
...

Bug: 34901696
Bug: 62179647
Test: runtest frameworks-net
Change-Id: Ie2676b20bfb411a1902f4942643df0c20e268d99
core/java/android/net/metrics/WakeupStats.java [new file with mode: 0644]
proto/src/ipconnectivity.proto
services/core/java/com/android/server/connectivity/IpConnectivityEventBuilder.java
services/core/java/com/android/server/connectivity/NetdEventListenerService.java
tests/net/java/com/android/server/connectivity/IpConnectivityEventBuilderTest.java
tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java
tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java