From 23f4d6cc618576ac53da4ce9e761e9bee3109333 Mon Sep 17 00:00:00 2001 From: Ray Essick Date: Thu, 20 Jun 2019 10:16:37 -0700 Subject: [PATCH] Enable count-based expiration for media metrics in addition to the time-based expiration, enable count based expiration and set it to 2000 records, about 5x the daily average. Caps the memory footprint. Bug: 135552978 Test: boot, enough traffic to force expirations Change-Id: Ide96df24b00e8f115905678800c782f29a91bcba --- services/mediaanalytics/MediaAnalyticsService.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/mediaanalytics/MediaAnalyticsService.cpp b/services/mediaanalytics/MediaAnalyticsService.cpp index 3626ad1514..0e7edfdb44 100644 --- a/services/mediaanalytics/MediaAnalyticsService.cpp +++ b/services/mediaanalytics/MediaAnalyticsService.cpp @@ -82,7 +82,12 @@ namespace android { // (0 for either of these disables that threshold) // static constexpr nsecs_t kMaxRecordAgeNs = 28 * 3600 * (1000*1000*1000ll); -static constexpr int kMaxRecords = 0; +// 2019/6: average daily per device is currently 375-ish; +// setting this to 2000 is large enough to catch most devices +// we'll lose some data on very very media-active devices, but only for +// the gms collection; statsd will have already covered those for us. +// This also retains enough information to help with bugreports +static constexpr int kMaxRecords = 2000; // max we expire in a single call, to constrain how long we hold the // mutex, which also constrains how long a client might wait.