History log of /frameworks/base/cmds/statsd/src/condition/condition_util.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6 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
(cherry picked from commit 8a8d16ceea1e5b7a2f8c41e17b5d993035f50f5d)
/frameworks/base/cmds/statsd/src/condition/condition_util.cpp
9369446f0b04945d6674550728ae81196d6fb5c2 23-Jan-2018 Yangster-mac <yanglu@google.com> Support dimension in condition in metric producers.

Test: added e2e tests for count/duration metrics sliced by fields in condition and with/without links.

Change-Id: Ie34deba68e6780abdde458be3f0ce5284e76a1a2
/frameworks/base/cmds/statsd/src/condition/condition_util.cpp
7ba8fc357e44ee3bb8e614c202852a1c46a9d4a8 25-Jan-2018 Yangster-mac <yanglu@google.com> Cpu usage optimization:
1/ Avoid unnecessary field/dimension proto construction.
2/ use unordered_map for slicing.
3/ Use dimension fields to compare dimension keys.

Test: all statsd tests passed.
Change-Id: I2f74f78589b7f6ecd0803a2ead822b8d0399f334
/frameworks/base/cmds/statsd/src/condition/condition_util.cpp
2c6dc474acc3087c273cd2501d0769458a769f40 19-Jan-2018 Yangster-mac <yanglu@google.com> Rename the dimension_in_what/condition as fields_in_what/condition in MetricConditionLink proto.

Test: statsd cts tests passed.
Change-Id: I4c21b0da3d153c8d0c368a78647c44699a3161a5
/frameworks/base/cmds/statsd/src/condition/condition_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/condition/condition_util.cpp
d5aa01b3716e07463019fa772f07a40613f9e39e 20-Dec-2017 Yao Chen <yaochen@google.com> Remove the hacky HashableDimensionKey.

+ Add a real HashableDimensionKey as a wrapper of the dimension.
So we can get rid of the maps that we kept.

Pay down technical debt and reduce memory usage.

Test: statsd_test & manual
Change-Id: I233280cf1e2ce93da6a8cd4e8514abb066f4016d
/frameworks/base/cmds/statsd/src/condition/condition_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/condition/condition_util.cpp
cfed20bce8a66bde6ad0d74a44fc0a2764b2886d 18-Nov-2017 Stefan Lafon <stlafon@google.com> Update statsd_config.proto.

Test: Ran statsd tests.

Change-Id: I3a83bdfb38be82d70ca547825152370df8bca9cc
/frameworks/base/cmds/statsd/src/condition/condition_util.cpp
17adac9cf3e03ad95372eb8657b26909d0414ac0 09-Nov-2017 yro <yro@google.com> Finish migrating to use ProtoOutputStream. This change will take the
outputs of each MetricProducer's and merge the results into
ConfigMetricsReport which holds ConfigKey, repeated field of
StatsLogReport, and UidMap. The data will be represented as
vector<uint8_t> which can be passed down to binder call for clients to
pick up. Also, all unnecessary dependencies to stats_log proto have been
removed.

Test: statsd, statsd_test
Change-Id: Ia69137cbc8613644a892e6be1e87b4858bd39fe3
/frameworks/base/cmds/statsd/src/condition/condition_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/condition/condition_util.cpp
9fc9edf95a308f5884bf541cac81ce1f41aba0ba 16-Oct-2017 Joe Onorato <joeo@google.com> Clean up how we handle configurations, and other assorted cleanup

- Add a ConfigManager class that tracks the configurations
that have been passed to us. Configurations are now
tracked by tuples of (uid,tag), where the tag is an
app-defined string, in case a single uid has multiple
configurations.
- Move all of the initialization into StatsService.
- Get rid of the ability to have multiple LogListeners. Raw
events are now pushed directly into StatsService, which
can distribute them to the interested parties (and will
eventually be able to do the proper locking).
- Add Log.h, which sets our LOG_TAG correctly.
- Move some of the related files that I expect will grow some
into their own subdirectories.

Test: statsd_test
Test: adb shell cmd stats config ...
Test: adb shell dumpsys stats
Change-Id: I79487603003d8a842d5bd319741f1ecbf72063d1
/frameworks/base/cmds/statsd/src/condition/condition_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/condition/condition_util.cpp