History log of /frameworks/base/cmds/statsd/src/matchers/matcher_util.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f384b900498b552c776931c8873e4bd03af36fe5 15-Mar-2018 David Chen <dwchen@google.com> Removes stats_log proto from uid map in statsd.

We don't need to parse the proto of uid map, so we use the
ProtoOutputStreame class to generate the binary form of the proto
output that's needed for parsing the uid map data.

Test: Verified unit-tests still pass.
Bug: 74010813
Change-Id: Ia2f7572f3b78bb6f7b60e8b14cf5d65428469ab6
/frameworks/base/cmds/statsd/src/matchers/matcher_util.h
9c1debe330006b2b4d5c08a55905789c57369609 19-Feb-2018 Yao Chen <yaochen@google.com> Add annotation to atoms that represent a state change in atoms.proto

+ A state change atom can have one exclusive state field, and any
number of primary key fields.

When there is primary key in the atom, it means the state belongs to the primary key.
For example,
message UidProcessStateChanged {
optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
}

When there is no primary key fields in the atom, the state is global.
For example,
message ScreenStateChanged {
optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
}

+ The annotation is consumed by stats_log_api_gen to generate a static map from the state
atoms to its primary fields, and exclusive fields

+ stats_log.proto is splitted into 2 proto files, because statsd needs proto lite, and c++
lite proto library cannot properly ignore the field options which requires full proto.

This CL doesn't change any logic in the statsd yet. A separate CL will use the field option
information to correctly track the state.

Test: added unit tests in stats_log_api_gen_test. and statsd_test pases.
Change-Id: I9e8a979fe81ba60efd4d854bb7087ce4b2b147ec
/frameworks/base/cmds/statsd/src/matchers/matcher_util.h
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/matchers/matcher_util.h
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/matchers/matcher_util.h
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/matchers/matcher_util.h
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/matchers/matcher_util.h
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/matchers/matcher_util.h
c4dfae56c10a1dd571baa78c750f2e68c919d74f 18-Oct-2017 Joe Onorato <joeo@google.com> Introduce a new wrapper for log_msg -- LogEvent

It stores all of the parsed fields in a single vector, and
provides accessor methods to get at fields by index with
their correct type.

Test: statsd_test
Change-Id: I4fa94e4ce52db3ac87f19b62f9c85398de6e8145
/frameworks/base/cmds/statsd/src/matchers/matcher_util.h
d54f9dd6251c7bd7033630b7afa770190d41c409 17-Oct-2017 Yao Chen <yaochen@google.com> Revert "Revert "Start auto-generating the stats log API.""

Test: builds successfully

This reverts commit 931945399859ab91545ba2c2a914f044092d5e2e.

Change-Id: I22bca4a32adf86040b9d72ad5b45999aba28f586
/frameworks/base/cmds/statsd/src/matchers/matcher_util.h
931945399859ab91545ba2c2a914f044092d5e2e 17-Oct-2017 Joe Onorato <joeo@google.com> Revert "Start auto-generating the stats log API."

This reverts commit b81d1a7b9a38dcb4d356ae3435a82fb52ba7d585.

Change-Id: I189684d8913ffffca42d9514ac88ea5cc4a44f05
/frameworks/base/cmds/statsd/src/matchers/matcher_util.h
b81d1a7b9a38dcb4d356ae3435a82fb52ba7d585 16-Oct-2017 Joe Onorato <joeo@google.com> Start auto-generating the stats log API.

Both native and java bindings.

TODOs:
- Finish WorkSources.
- Clean up the package names for the protos.
- Put the protos in a more suitable location.

Test: stats-log-api-gen-test
Change-Id: Idf4022225e2be05106dbcf7de8e97a3337fc63e2
/frameworks/base/cmds/statsd/src/matchers/matcher_util.h
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/matchers/matcher_util.h