blob: 772f017b695a3912118f0dac2a0834138510c7da [file] [log] [blame]
Yao Chen44cf27c2017-09-14 22:32:50 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Yao Chen8a8d16c2018-02-08 14:50:40 -080016#define DEBUG true // STOPSHIP if true
Joe Onorato9fc9edf2017-10-15 20:08:52 -070017#include "Log.h"
Yao Chen44cf27c2017-09-14 22:32:50 -070018#include "MetricsManager.h"
Yao Chend10f7b12017-12-18 12:53:50 -080019#include "statslog.h"
Yao Chen93fe3a32017-11-02 13:52:59 -070020
Yao Chen44cf27c2017-09-14 22:32:50 -070021#include "CountMetricProducer.h"
Yao Chen93fe3a32017-11-02 13:52:59 -070022#include "condition/CombinationConditionTracker.h"
23#include "condition/SimpleConditionTracker.h"
Yao Chenb3561512017-11-21 18:07:17 -080024#include "guardrail/StatsdStats.h"
Yao Chen93fe3a32017-11-02 13:52:59 -070025#include "matchers/CombinationLogMatchingTracker.h"
26#include "matchers/SimpleLogMatchingTracker.h"
Yao Chencaf339d2017-10-06 16:01:10 -070027#include "metrics_manager_util.h"
28#include "stats_util.h"
Yangster-mac330af582018-02-08 15:24:38 -080029#include "stats_log_util.h"
Yao Chen44cf27c2017-09-14 22:32:50 -070030
Yao Chen93fe3a32017-11-02 13:52:59 -070031#include <log/logprint.h>
Bookatz6f197902018-02-05 12:30:14 -080032#include <private/android_filesystem_config.h>
David Chen16049572018-02-01 18:27:51 -080033#include <utils/SystemClock.h>
Yao Chen288c6002017-12-12 13:43:18 -080034
35using android::util::FIELD_COUNT_REPEATED;
David Chenfaa1af52018-03-30 15:14:04 -070036using android::util::FIELD_TYPE_INT32;
37using android::util::FIELD_TYPE_INT64;
Yao Chen288c6002017-12-12 13:43:18 -080038using android::util::FIELD_TYPE_MESSAGE;
39using android::util::ProtoOutputStream;
40
Yao Chen44cf27c2017-09-14 22:32:50 -070041using std::make_unique;
42using std::set;
43using std::string;
Yao Chen44cf27c2017-09-14 22:32:50 -070044using std::unordered_map;
45using std::vector;
46
47namespace android {
48namespace os {
49namespace statsd {
50
Yao Chen288c6002017-12-12 13:43:18 -080051const int FIELD_ID_METRICS = 1;
David Chenfaa1af52018-03-30 15:14:04 -070052const int FIELD_ID_ANNOTATIONS = 7;
53const int FIELD_ID_ANNOTATIONS_INT64 = 1;
54const int FIELD_ID_ANNOTATIONS_INT32 = 2;
Yao Chen288c6002017-12-12 13:43:18 -080055
Yao Chend10f7b12017-12-18 12:53:50 -080056MetricsManager::MetricsManager(const ConfigKey& key, const StatsdConfig& config,
Yangster-macc04feba2018-04-02 14:37:33 -070057 const long timeBaseSec, const long currentTimeSec,
Yangster-mac932ecec2018-02-01 10:23:52 -080058 const sp<UidMap> &uidMap,
59 const sp<AlarmMonitor>& anomalyAlarmMonitor,
60 const sp<AlarmMonitor>& periodicAlarmMonitor)
Yangster-mac3fa5d7f2018-03-10 21:50:27 -080061 : mConfigKey(key), mUidMap(uidMap),
62 mLastReportTimeNs(timeBaseSec * NS_PER_SEC),
63 mLastReportWallClockNs(getWallClockNs()) {
Yao Chenb3561512017-11-21 18:07:17 -080064 mConfigValid =
Yangster-mac932ecec2018-02-01 10:23:52 -080065 initStatsdConfig(key, config, *uidMap, anomalyAlarmMonitor, periodicAlarmMonitor,
Yangster-macc04feba2018-04-02 14:37:33 -070066 timeBaseSec, currentTimeSec, mTagIds, mAllAtomMatchers,
Yangster-mac932ecec2018-02-01 10:23:52 -080067 mAllConditionTrackers, mAllMetricProducers, mAllAnomalyTrackers,
68 mAllPeriodicAlarmTrackers, mConditionToMetricMap, mTrackerToMetricMap,
69 mTrackerToConditionMap, mNoReportMetricIds);
Yao Chenb3561512017-11-21 18:07:17 -080070
Yao Chen147ce602017-12-22 14:35:34 -080071 if (config.allowed_log_source_size() == 0) {
David Chen8faaa012018-02-28 15:54:36 -080072 mConfigValid = false;
73 ALOGE("Log source whitelist is empty! This config won't get any data. Suggest adding at "
74 "least AID_SYSTEM and AID_STATSD to the allowed_log_source field.");
Yao Chend10f7b12017-12-18 12:53:50 -080075 } else {
Yao Chen147ce602017-12-22 14:35:34 -080076 for (const auto& source : config.allowed_log_source()) {
77 auto it = UidMap::sAidToUidMapping.find(source);
78 if (it != UidMap::sAidToUidMapping.end()) {
79 mAllowedUid.push_back(it->second);
80 } else {
81 mAllowedPkg.push_back(source);
82 }
83 }
Yao Chend10f7b12017-12-18 12:53:50 -080084
85 if (mAllowedUid.size() + mAllowedPkg.size() > StatsdStats::kMaxLogSourceCount) {
86 ALOGE("Too many log sources. This is likely to be an error in the config.");
87 mConfigValid = false;
88 } else {
89 initLogSourceWhiteList();
90 }
91 }
92
David Chenfaa1af52018-03-30 15:14:04 -070093 // Store the sub-configs used.
94 for (const auto& annotation : config.annotation()) {
95 mAnnotations.emplace_back(annotation.field_int64(), annotation.field_int32());
96 }
97
Yao Chenb3561512017-11-21 18:07:17 -080098 // Guardrail. Reject the config if it's too big.
99 if (mAllMetricProducers.size() > StatsdStats::kMaxMetricCountPerConfig ||
100 mAllConditionTrackers.size() > StatsdStats::kMaxConditionCountPerConfig ||
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800101 mAllAtomMatchers.size() > StatsdStats::kMaxMatcherCountPerConfig) {
Yao Chenb3561512017-11-21 18:07:17 -0800102 ALOGE("This config is too big! Reject!");
103 mConfigValid = false;
104 }
Bookatz1476ef22018-02-13 12:26:01 -0800105 if (mAllAnomalyTrackers.size() > StatsdStats::kMaxAlertCountPerConfig) {
106 ALOGE("This config has too many alerts! Reject!");
107 mConfigValid = false;
108 }
Yao Chenf09569f2017-12-13 17:00:51 -0800109 // no matter whether this config is valid, log it in the stats.
David Chenfaa1af52018-03-30 15:14:04 -0700110 StatsdStats::getInstance().noteConfigReceived(
111 key, mAllMetricProducers.size(), mAllConditionTrackers.size(), mAllAtomMatchers.size(),
112 mAllAnomalyTrackers.size(), mAnnotations, mConfigValid);
Yao Chen44cf27c2017-09-14 22:32:50 -0700113}
114
115MetricsManager::~MetricsManager() {
Bookatzd3606c72017-10-19 10:13:49 -0700116 VLOG("~MetricsManager()");
Yao Chen44cf27c2017-09-14 22:32:50 -0700117}
118
Yao Chend10f7b12017-12-18 12:53:50 -0800119void MetricsManager::initLogSourceWhiteList() {
120 std::lock_guard<std::mutex> lock(mAllowedLogSourcesMutex);
121 mAllowedLogSources.clear();
122 mAllowedLogSources.insert(mAllowedUid.begin(), mAllowedUid.end());
123
124 for (const auto& pkg : mAllowedPkg) {
125 auto uids = mUidMap->getAppUid(pkg);
126 mAllowedLogSources.insert(uids.begin(), uids.end());
127 }
128 if (DEBUG) {
129 for (const auto& uid : mAllowedLogSources) {
130 VLOG("Allowed uid %d", uid);
131 }
132 }
133}
134
Yao Chencaf339d2017-10-06 16:01:10 -0700135bool MetricsManager::isConfigValid() const {
136 return mConfigValid;
137}
138
David Chen27785a82018-01-19 17:06:45 -0800139void MetricsManager::notifyAppUpgrade(const uint64_t& eventTimeNs, const string& apk, const int uid,
140 const int64_t version) {
Yao Chend10f7b12017-12-18 12:53:50 -0800141 // check if we care this package
142 if (std::find(mAllowedPkg.begin(), mAllowedPkg.end(), apk) == mAllowedPkg.end()) {
143 return;
144 }
145 // We will re-initialize the whole list because we don't want to keep the multi mapping of
146 // UID<->pkg inside MetricsManager to reduce the memory usage.
147 initLogSourceWhiteList();
148}
149
David Chen27785a82018-01-19 17:06:45 -0800150void MetricsManager::notifyAppRemoved(const uint64_t& eventTimeNs, const string& apk,
151 const int uid) {
Yao Chend10f7b12017-12-18 12:53:50 -0800152 // check if we care this package
153 if (std::find(mAllowedPkg.begin(), mAllowedPkg.end(), apk) == mAllowedPkg.end()) {
154 return;
155 }
156 // We will re-initialize the whole list because we don't want to keep the multi mapping of
157 // UID<->pkg inside MetricsManager to reduce the memory usage.
158 initLogSourceWhiteList();
159}
160
David Chen27785a82018-01-19 17:06:45 -0800161void MetricsManager::onUidMapReceived(const uint64_t& eventTimeNs) {
Yao Chend10f7b12017-12-18 12:53:50 -0800162 if (mAllowedPkg.size() == 0) {
163 return;
164 }
165 initLogSourceWhiteList();
166}
167
Yao Chen884c8c12018-01-26 10:36:25 -0800168void MetricsManager::dumpStates(FILE* out, bool verbose) {
169 fprintf(out, "ConfigKey %s, allowed source:", mConfigKey.ToString().c_str());
170 {
171 std::lock_guard<std::mutex> lock(mAllowedLogSourcesMutex);
172 for (const auto& source : mAllowedLogSources) {
173 fprintf(out, "%d ", source);
174 }
175 }
176 fprintf(out, "\n");
177 for (const auto& producer : mAllMetricProducers) {
178 producer->dumpStates(out, verbose);
179 }
180}
181
Yao Chen06dba5d2018-01-26 13:38:16 -0800182void MetricsManager::dropData(const uint64_t dropTimeNs) {
183 for (const auto& producer : mAllMetricProducers) {
184 producer->dropData(dropTimeNs);
185 }
186}
187
Yao Chen8a8d16c2018-02-08 14:50:40 -0800188void MetricsManager::onDumpReport(const uint64_t dumpTimeStampNs, ProtoOutputStream* protoOutput) {
Yao Chen729093d2017-10-16 10:33:26 -0700189 VLOG("=========================Metric Reports Start==========================");
190 // one StatsLogReport per MetricProduer
Yangster-mac94e197c2018-01-02 16:03:03 -0800191 for (const auto& producer : mAllMetricProducers) {
192 if (mNoReportMetricIds.find(producer->getMetricId()) == mNoReportMetricIds.end()) {
Yi Jin5ee07872018-03-05 18:18:27 -0800193 uint64_t token =
Yangster-mac94e197c2018-01-02 16:03:03 -0800194 protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_METRICS);
195 producer->onDumpReport(dumpTimeStampNs, protoOutput);
196 protoOutput->end(token);
197 }
Yao Chen729093d2017-10-16 10:33:26 -0700198 }
David Chenfaa1af52018-03-30 15:14:04 -0700199 for (const auto& annotation : mAnnotations) {
200 uint64_t token = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
201 FIELD_ID_ANNOTATIONS);
202 protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_ANNOTATIONS_INT64,
203 (long long)annotation.first);
204 protoOutput->write(FIELD_TYPE_INT32 | FIELD_ID_ANNOTATIONS_INT32, annotation.second);
205 protoOutput->end(token);
206 }
Yangster-mac330af582018-02-08 15:24:38 -0800207 mLastReportTimeNs = dumpTimeStampNs;
Yangster-mac3fa5d7f2018-03-10 21:50:27 -0800208 mLastReportWallClockNs = getWallClockNs();
Yao Chen729093d2017-10-16 10:33:26 -0700209 VLOG("=========================Metric Reports End==========================");
Yao Chen729093d2017-10-16 10:33:26 -0700210}
211
Yao Chen44cf27c2017-09-14 22:32:50 -0700212// Consume the stats log if it's interesting to this metric.
Joe Onoratoc4dfae52017-10-17 23:38:21 -0700213void MetricsManager::onLogEvent(const LogEvent& event) {
Yao Chencaf339d2017-10-06 16:01:10 -0700214 if (!mConfigValid) {
215 return;
216 }
217
David Chenb639d142018-02-14 17:29:54 -0800218 if (event.GetTagId() == android::util::APP_BREADCRUMB_REPORTED) {
219 // Check that app breadcrumb reported fields are valid.
220 // TODO: Find a way to make these checks easier to maintain.
David Chendaa9f3a2017-12-28 16:52:22 -0800221 status_t err = NO_ERROR;
Bookatzb223c4e2018-02-01 15:35:04 -0800222
223 // Uid is 3rd from last field and must match the caller's uid,
224 // unless that caller is statsd itself (statsd is allowed to spoof uids).
225 long appHookUid = event.GetLong(event.size()-2, &err);
David Chen77ef6712018-02-23 18:23:42 -0800226 if (err != NO_ERROR ) {
227 VLOG("APP_BREADCRUMB_REPORTED had error when parsing the uid");
228 return;
229 }
Bookatzb223c4e2018-02-01 15:35:04 -0800230 int32_t loggerUid = event.GetUid();
David Chen77ef6712018-02-23 18:23:42 -0800231 if (loggerUid != appHookUid && loggerUid != AID_STATSD) {
232 VLOG("APP_BREADCRUMB_REPORTED has invalid uid: claimed %ld but caller is %d",
233 appHookUid, loggerUid);
David Chendaa9f3a2017-12-28 16:52:22 -0800234 return;
235 }
Bookatzb223c4e2018-02-01 15:35:04 -0800236
237 // Label is 2nd from last field and must be from [0, 15].
238 long appHookLabel = event.GetLong(event.size()-1, &err);
David Chen77ef6712018-02-23 18:23:42 -0800239 if (err != NO_ERROR ) {
240 VLOG("APP_BREADCRUMB_REPORTED had error when parsing the label field");
241 return;
242 } else if (appHookLabel < 0 || appHookLabel > 15) {
243 VLOG("APP_BREADCRUMB_REPORTED does not have valid label %ld", appHookLabel);
Bookatzb223c4e2018-02-01 15:35:04 -0800244 return;
245 }
246
David Chendaa9f3a2017-12-28 16:52:22 -0800247 // The state must be from 0,3. This part of code must be manually updated.
Bookatzb223c4e2018-02-01 15:35:04 -0800248 long appHookState = event.GetLong(event.size(), &err);
David Chen77ef6712018-02-23 18:23:42 -0800249 if (err != NO_ERROR ) {
250 VLOG("APP_BREADCRUMB_REPORTED had error when parsing the state field");
251 return;
252 } else if (appHookState < 0 || appHookState > 3) {
253 VLOG("APP_BREADCRUMB_REPORTED does not have valid state %ld", appHookState);
David Chendaa9f3a2017-12-28 16:52:22 -0800254 return;
255 }
Tej Singhbb8554a2018-01-26 11:59:14 -0800256 } else if (event.GetTagId() == android::util::DAVEY_OCCURRED) {
257 // Daveys can be logged from any app since they are logged in libs/hwui/JankTracker.cpp.
258 // Check that the davey duration is reasonable. Max length check is for privacy.
259 status_t err = NO_ERROR;
David Chen77ef6712018-02-23 18:23:42 -0800260
261 // Uid is the first field provided.
262 long jankUid = event.GetLong(1, &err);
263 if (err != NO_ERROR ) {
264 VLOG("Davey occurred had error when parsing the uid");
265 return;
266 }
267 int32_t loggerUid = event.GetUid();
268 if (loggerUid != jankUid && loggerUid != AID_STATSD) {
269 VLOG("DAVEY_OCCURRED has invalid uid: claimed %ld but caller is %d", jankUid,
270 loggerUid);
271 return;
272 }
273
Tej Singhbb8554a2018-01-26 11:59:14 -0800274 long duration = event.GetLong(event.size(), &err);
David Chen77ef6712018-02-23 18:23:42 -0800275 if (err != NO_ERROR ) {
276 VLOG("Davey occurred had error when parsing the duration");
277 return;
278 } else if (duration > 100000) {
Tej Singhbb8554a2018-01-26 11:59:14 -0800279 VLOG("Davey duration is unreasonably long: %ld", duration);
280 return;
281 }
282 } else {
283 std::lock_guard<std::mutex> lock(mAllowedLogSourcesMutex);
284 if (mAllowedLogSources.find(event.GetUid()) == mAllowedLogSources.end()) {
285 VLOG("log source %d not on the whitelist", event.GetUid());
286 return;
287 }
Yao Chend10f7b12017-12-18 12:53:50 -0800288 }
289
Joe Onoratoc4dfae52017-10-17 23:38:21 -0700290 int tagId = event.GetTagId();
Yangster-mac330af582018-02-08 15:24:38 -0800291 uint64_t eventTime = event.GetElapsedTimestampNs();
Yao Chen44cf27c2017-09-14 22:32:50 -0700292 if (mTagIds.find(tagId) == mTagIds.end()) {
293 // not interesting...
294 return;
295 }
Yao Chen44cf27c2017-09-14 22:32:50 -0700296
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800297 vector<MatchingState> matcherCache(mAllAtomMatchers.size(), MatchingState::kNotComputed);
Yao Chencaf339d2017-10-06 16:01:10 -0700298
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800299 for (auto& matcher : mAllAtomMatchers) {
300 matcher->onLogEvent(event, mAllAtomMatchers, matcherCache);
Yao Chen44cf27c2017-09-14 22:32:50 -0700301 }
302
Yao Chencaf339d2017-10-06 16:01:10 -0700303 // A bitmap to see which ConditionTracker needs to be re-evaluated.
304 vector<bool> conditionToBeEvaluated(mAllConditionTrackers.size(), false);
305
306 for (const auto& pair : mTrackerToConditionMap) {
307 if (matcherCache[pair.first] == MatchingState::kMatched) {
308 const auto& conditionList = pair.second;
309 for (const int conditionIndex : conditionList) {
310 conditionToBeEvaluated[conditionIndex] = true;
311 }
312 }
313 }
314
315 vector<ConditionState> conditionCache(mAllConditionTrackers.size(),
316 ConditionState::kNotEvaluated);
317 // A bitmap to track if a condition has changed value.
318 vector<bool> changedCache(mAllConditionTrackers.size(), false);
319 for (size_t i = 0; i < mAllConditionTrackers.size(); i++) {
320 if (conditionToBeEvaluated[i] == false) {
321 continue;
322 }
Yao Chencaf339d2017-10-06 16:01:10 -0700323 sp<ConditionTracker>& condition = mAllConditionTrackers[i];
324 condition->evaluateCondition(event, matcherCache, mAllConditionTrackers, conditionCache,
Yao Chen967b2052017-11-07 16:36:43 -0800325 changedCache);
Yao Chen729093d2017-10-16 10:33:26 -0700326 }
327
328 for (size_t i = 0; i < mAllConditionTrackers.size(); i++) {
Yao Chen967b2052017-11-07 16:36:43 -0800329 if (changedCache[i] == false) {
Yao Chen729093d2017-10-16 10:33:26 -0700330 continue;
331 }
332 auto pair = mConditionToMetricMap.find(i);
333 if (pair != mConditionToMetricMap.end()) {
334 auto& metricList = pair->second;
335 for (auto metricIndex : metricList) {
336 // metric cares about non sliced condition, and it's changed.
337 // Push the new condition to it directly.
Yao Chen967b2052017-11-07 16:36:43 -0800338 if (!mAllMetricProducers[metricIndex]->isConditionSliced()) {
Yao Chen5154a3792017-10-30 22:57:06 -0700339 mAllMetricProducers[metricIndex]->onConditionChanged(conditionCache[i],
340 eventTime);
Yao Chen729093d2017-10-16 10:33:26 -0700341 // metric cares about sliced conditions, and it may have changed. Send
342 // notification, and the metric can query the sliced conditions that are
343 // interesting to it.
Yangsterf2bee6f2017-11-29 12:01:05 -0800344 } else {
Yao Chen427d37252018-03-22 15:21:52 -0700345 mAllMetricProducers[metricIndex]->onSlicedConditionMayChange(conditionCache[i],
346 eventTime);
Yao Chen44cf27c2017-09-14 22:32:50 -0700347 }
Yao Chencaf339d2017-10-06 16:01:10 -0700348 }
349 }
350 }
351
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800352 // For matched AtomMatchers, tell relevant metrics that a matched event has come.
353 for (size_t i = 0; i < mAllAtomMatchers.size(); i++) {
Yao Chencaf339d2017-10-06 16:01:10 -0700354 if (matcherCache[i] == MatchingState::kMatched) {
Yao Chenb3561512017-11-21 18:07:17 -0800355 StatsdStats::getInstance().noteMatcherMatched(mConfigKey,
Yangster-mac94e197c2018-01-02 16:03:03 -0800356 mAllAtomMatchers[i]->getId());
Yao Chencaf339d2017-10-06 16:01:10 -0700357 auto pair = mTrackerToMetricMap.find(i);
358 if (pair != mTrackerToMetricMap.end()) {
359 auto& metricList = pair->second;
360 for (const int metricIndex : metricList) {
Chenjie Yub3dda412017-10-24 13:41:59 -0700361 // pushed metrics are never scheduled pulls
Chenjie Yua7259ab2017-12-10 08:31:05 -0800362 mAllMetricProducers[metricIndex]->onMatchedLogEvent(i, event);
Yao Chencaf339d2017-10-06 16:01:10 -0700363 }
Yao Chen44cf27c2017-09-14 22:32:50 -0700364 }
365 }
366 }
367}
368
Yangster-mac932ecec2018-02-01 10:23:52 -0800369void MetricsManager::onAnomalyAlarmFired(
Yangster-mac684d1952018-03-24 16:47:16 -0700370 const uint64_t& timestampNs,
Yangster-mac932ecec2018-02-01 10:23:52 -0800371 unordered_set<sp<const InternalAlarm>, SpHash<InternalAlarm>>& alarmSet) {
Yangster-mace2cd6d52017-11-09 20:38:30 -0800372 for (const auto& itr : mAllAnomalyTrackers) {
Yangster-mac932ecec2018-02-01 10:23:52 -0800373 itr->informAlarmsFired(timestampNs, alarmSet);
Yangster-mace2cd6d52017-11-09 20:38:30 -0800374 }
375}
376
Yangster-mac932ecec2018-02-01 10:23:52 -0800377void MetricsManager::onPeriodicAlarmFired(
Yangster-mac684d1952018-03-24 16:47:16 -0700378 const uint64_t& timestampNs,
Yangster-mac932ecec2018-02-01 10:23:52 -0800379 unordered_set<sp<const InternalAlarm>, SpHash<InternalAlarm>>& alarmSet) {
380 for (const auto& itr : mAllPeriodicAlarmTrackers) {
381 itr->informAlarmsFired(timestampNs, alarmSet);
Yangster-mace2cd6d52017-11-09 20:38:30 -0800382 }
383}
384
yro69007c82017-10-26 20:42:57 -0700385// Returns the total byte size of all metrics managed by a single config source.
386size_t MetricsManager::byteSize() {
387 size_t totalSize = 0;
388 for (auto metricProducer : mAllMetricProducers) {
389 totalSize += metricProducer->byteSize();
390 }
391 return totalSize;
392}
393
Yao Chen44cf27c2017-09-14 22:32:50 -0700394} // namespace statsd
395} // namespace os
396} // namespace android