OSDN Git Service

Adds guardrail for memory usage for statsd uid map.
authorDavid Chen <dwchen@google.com>
Mon, 27 Nov 2017 19:52:26 +0000 (11:52 -0800)
committerDavid Chen <dwchen@google.com>
Wed, 29 Nov 2017 22:55:15 +0000 (14:55 -0800)
commitc136f45aee2c193e954c107f35109ccc8b1146b3
tree5a0d04c466e980fab634ba0eb2c55b200a7f8936
parent22b94c3f0f8d3937efd15aa787d3084fd8e01c9e
Adds guardrail for memory usage for statsd uid map.

Checks if current memory usage of uid map is above a configured limit
and if so, we start deleting snapshots. If there are no more
snapshots, we begin deleting two of the deltas. Also records stats
in the guardrail StatsdStats. Also fixes an edge case where a config
is added after the snapshots are added. We request a snapshot of all
installed uid's at that moment. Finally, adds the uid map memory size
when determining if we should send a broadcast to trigger collection.

Test: Added unit-tests and check they pass on marlin.
Change-Id: Id5d86378bd1efe12a06b409164c777c0c6f4e3ab
cmds/statsd/src/StatsLogProcessor.cpp
cmds/statsd/src/StatsService.cpp
cmds/statsd/src/guardrail/StatsdStats.cpp
cmds/statsd/src/guardrail/StatsdStats.h
cmds/statsd/src/packages/UidMap.cpp
cmds/statsd/src/packages/UidMap.h
cmds/statsd/src/stats_log.proto
cmds/statsd/tests/UidMap_test.cpp
core/java/android/os/IStatsCompanionService.aidl
services/core/java/com/android/server/stats/StatsCompanionService.java