739 Commits

Author SHA1 Message Date
Yao Chen
20e9e6231a Reduce statsd binary size from 730KB-> 664KB
1. StatsdStats does not use the proto object in memory anymore.
2. lite_static -> lite
3. don't use sstream

Bug: 72129300
Test: statsd_test

Change-Id: I8a5adaf222d4d5034e8bf115215fb6dd5f042cac
2018-02-28 16:20:54 -08:00
TreeHugger Robot
6158952c30 Merge "Avoid reading logs that were processed before." 2018-02-28 19:37:05 +00:00
TreeHugger Robot
99e8972919 Merge "Add the option to match a whitelist of strings in FieldValueMatcher." 2018-02-28 04:50:17 +00:00
TreeHugger Robot
bb69f73a0c Merge "Atoms: Keygaurd and Bouncer" 2018-02-28 04:10:29 +00:00
TreeHugger Robot
f4405efb97 Merge "Add a comment to allocate field number above 100000 for OEMs to use and block them off from being used." 2018-02-28 03:15:46 +00:00
yro
a1fe77c6bd Add a comment to allocate field number above 100000 for OEMs to use and block
them off from being used.

Bug: 72866543
Test: statsd_test, cts tests
Change-Id: I2074f53eb3360aa93a9bea4e596a8c295696312f
2018-02-27 16:59:49 -08:00
Yangster-mac
539288806f Duration tracker optimization.
* Avoid querying sliced condition for stop/stopAll events for duration metric.
* Avoid extracting the internal dimension key when it is identical to the what dimension.

Test: statsd test
Change-Id: I664e8d3b1a68960d05c9ce4789caefb60b1ab502
2018-02-27 15:31:57 -08:00
Yao Chen
8f42ba0e2c Avoid reading logs that were processed before.
This could happen when statsd is disconnected from logd reader. When we reconnect, we are going to
get all events from the buffer again.

Bug: 72379125
Test: manual
Change-Id: Ie0122d5452555500c3bdfc1f905a0b1c646efdf7
2018-02-27 15:17:07 -08:00
TreeHugger Robot
03b91d77c4 Merge "Alarm: wakes up statsd and notifies the subscribers." 2018-02-27 23:08:31 +00:00
TreeHugger Robot
82d7883f05 Merge "Return when invalid config ID was provided through adb command and change the separator of config_uid and config_id to underscore from dash to disambiguate negative config ids" 2018-02-27 23:07:27 +00:00
Tej Singh
dd7bd35f30 Atoms: Keygaurd and Bouncer
Logs changes in the state of the keyguard and the keyguard bouncer

Test: verified logs appear in adb logcat -b stats
Change-Id: I1ffdf72ab088318c883197b3e1eb283bec2b8b2a
2018-02-27 14:54:00 -08:00
Yao Chen
9b1140eecd Add the option to match a whitelist of strings in FieldValueMatcher.
+ This is useful when we want to build Anomaly detection on wakelocks, but want to whitelist
wakelocks held by some apps that are whitelisted. It reduces the number of matchers needed
in such a config.

+ Also added the ability to match an AID by string name.

Bug: 73897465
Test: unit tests added.
Change-Id: I19315ae4d7d27fc467655d3a29866049cd8c9a2b
2018-02-27 14:52:31 -08:00
Yangster-mac
932ececa16 Alarm: wakes up statsd and notifies the subscribers.
Test: manually tested it.
Change-Id: Id796a68976aeb1611183023ba4e9c6a8b8c44bb8
2018-02-27 13:30:48 -08:00
TreeHugger Robot
f3537c2054 Merge "Updates jank metrics in statsd to include uid." 2018-02-27 20:47:33 +00:00
yro
255f72e73e Return when invalid config ID was provided through adb command and
change the separator of config_uid and config_id to underscore from dash
to disambiguate negative config ids

Bug: 73896814
Test: statsd_test
Change-Id: Ib0604e9f4c104560d570a64208a9e94d7526f8d6
2018-02-27 10:49:21 -08:00
TreeHugger Robot
dcd6ae8bc8 Merge "Atom: TemperatureReported" 2018-02-27 07:00:45 +00:00
Tej Singh
4029831e36 Atom: TemperatureReported
Makes the temperature reported atom pulled, and adds CPU, GPU, and SKIN
temperatures. Pulls information from the thermal hal.

Test: CTS test on cl in this topic
Change-Id: I0a8e2d1135bdd77e1cc510f24ff5214ce9e14ead
2018-02-26 20:55:26 -08:00
David Chen
77ef671c41 Updates jank metrics in statsd to include uid.
We need the uid to easily know which app to blame for producing the
frame with excessively long render time. Also updates the errors so
it's more obvious if the error is in parsing versus the other checks.

Test: Test that statsd builds and verified CTS test still passes.
Change-Id: Ib6518f2d9fe6f9c78d548b6dcbdb67a0f211ff5c
2018-02-26 17:18:20 -08:00
TreeHugger Robot
c4534e93e6 Merge "Fixes timebase used when dumping reports." 2018-02-26 23:18:57 +00:00
TreeHugger Robot
3b3d38d996 Merge "Avoid creating temporary objects in FiterValue()." 2018-02-24 10:13:19 +00:00
Yangster-mac
f520492279 Avoid creating temporary objects in FiterValue().
It reduces the cpu time from 1000ns to 750ns

Test: statsd test.
Change-Id: Ifa7e98e3368f8d55f85c7b09d05a6c416482981d
2018-02-23 20:53:23 -08:00
David Chen
926fc7571a Fixes timebase used when dumping reports.
We should be using elapsed realtime for most timestamps in statsd
so that the times can only increase monotonically.

Test: Test that statsd builds and unit-tests passes.
Change-Id: I0bb23e89aa9a6dbf6d56a0c23eec77bdd053f29b
2018-02-23 14:36:06 -08:00
TreeHugger Robot
7509bb3f97 Merge "Use android reinterpret hash for float as it is faster." 2018-02-23 21:20:20 +00:00
Zhi An Ng
c9b2722cb8 Merge "Revert "Revert "Log the apk optimization state in the MetricsLogger""" 2018-02-23 21:15:32 +00:00
Yangster-mac
16b7ff735e Use android reinterpret hash for float as it is faster.
Test: statsd test
Change-Id: I593edac1d7dcd0c5e84195602b42b7c6c3072a38
2018-02-23 11:11:36 -08:00
TreeHugger Robot
193fe201da Merge "Statsd alerts can inform subscribers probabilistically" 2018-02-23 18:50:16 +00:00
Calin Juravle
759fbda51b Revert "Revert "Log the apk optimization state in the MetricsLogger""
This reverts commit 203a9ab7665787c94f7d0711a1ad172588070aa6.

Reason for revert: Fix the original issue. There was a race with the
cleanup method which was resetting the app record to null.

Test: manual, adb logcat -b events | grep sysui_multi_action
      repeat steps from bugreport reporting the crash
Bug: 73102540

Change-Id: I6d9c6110a9d5dadeb9d4361592711d63563c958a
2018-02-22 16:53:48 -08:00
TreeHugger Robot
868688ed16 Merge "Add annotation to atoms that represent a state change in atoms.proto" 2018-02-22 05:36:45 +00:00
TreeHugger Robot
f9f44c954b Merge "Statsd anomaly output log fix" 2018-02-22 03:13:04 +00:00
Yao Chen
9c1debe330 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
2018-02-21 16:46:56 -08:00
Bookatz
32f2d4f320 Statsd anomaly output log fix
Alert.id() is signed, so the output line needs to be lld instead of llu.

Test: none
Change-Id: I7e3eeddac60931234285548b99a9c9cc78582716
2018-02-21 14:30:51 -08:00
Yangster
e1faa03b48 Fix the bug of timestamp encoding in event metric report.
Test: statsd cts tests
Change-Id: Id1d330f5d48d15ba026ae7c7e8cf4e1f6b460fba
2018-02-21 14:08:17 -08:00
Howard Ro
32bdf16288 Merge "Remove relevant configs when a uid (app) is uninstalled" 2018-02-21 21:12:41 +00:00
yro
019240235f Remove relevant configs when a uid (app) is uninstalled
Bug: 72267831
Test: statsd_test
Change-Id: I6ed29baba39b83f771629131af66b39ccc9cc130
2018-02-20 18:20:49 -08:00
TreeHugger Robot
3d7f2d40d4 Merge "Adds anomaly detection to max duration metrics." 2018-02-20 23:38:00 +00:00
TreeHugger Robot
81198c7332 Merge "Fix bug in edge case for statsd anomaly tracking." 2018-02-20 22:56:02 +00:00
David Chen
2e414b99f4 Adds anomaly detection to max duration metrics.
Statsd supports anomaly detection for max duration, which is
conceptually like asking for an anomaly on the current duration.
There was a bug previously in the logic for max duration since we
recorded a duration every time a dimension went into pause. Now, we
only record a max duration when the dimension goes into stop.

When a dimension inside the MaxDurationTracker leaves the started
state, we need to check if we still need to keep an anomaly alarm
set. It's possible that we just immediately set an alarm with the
same timestamp as what was just deleted.

Test: Added some unit-tests and tested on marlin-eng.
Change-Id: I09c82cd266b4cc6e1c893ad166e602bf08baca0e
2018-02-20 13:45:25 -08:00
David Chen
ebe7e237a6 Fix bug in edge case for statsd anomaly tracking.
Getting a past bucket value will always crash for anomalies
configured to track only the most recent one bucket.

Test: N/A
Change-Id: I2cd1c82fe8ba4cecb4fac21038bb5f04a60c360e
2018-02-20 13:22:53 -08:00
TreeHugger Robot
581ff5ec0d Merge "Timestamp Truncating whitelist." 2018-02-20 20:41:29 +00:00
Narayan Kamath
28ff9ceeeb Merge "Revert "Log the apk optimization state in the MetricsLogger"" 2018-02-20 18:17:34 +00:00
Narayan Kamath
203a9ab766 Revert "Log the apk optimization state in the MetricsLogger"
This reverts commit 0a8bea818c330d02161322901534992253a2f9ee.


E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: ActivityManager
E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.android.server.am.ProcessRecord.requiredAbi' on a null object reference
E AndroidRuntime:        at com.android.server.am.ActivityMetricsLogger.logAppTransition(ActivityMetricsLogger.java:504)
E AndroidRuntime:        at com.android.server.am.ActivityMetricsLogger.access$100(ActivityMetricsLogger.java:62)

Bug: 73626352
Change-Id: Idd50e0d2cf34e5393b4ae76ef8bc48b0067532eb
2018-02-20 17:06:21 +00:00
Calin Juravle
6e24ac8948 Merge "Log the apk optimization state in the MetricsLogger" 2018-02-19 19:36:08 +00:00
Chenjie Yu
ae9fdf0403 fix picture-in-picture logging
+ log uid and activity name

Test: manual test. Will add cts test
Change-Id: I3d3e77b24779e439eacc06007fae62c037a19fd6
2018-02-18 00:08:01 -08:00
Yangster-mac
d5c356214f Timestamp Truncating whitelist.
Test: manually tested.
Change-Id: I46da375b6c0773ffc611bc06fff12cb4f9a7fc18
2018-02-17 21:11:54 -08:00
Bookatz
12c1270f8b Statsd alerts can inform subscribers probabilistically
The config can specify that when an alarm fires the relevant
subscriber is only informed with some probability. This allows
only a fraction of firings to trigger the subscriber's action.

Bug: 73287237
Test: none yet

Change-Id: I365faad8ffd1b40b01782c1d761b1c0e09c7c299
2018-02-17 18:58:25 -08:00
Calin Juravle
0a8bea818c Log the apk optimization state in the MetricsLogger
Log the apk optimization state for app transition events. This will allow
precise measurement of the events based on the level of optimizations
performed.

Test: manual, adb logcat -b events | grep sysui_multi_action
Bug: 73102540
Change-Id: Ia8ccddff4ebe4120e05bb5d1dfb1cd458fa61e8a
2018-02-16 15:46:14 -08:00
Rajeev Kumar
334899b0d8 Merge "Implement atom puller for ProcessMemoryState." 2018-02-16 21:52:22 +00:00
TreeHugger Robot
0f888de06b Merge "Resupport long compare" 2018-02-16 17:31:42 +00:00
TreeHugger Robot
3b9999edca Merge "Adds locks to ConfigManager in statsd." 2018-02-16 17:30:43 +00:00
TreeHugger Robot
a9e43fa9b7 Merge "Remove a statsd duration anomaly sanity check." 2018-02-16 17:28:32 +00:00