History log of /frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
15f6bbc24f4d7a3d4481d90a18df33d402ddacba 08-Apr-2018 Yangster-mac <yanglu@google.com> Flush the bucket when creating the metric producer.
Use int64 for value field.
E2e test for gauge/value metric.

BUG: b/74445671

Test: statsd test.
Change-Id: I823a0bade8f89834bdfb9cf48864852a47d7b63b
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
bd12527c90d55eefa657e6a71cfdd287ecdb4ab3 05-Apr-2018 David Chen <dwchen@google.com> Fix uid map to be simpler and fix partial bucket.

The previous scheme captured periodic snapshots for each config with
complex logic that's unnecessary and wasted memory. We actually don't
need to store any snapshots since we just convert the current state
into a snapshot and also include the deltas (change events) since the
previous report until now.

To make the system more robust, we also include up to 100 of the
deleted apps in the uid map.

Also, fix the wiring of the partial buckets so the metric producers
form partial buckets on both app upgrade and removal, but not on
installation of a new app.

Also, we update StatsCompanionService to also include disabled apps.

Bug: 77607583
Test: Verified unit-tests pass and added new e2e tests.
Change-Id: I98e1f544d6e6571545ae1581c4cebab807596f51
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
c04feba805c5acde92638a062cc13030fc4d3308 02-Apr-2018 Yangster-mac <yanglu@google.com> Move forward the alarm timestamp when config is added to statsd.

Test: statsd test
BUG: b/77344187

Change-Id: Ieacffaa29422829b8956f2b3fcb2c647c8c3eed9
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
aa5b2010152c4042786b558a44a89d25229d8962 21-Mar-2018 Chenjie Yu <cjyu@google.com> Fix StatsCompanionService sometimes can be null

Bug: 75970648
Test: will add cts test for puller alarms
Change-Id: I51b7d13f855d3c8ded8325d7cf0f614531eceea5
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
aed0fed078170d466217ed71fd03cebee050e595 20-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add uid field annotation in atoms.proto and statd memory usage optimization." into pi-dev
c40a19d2e43d5de3e036e926bf070220c2c865e6 16-Mar-2018 Yao Chen <yaochen@google.com> Add uid field annotation in atoms.proto and statd memory usage optimization.

[memory]
statsd binary size from 664k -> 600k
memory usage 1978k -> 1813k (with no configs)
+ Avoid initialize any static map in statslog.h to avoid many copies of the map in each include.
- Do it in cpp so that it is initialized only in places that use them

[Uid annotation]
+ Uid annotation is needed for extracting uid from dimension for UidCpuPuller.
+ After the change, stand-alone uids don't need to be in field 1 anymore.
+ Also added exclusive bit annotation in AppDied
+ Currently only allow one uid field in an Atom. This is to keep things simple until
we find an exception.

Test: statsd_test
Bug: 73958484
Bug: 72129300

Change-Id: I8a916d5c00d5930e24ae7e0825a57dea19c0e744
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
6bf9825b1575bfc3c62ef0a5129f94b6a776ef66 14-Mar-2018 Bookatz <bookatz@google.com> Statsd AnomalyDetection improvements

Various fixes and improvements to statsd's anomaly detection.

Bug: 74607818
Test: make statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test

Change-Id: Ia67a8eb6da0ea9293f698949e1565f7f024a7cb9
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
580ea321b16c71ddec515553761d6f37359bd3a0 26-Feb-2018 Yao Chen <yaochen@google.com> Add StateTracker.

StateTracker is a special condition tracker that's based on a state atom.
State atoms are annotated in atoms.proto.

The rules for StateTracker:
1. must not have "stop". must have "dimension"
2. must be based on a state atom.
3. it must have the all primary fields and the exclusive state field in its dimension.

For example UidProcessStateTracker, will have output dimension {uid, state}.

Test: unit tests added.
Change-Id: I6b77e58e9fabe61f7326daf929577d8b2cfbf27b
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
932ececa1674c59a8da9f3e32d2651e781b86fc4 01-Feb-2018 Yangster-mac <yanglu@google.com> Alarm: wakes up statsd and notifies the subscribers.

Test: manually tested it.
Change-Id: Id796a68976aeb1611183023ba4e9c6a8b8c44bb8
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
1476ef24f33fd9ff7d0e748f61cc964723e6bb1c 13-Feb-2018 Bookatz <bookatz@google.com> Statsd guardrail for Alerts

Now, each config is allowed at most 100 Alerts in it.
That is, for each uid, for each config id, the config's alert section
can have at most 100 items in it.

Bug: 73287046
Test: none yet
Change-Id: I2c81bc647627e432337c359c0a76aa3fc08bdd23
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
8a8d16ceea1e5b7a2f8c41e17b5d993035f50f5d 08-Feb-2018 Yao Chen <yaochen@google.com> Statsd CPU optimization.

The key change is to revamp how we parse/store/match a log event, especially how we match repeated
field and attribution nodes, and how we construct dimensions and compare them.

+ We use a integer to encode the field of a log element. And also encode the FieldMatcher into an
integer and a bit mask. The log matching becomes 2 integer operations.

+ Dimension is stored as encoded field and value pair. Checking if 2 dimensions are equal is then
becoming checking if the underlying integers are equal. The integers are stored contiguously
in memory, so it's much faster than previous tree structure.

Start review from FieldValue.h

Test: statsd_test + new unit tests

Bug: 72659059

Change-Id: Iec8daeacdd3f39ab297c10ab9cd7b710a9c42e86
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
484524a246ffe453f8cd89b698a279c23b0bde1f 02-Feb-2018 Tej Singh <singhtejinder@google.com> Turn off debug logging in statsd

Sets DEBUG to false everywhere and replaces all ALOGD with VLOG so they
do not print with DEBUG false. Leaves all ALOGI, ALOGW and ALOGE as is.

Test: ran all CTS tests and checked "adb logcat -s statsd" to make sure
it wasn't spammy

Change-Id: Iaa8eb3a0a63723ffe40f94f2815f94df877fd432
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
468ff04fd4cb43a384a3d4948cccd4438be7202a 17-Jan-2018 Yangster-mac <yanglu@google.com> Proto change for dimension from condition.

Test: all statsd unit tests and cts tests passed.

Change-Id: I955143aca7c76e2e22a10d7ba42eb797bd32e147
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
a070b6a40c95df5b64d195aba1386815fec5d5b7 04-Jan-2018 Yangster-mac <yanglu@google.com> Bug fix: gauge metric producer does not need the atom id parameter.

Test: statsd unit test passed
Change-Id: Ifd1e2f7a05a03886eb227ac1ae0e30b884e49f0c
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
a7fb12d2d285a3a62f5e8956d1bacfa0e15e9d0f 04-Jan-2018 Yangster-mac <yanglu@google.com> 1/ Use FieldMatcher to specify the value fields in value metric.
2/ rename number_of_buckets as num_buckets
3/ use double for the Alert's threshold

Test: statsd unit tests passed.
Change-Id: Id1f55f14d3712eddee561681e3cd77343f086c7a
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
94e197cceb2ba7df13ff8de04f60bfeec64015d9 03-Jan-2018 Yangster-mac <yanglu@google.com> 1/ Change all "name" to id in statsD.
2/ Handle Subscription for alert.
3/ Support no_report_metric

Bug: 69522276
Test: all statsd unit tests passed.
Change-Id: I851b235f2d149b8602b0cad632d5bf541962f40a
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
2087716f2bdca90c7c3034d556ac12911bd8018e 23-Dec-2017 Yangster-mac <yanglu@google.com> 1/ Support nested message and repeated fields in statsd.
2/ Filter gauge fields by FieldMatcher.
3/ Wire up wakelock attribution chain.
4/ e2e test: wakelock duration metric with aggregated predicate dimensions.
5/ e2e test: count metric with multiple metric condition links for 2 predicates and 1 non-sliced predicate.

Test: statsd unit test passed.

Change-Id: I89db31cb068184a54e0a892fad710966d3127bc9
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
857aaa520804d846a050e1eeb85d82977c983666 20-Dec-2017 Bookatz <bookatz@google.com> Splits AnomalyTracker into two files

Splits out DurationAnomalyTracker-specific functions into their own
subclass.

Test: the unit tests and CTS tests
Change-Id: Id6eb74d232b4a9c3a932d805d1ba3f0ba43a88b1
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
2b4fc9d657feaafb654a38096ec46622dcdb37bc 19-Dec-2017 Chenjie Yu <cjyu@google.com> align metrics start time to the previous 5 min start, instead
of the next 5 min start. Also refactor config check condition
to be more readable.

Test: unit test
Change-Id: Iaa6b4a59d27c52996723862d92080d90c9e794cb
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
dc4e426a17044f799ad1d7bd8a363022e8044619 17-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "add feature: GaugeMetricProducer now takes repeated list of fields bug fix: GaugeMetricProducer now works better with pulled events. unit test also includes GaugeMetricProducer_test"
d9dfda76e0aa8b8aa4d2562a7ff4259f4500e355 12-Dec-2017 Chenjie Yu <cjyu@google.com> add feature: GaugeMetricProducer now takes repeated list of fields
bug fix: GaugeMetricProducer now works better with pulled events.
unit test also includes GaugeMetricProducer_test

Test: unit test
Change-Id: Ic60f09342d14cfb107be2130d445b323a56909e0
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
85ed8387135849f256cecb4429c75938ad91cd55 15-Dec-2017 Chenjie Yu <cjyu@google.com> align metrics to 5min bundary
We use one alarm clock for all pulled atoms.
If metrics from different configs are not aligned,
the clock will be set to repeat at higher and higher
frequency, and consume a lot of battery.
Current implementation assumes a 5min minimum bucket
size. New metric start time is set to be aligned to
the start time of statsd in the next 5min.
So it will ignore events up to 5min.

align puller alarm to minute bundary

Test: unit test
Change-Id: I77ffa3c13de363c780b1000181b9a9b780dd0846
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
a5b5191351a85ea33641dc42ee4223189b3612f3 06-Dec-2017 Stefan Lafon <stlafon@google.com> Rename EventConditionLink as MetricConditionLink in statsd_config.proto.

Test: Ran statsd_test and cts tests.
Change-Id: Ia9a38892854443aa4f17d800a075860fcf874652
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
12d01fa7c165a1f79091d4d742a48bffd7552650 05-Dec-2017 Stefan Lafon <stlafon@google.com> Rename more things in statsd_config.proto.

SimpleCondition -> SimplePredicate
simple_condition -> simple_predicate
Condition -> Predicate
condition -> predicate

Test: Ran statsd and statsd_test.

Change-Id: I3115fb51a4dc3cbe5f23535dfc448d5755b9ed7f
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
450099db169d386077584d93486908c3bae1244e 01-Dec-2017 Bookatz <bookatz@google.com> AnomalyDetection invalidity depends on MetricProd

DurationMetricProducer has extra conditions that must be satisfied for
an anomaly detection Alert (in the config) to be valid. This test must
only be run for DurationMetricProducer, and not other MetricProducers.

In the future, AnomalyTracker will be split into two, with a
DuratoinAnomalyTracker subclass that will be created by
DurationMetricProducer's createAnomalyTracker function.

Test: CTS test in progress
Change-Id: If172a71d15d5dabb2827859ddb2b5ff7ed386501
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
b8c9aa8c9ccba4e64759c177381b742ca99a5487 03-Dec-2017 Stefan Lafon <stlafon@google.com> Rename a few things in statsd_config.proto.

This for frameworks/base/

SimpleLogEntryMatcher -> SimpleAtomMatcher.
simple_log_entry_matcher -> simple_atom_matcher
LogEntryMatcher -> AtomMatcher
log_entry_matcher -> atom_matcher

Test: Ran statsd_test.

Change-Id: I7398758e3fab86235897c162884f5ceab3002510
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
f2bee6fec965fd42ab223f1a3aa705f07ba79aea 29-Nov-2017 Yangster <yanglu@google.com> 1/ Only expose thread-safe interfaces in metric producer.
2/ Simplify lock logic.
3/ Add test for duration metric producer.

Test: all unit test passsed.
Change-Id: If6ee2e69a17f12406f4b3ea3553b14642cd636d6
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
64b00066fe0729c50ddbc08a7ff142ab6efd3eb5 28-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Statsd anomaly detection - fixes"
cc5adef2d0c5f96a225fd69517fd1eecb557f46d 21-Nov-2017 Bookatz <bookatz@google.com> Statsd anomaly detection - fixes

Fixes a few items in AnomalyTracker, especially to do with what happens
when an anomaly alarm fires.

Test: unit tests still pass
Change-Id: Ia89bd617442e952e587336b890c3ca67430b5e21
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
10535b9ad0b8be8f07d27f1d6a13372be31cbf65 27-Nov-2017 Yao Chen <yaochen@google.com> Reject the config if condition config has errors. And add log tag.

Test: added unit test.
Change-Id: I7108350978f7c1d0e8e87f22082e19fc76a75631
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
c8862caf4f2deebe7e81f8a291233fa1035ecdd4 27-Nov-2017 Yao Chen <yaochen@google.com> Merge "Revert "Reject the config if condition config has errors. And add log tag.""
f94a51876dc2952a10a568cfdb344b314ca8943c 27-Nov-2017 Yao Chen <yaochen@google.com> Revert "Reject the config if condition config has errors. And add log tag."

This reverts commit c9fa2f6d4ea5c3f6730bee67646c0423f5693640.

Change-Id: I91de13f8a102c58bbd3dfc37b09c977e78119854
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
1b5be51fd968628d9b7541697800920642da9b22 27-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Reject the config if condition config has errors. And add log tag."
c9fa2f6d4ea5c3f6730bee67646c0423f5693640 27-Nov-2017 Yao Chen <yaochen@google.com> Reject the config if condition config has errors. And add log tag.

Test: added unit test.
Change-Id: I5a9d6de2492b94bc5f1c88524f743607e60226c1
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
b356151e63140085cb96fa16804ee18b3862a4fc 22-Nov-2017 Yao Chen <yaochen@google.com> Add StatsdStats and guardrail.

+ StatsdStats is the global class that tracks the stats about statsd.

+ Added guardrail for classes that have a map which could potentially grow
unboundedly with the number of logs.

TODO: add unit tests & CTS for StatsdStats, and guardrail
add stats for pulled atoms.

Test: statsd_test

Change-Id: I0ea562de4dd3f6162f7923a9c193420b482c1d51
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
7c8f0a521e9b466bb6b8cef74bcd677a9aed4014 21-Nov-2017 Stefan Lafon <stlafon@google.com> Fix the fake statsd config. Better error messages.

Test: Ran statsd.

Change-Id: Ib3d35024a4929702bc470a8bde267b24a4d867de
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
e2cd6d509b17894b95d14523ae3e7c4c7a9a74e3 10-Nov-2017 Yangster-mac <yanglu@google.com> 1/ Duration anomaly tracker with alarm.
2/ Init anomaly from config based on the public language.
3/ Unit tests for anomaly detection in count/gauge producer.
4/ Revisit the duration tracker logic.

Test: unit test passed.
Change-Id: I2423c0e0f05b1e37626954de9e749303423963f2
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
4aa167736b2e680f5a297844ce6b8bd6f8603f9f 18-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "One more feature in DurationMetric -- nesting on top of Or and Max"
0ea19901ef78de19437c08bbcbb7af6663ad6f4b 16-Nov-2017 Yao Chen <yaochen@google.com> One more feature in DurationMetric -- nesting on top of Or and Max

+ Added counters to count the starts.

Test: added some unit test in statsd_test.

TODO: ADD MORE UNIT TESTS

Change-Id: I3575e921a4abab27c4ea50fffde19cc1d4564030
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
5c925ad04ffe959e8fb00253b20daf1f7128b8d6 15-Nov-2017 Yao Chen <yaochen@google.com> Sync the DurationMetric proto from google3.

There are other statsd_config changes for Anomaly detection, but requires
code change. So will sync later.

Test: statsd_test
Change-Id: I927e99bd0763cb949fe339993b232f53a4eefe7a
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
d1815dc7b82f99259f6c41cfacc44972b867ef2d 14-Nov-2017 Yangster-mac <yanglu@google.com> Sync statsd to the public proto changes:
1/ use string id/name for all metrics/configs/matchers.
2/ move alerts out of metric proto.

Test: unit test passed.
Change-Id: I08269f47be30f83f6dbadf873e7d62213449932b
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
6736c893a73c567d3794d88ae0d17abab34b7a6f 09-Nov-2017 Chenjie Yu <cjyu@google.com> Unit tests for ValueMetricProducer
StatsPullerManager is refactored so that we can mock it.
It may need more refactor pass to make is safer for longer runs.

Test: unit test
Change-Id: Ief0c99710e4d06e1454678f8b749c9599467d114
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
93fe3a34a02c673eaee4a2d18565ba8df20685cb 02-Nov-2017 Yao Chen <yaochen@google.com> Add unit tests for CountMetricProducer, EventMetricProducer

And other miscellaneous fixes.
+ clang-format
+ 2 bug fixes, one in dump-report command, one in ResourcePowerManagerPuller

Test: statsd_test

Change-Id: Ibd164d948ad62adcc529d813df1210781e38be47
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
1d4d686001b220e114df737154f143ffabc212f1 31-Oct-2017 Yangster <yanglu@google.com> Gauge metric producer.

Test: manual tests passed for pushed device temperature.
Change-Id: I7592a4c04666606b745cdb41db8f9d8a96a966da
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
5305e1ddc22bfe9ad941cb2550987aaba8de234c 31-Oct-2017 Chenjie Yu <cjyu@google.com> pull resource power manager stats into statsd

Test: tested on device and check output
Change-Id: I65932a5527d6099e12546b6928a24f3616e54e16
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
b3dda41a5a48ddfa44dc8fa939ab495926a0195d 24-Oct-2017 Chenjie Yu <cjyu@google.com> reretry ValueMetric implementation and pulling mechanism

Note:
This is for value metric. The default operations is sum the diffs.
The test uses kernel wake lock, which also needs dimension by kernel
wake lock name.

The test is a bit cumbersome as it needs StatsCompanionService to do
the alarm, which is not exact alarm.

The internal state of a slice of bucket would look something like this:

4:ipc0000005e_727_android.hardwar
0 0
4:SensorService_wakelock
40 64
4:ipc0000005c_727_android.hardwar
...

Test: manual test on device.
Change-Id: I2ed0ac7d3c5fcba8b7611d46f38a38ffd8bdc92a
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
5154a379303ab90a2b2914676a4441917a329b5d 31-Oct-2017 Yao Chen <yaochen@google.com> Adding multi layer aggregation in DurationMetric

Newly supported metrics examples:

1) Compute [Total|Max] duration of [an app] holding [ANY] wake lock while [this app] is in
[background] and [screen off], bucket size 30seconds, and slice output by uid.

2) Compute [Total|Max] duration of [ANY app] holding [ANY] wake lock while [this app] is in
[background] and [screen off], bucket size 30 seconds.

+ DurationMetric proto has a "what" which is a SimpleCondition. It defines the atom level start
and stop of the duration timer, and it has its atom dimension. e.g., for wake locks, the atom
dimensions wil be uid and wl name.

+ Now dimension is explicitly specified in SimpleCondition proto instead of inferred from the "link"

+ Added support for "Or" and "Max" through 2 layers of aggregation.

TODO: (1) The way we track slicedCondition in duration metric is not efficient. optimize!
(2) The output dimension should all use int32 instead of KeyMatcher. Fix in a future cl.

Test: Added some unit tests using gmock. Will add more unit tests.

Change-Id: I58a827624f01f9a54fcb80709c4de4ff94a8bc67
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
5110bedd787835d4dbc809b7977285cac364bdef 23-Oct-2017 Yao Chen <yaochen@google.com> Add EventMetricProducer

+ Started to use ProtoOutputStream in EventMetricProducer.
[TODO]: We need to auto-generate fieldIds for StatsLogReport, XXXMetricData, etc.
[TODO]: We need to add Enum type to liblog, otherwise we cannot reconstruct a proto containing
an enum

+ Some refactor in metric initialization code. There are still boiler plate code, because Metrics
are similar but with subtle differences.

Test: statsd_test

Change-Id: Id7e3212566249a8139b9680f04238c455d50c1b8
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
729093df0dd7d7038ad43b16ecdb59a1404f3b50 16-Oct-2017 Yao Chen <yaochen@google.com> Add support for dimension, and link with condition and added DurationMetric

Now we support following metrics:
<Duration> of [app holding a wake lock], while [*this app*] is [in background] [AND] [screen is off]
[Slice] the output by [app name, wake lock name], with bucket size [30sec]

+ Also added onDumpReport() api in MetricsManager, it can be called from client to fetch the data from
statsd

+ Also added command line tool to dump the StatsLogReport from all metrics for debugging.

+ Synced proto from google3. with a pending cl (cr/172359050)

TODO: We need to add tons of tests to test the Metrics. I will work on it after this CL so people
can be unblocked.

I locally test the duration metric with wake lock with an app that generates StatsLog events.

Test: statsd_test

and manual test, and run:

adb shell cmd stats dump-report
We have a default config, which contains a metrics to count PROCESS_START event sliced by
package name.

Change-Id: I4838cc6cf025c143b7e84f43040703a78121fd25
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp
caf339d004fad667748b68912c254df4e75cdc5a 07-Oct-2017 Yao Chen <yaochen@google.com> More complete implementation for condition and log matchers in statsd.

+ also synced proto from google3 to fix the LogEntryMatcher proto

+ MetricsManager represents StatsdConfig, it's responsible for initializing and managing all
LogEntryMatcher, Condition, and Metrics. Start review from here.

+ Added more complete StatsdConfig initialization, including building the map for:
LogEntryMatcher -> Metrics
LogEntryMatcher -> Condition
Condition -> Metrics.

All the maps use index(int). The extra amount of memory for storing mappings help us
quickly process log events.

The StatsdConfig initialization process detects malformed config
- Circle dependency
- Missing definition
etc.

And once we detect ANY error, statsd will reject the config. And the resources related to this
config will be released.

Test: Added unit tests
Change-Id: I2c4aefdbf3e2aa1701eacbb2fb5e653819ec1fbb
/frameworks/base/cmds/statsd/src/metrics/metrics_manager_util.cpp