OSDN Git Service

Separate connectivity event buffer for bug reports
authorHugo Benichi <hugobenichi@google.com>
Fri, 15 Sep 2017 05:18:57 +0000 (14:18 +0900)
committerHugo Benichi <hugobenichi@google.com>
Tue, 26 Sep 2017 05:14:25 +0000 (14:14 +0900)
commit1198ba1533cd2818dd69c443c3ae8cec3284b515
tree3a20dd092a40452a3fa5fe6a569ea451e1dff43d
parent67c5e03b54e322a4dab897cbdd36d51ecc007f1e
Separate connectivity event buffer for bug reports

This patch uses the RingBuffer class previously extracted out of
NetdEventListenerService for buffering connectivity events in two
independent buffers:
 - the current existing buffer used for metrics reporting
 - a new rolling buffer, used for bug report dumpsys.

This improves the suefulness of connectivity metrics for bug reports
by solving these three issues tied to the usage of the existing metrics
reporting buffer:
 - the buffer is always cleared when metrics reporting happens. If a bug
 report is taken shortly after, there is no past connectivity event
 added to that bug report.
 - the buffer has a max capacity and starts dropping new events when it
 saturates, until metrics reporting happens. When this happens, a bug
 report will not contain recent connectivity events.
 - some types of event are rate limited to avoid flooding the metrics
 buffer. events dropped due to rate limits never appears in the bug
 report, but the new bug report buffer ignores rate limiting.

Bug: 65164242
Bug: 65700460
Test: runtest frameworks-net,
      manually inspecting ouput of $ adb shell dumpsys connmetrics -a

Change-Id: Ia47e566b0c9a6629a26afb7067d5a8efadc25aef
services/core/java/com/android/server/connectivity/IpConnectivityMetrics.java