2 Commits

Author SHA1 Message Date
Yao Chen
5154a37930 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
2017-11-01 10:07:21 -07:00
Yao Chen
ef99c4fa23 clang-format existing code in statsd.
Added .clang-format, because there isn't an official .clang-format file for Android framework code.

before we upload changes, do:

clang-format -style=file -i [file list]

to format the files that you touched.

Test: formatting only. NO code changes.
Change-Id: I90e87f1ee6618da8ea9bc2221c609c415a4046a8
2017-09-22 16:26:54 -07:00