726 Commits

Author SHA1 Message Date
TreeHugger Robot
3ce667a466 Merge "Add vendor-logged stats to statsd." into pi-dev 2018-03-14 05:35:03 +00:00
Andrew Chant
28d627e4be Add vendor-logged stats to statsd.
Add atoms to statsd that are logged by code residing in /vendor.
These atoms are reported from code in /vendor, and
rely on a vendor-provided /system daemon to log the atoms to statslogd.

Test: Built & reported manually.
Bug: 74261180
Bug: 74261750
Bug: 74258154
Bug: 74260998

Change-Id: I858a1266c4c212808fb63276439f1dd6cf2a387e
2018-03-14 05:34:47 +00:00
Howard Ro
a32913f087 Merge "Add a check for duplicate configuration on statsd" into pi-dev 2018-03-13 21:38:16 +00:00
Bookatz
3f5ab3ff1d Statsd: Remove storage of bucketNum
Past buckets had a field mBucketNum, storing the
"bucket number" they represented. Currently, the concept
of bucket number is used by Anomaly Detection (although this
may not be necessary), but these stored values are not used at all,
so removing them will save RAM.

Test: statsd tests still pass
Bug: 74607818
Change-Id: Iacc343bc39c5035f6e2f236c03de1d91606eff4c
2018-03-13 12:18:21 -07:00
yro
4490765d15 Add a check for duplicate configuration on statsd
Bug: 74349901
Test: statsd_test, manual testing of functionality

Change-Id: Ia4e3e51bfe61f5f773cecadda23e53d24b768dc8
2018-03-13 11:15:00 -07:00
Tej Singh
5d991e1f25 Atoms: Bluetooth
Adds atom defininitions for some bluetooth atoms.
Logging will go in aosp. ag/3668205 contained most of this change, but
is being split up and moved to pi-dev and aosp.

Bug: 74457175, 72320489
Test: build success on marlin
Change-Id: Ib14a74eabfab08bbae5d4d549244f1022e8c34f0
2018-03-12 21:03:22 -07:00
TreeHugger Robot
81cacb274c Merge "Statsd BroadcastSubscribers can receive 'cookies'" into pi-dev 2018-03-12 18:27:02 +00:00
TreeHugger Robot
9722ec74e0 Merge "Remove kPullerCooldownMap from code" into pi-dev 2018-03-12 18:25:00 +00:00
Yangster-mac
3fa5d7fb23 Add wall clock timestamp for ConfigMetricsReport and gauge atoms.
Fix the bug when serializing multiple atoms in gauge metric

BUG: b/74159560

Test: new test for ALL_CONDITION_CHANGES sampling method.
Change-Id: I6d33c1efbac92b6e13be2d64c323e090cb1f84aa
2018-03-10 22:25:28 -08:00
TreeHugger Robot
072a82abf3 Merge "statsd AnomalyDetection improvements" into pi-dev 2018-03-10 00:55:21 +00:00
Bookatz
423f753ea3 statsd AnomalyDetection improvements
Re-add check to make sure that bad config won't cause duration
anomaly detection to crash stastd

Bug: 74399947
Test: manual
Change-Id: Id175d233685c133ec3d4231272fe5708250dee6b
2018-03-09 11:09:51 -08:00
Bookatz
058d869826 Statsd BroadcastSubscribers can receive 'cookies'
Subscribers can now provide additional Strings that will be passed back to
it when an anomaly is detected. This way, the Subscriber can be informed
about anomaly-specific information has meaning to it.
Statsd itself does not use these strings and doesn't care what they are
- it simply passes them back to the subscriber.

Change-Id: If269872397c4ed2c67e41d54d850cdc664d4f73e
Fixes: 74012329
Test: run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert.BroadcastSubscriberTests
2018-03-09 10:44:48 -08:00
TreeHugger Robot
3ce208c1e9 Merge "Add team members in OWNER file" into pi-dev 2018-03-09 07:37:43 +00:00
yro
66781e1bf5 Add team members in OWNER file
Bug: 74415902

Test: no test necessary
Change-Id: I39d0a5cb9c6e8520fd29881442e66961096d52fc
2018-03-09 07:37:36 +00:00
TreeHugger Robot
7ad26e4bad Merge "Fix statsd crash due to bad bucket index" into pi-dev 2018-03-09 03:23:17 +00:00
TreeHugger Robot
ec66e9e726 Merge "Write data to file when StatsCompanionSerivice (system_server) crashes" into pi-dev 2018-03-09 01:18:27 +00:00
Yao Chen
b19425e011 Remove unused shared lib from statsd
Test: build statsd, and statsd_test

Bug: 72129300
Change-Id: I0ebff977dabe796799a0d41c64adb2c2f2e9035e
2018-03-08 14:38:12 -08:00
Bookatz
2fb5653b97 Fix statsd crash due to bad bucket index
Statsd crashes because predictAnomalyTimestamp requests past buckets
that occurred before time began. That's fine, but statsd needs to know
that the data before time began was 0 (instead of reading before the
beginning of the array and crashing).

AnomalyTracker's use of bucketNumbers is in general risky, and should be
auditted. But this cl will fix the current crashing.

Bug: 73825954
Test: Definitely necessary. Will write during audit.
Change-Id: I990ff134153f290d3089bfe3440d838f47996b63
2018-03-08 13:34:16 -08:00
Chenjie Yu
e05c8e7776 Remove kPullerCooldownMap from code
remove dead code

Bug: 74032852
Test: manual test
Change-Id: I0da74be21bab5842a89ede2a272094ba5ee33d80
2018-03-08 12:43:58 -08:00
yro
1cf2ac5241 Write data to file when StatsCompanionSerivice (system_server) crashes
Bug: 73352867
Change-Id: Iecbb1ae3e29264975771155a878b368cfc2f50f0
Test: statsd_test
2018-03-07 17:59:13 -08:00
Yangster
13fb7e4eea Statsd cpu optimizaton
- cache the changed dimensions in condition tracker.
- avoid query condition wizard when unnecessary.
- avoid copy dimension keys in condition key generation.

Test: statsd tests.

BUG: b/73959649
Change-Id: I17d68e2a82643de3f421309841e75f84c6fd8f43
2018-03-07 17:36:07 -08:00
Chenjie Yu
c8a6305ddf Merge "Refactor cpu stats pullers" into pi-dev 2018-03-08 00:24:00 +00:00
Chenjie Yu
ec67661bdf Refactor cpu stats pullers
use same cpu stats readers with BatteryStats so that
1) both throttle to avoid too frequent pulls
2) cached value is served within throttle interval to avoid double
pulling by both statsd and BatteryStats

To run unit tests:
bit
FrameworksCoreTests:com.android.internal.os.KernelUidCpuFreqTimeReaderTest
bit
FrameworksCoreTests:com.android.internal.os.KernelUidCpuClusterTimeReaderTest
bit
FrameworksCoreTests:com.android.internal.os.KernelUidCpuActiveTimeReaderTest

make -j56 statsd_test && adb sync data && adb shell
/data/nativetest64/statsd_test/statsd_test

Test: cts test, unit test
Bug: 73745189
Bug: 73780619
Bug: 73360959

Merged-In: I10a9bc91ca67fa812f4cd71c4fbd73c1a5ba580e

Change-Id: I10a9bc91ca67fa812f4cd71c4fbd73c1a5ba580e
2018-03-07 21:43:00 +00:00
Anton Hansson
d137c872cd frameworks/base: Set LOCAL_SDK_VERSION where possible.
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.

Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.

Test: make relevant packages
Bug: 73535841
Exempt-From-Owner-Approval: Global cleanup
Change-Id: I26458e41ecb84de91ac9a356a5d4bafb44f463c1
2018-03-07 11:42:04 +00:00
TreeHugger Robot
f9500e9c01 Merge "Atom: ResourceConfigurationChanged" into pi-dev 2018-03-07 00:41:35 +00:00
Tej Singh
a883b37fc0 Atom: ResourceConfigurationChanged
Logs when the configuration changes, such as when the screen orientation
changes. Logs information including font scale, screen width/height,
screen orientation, color mode.

Test: verified atom appears in adb logcat -b stats when screen
orientation changes.

Change-Id: Ifc3f3c62c5e386960b77d78f2ff2f17fc27db2b8
(cherry picked from commit 8a6df9290f82ee195ecc05df340035a82dc34a40)
2018-03-06 17:49:39 +00:00
Yi Jin
5ee0787024 Use uint64_t instead of long long as API type for consistent reason.
Bug: 74118023
Test: manual
Change-Id: Icd5f506c76d3a008a79cb6c9d2061962ca7fdd40
2018-03-05 18:18:27 -08:00
TreeHugger Robot
076eebfb3d Merge "Add #alerts to StatsdStats printout" 2018-03-05 05:43:44 +00:00
TreeHugger Robot
b603fb06ba Merge "Add API to let metrics directly drop data without writing to an output." 2018-03-02 23:38:21 +00:00
TreeHugger Robot
644e15d5bd Merge "Reduce statsd binary size from 730KB-> 664KB" 2018-03-02 19:41:56 +00:00
TreeHugger Robot
a793e50849 Merge "Add the MetricDimensionKey to the log when anomaly happens." 2018-03-02 19:12:18 +00:00
Bookatz
aea8d10b1e Add #alerts to StatsdStats printout
When print-stats is called, now #alert=0 won't always be 0.

Change-Id: If618c9a0890b45f7211f05853f4d97332d7f4cf1
Fixes: 73493830
Test: Manual confirmation
2018-03-02 10:37:24 -08:00
TreeHugger Robot
cbecb1a006 Merge "Add StateTracker." 2018-03-02 17:54:08 +00:00
Yao Chen
06dba5d79c Add API to let metrics directly drop data without writing to an output.
+ Metrics will do flushIfNeeded() to correctly move the clock and informing
  AnomalyTracker the past bucket info, and then clear past buckets.

+ We will still keep the current bucket data for the validity of the future metrics.

Bug: 70571383
Test: statsd_test
Change-Id: Ib13c45574974e7b4e82bd8f305091dc93bda76f5
2018-03-01 15:22:55 -08:00
Rajeev Kumar
51b54606d7 Create a pushed atom that gets logged when the ActivityManagerService detects that an app died.
Test: Manual
Bug: 73660232
Change-Id: I8e1fda35deb1e6876da0b6638fefea9f1b92b641
2018-03-01 13:28:31 -08:00
Yao Chen
99427efbe8 Add the MetricDimensionKey to the log when anomaly happens.
Test: statsd_test
Change-Id: I9454da23a95d106a6e70249bb26c04492fee9135
2018-03-01 13:03:38 -08:00
Yao Chen
580ea321b1 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
2018-02-28 16:57:03 -08:00
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