816 Commits

Author SHA1 Message Date
Yao Chen
59cc0a2237 Fix UidMap proto output error. And fix a bug in MaxDurationTracker.
Bug: 76118312
Bug: 76145379

Test: adb shell cmd stats dump-report
      statsd_test
Change-Id: I9a987525df5b37fcefd5f28700bfa1c3952f6692
2018-03-22 09:07:03 -07:00
TreeHugger Robot
dcccfd9742 Merge "ScheduledJobStateChanged: add stop reason" into pi-dev 2018-03-22 01:30:52 +00:00
Yao Chen
1aa00024fa Fix the heap-after-use in DurationAnomalyTracker
Bug: 74531081
Test: cts
Change-Id: I21a50944a119b7576c76fd25fae23b9c2d8d96ab
2018-03-21 17:04:34 -07:00
Yao Chen
461a75f269 Remove unsigned-integer-overflow signed-integer-overflow from sanitizer.
Sanitizer is picking on the protobuf generated code. Need to figure out why
Disable them to unblock development first.

Bug: 76117312
Test: manual
Change-Id: I3f3a39dfe933f4c1b1cf4063d621392b66f0adea
2018-03-21 16:38:26 -07:00
Yao Chen
fef48cb64c Fix StorageManager stack use after scope.
Bug: 75968524
Test: CTS
Change-Id: I2fd81a21452b26d8c9239d7aeddd4907b9618179
2018-03-21 14:44:34 -07:00
TreeHugger Robot
dc5677336c Merge "Enable sanitizer on statsd eng build." into pi-dev 2018-03-21 20:09:10 +00:00
Yao Chen
cd7f90053d Enable sanitizer on statsd eng build.
Bug: 74946342

Test: manual
Change-Id: I287def435d077670814db50e4d8398ecee539b74
2018-03-21 11:04:37 -07:00
TreeHugger Robot
8512630f8b Merge "Allow statsd to be given empty config." into pi-dev 2018-03-21 05:34:16 +00:00
Howard Ro
e51af37475 Merge "Fix recovery of stats data from previous input while using ProtoOutputStream" into pi-dev 2018-03-21 00:31:23 +00:00
TreeHugger Robot
0421c2cf8f Merge "Fix pulling interval may become 0 in cts" into pi-dev 2018-03-20 23:31:24 +00:00
David Chen
9fdd40302e Allow statsd to be given empty config.
Statsd clients may want to set an empty config temporarily, so it's
more convenient to allow them to set an empty config instead of
having to use the removeConfig and then having to remember to call
StatsManager#setDataFetchOperation.

Test: Added unit-tests and check they pass on marlin-eng.
Bug: 74997752
Change-Id: I2e762e5ec01e5a2c9a3469fb330b53fefbd734d6
2018-03-20 15:56:11 -07:00
yro
4beccbe3de Fix recovery of stats data from previous input while using
ProtoOutputStream

- Specify the length of message to avoid libprotoutil from thinking that
we are trying to write bool
- We only attach the previous dump file to the upload file where config
key matches
- Store ConfigMetricsReport (instead of ConfigMetricsReportList) onto
disk
- Stop use stack after scope in StorageManager
- Migrate UidMap to use ProtoOutputStream and renaming variables to
prevent confusion

Bug: 74021554
Bug: 75968524
Test: manual test, statsd_test, CTS tests
Change-Id: Iedf52633d7f5b985f5a934a3fb5a0c3c3b2e7fd1
2018-03-20 15:00:59 -07:00
TreeHugger Robot
039deb4390 Merge "Moves the settings changed logging for statsd." into pi-dev 2018-03-20 20:30:31 +00:00
Tej Singh
33a412b52d ScheduledJobStateChanged: add stop reason
Adds stop reason to scheduled job state changed

Bug: b/71755130
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.UidAtomTests#testScheduledJobState
Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCases -t com.android.server.cts.JobSchedulerIncidentTest
Change-Id: Ic29a5e9160ac258140a52d31bc6210300949545d
2018-03-20 11:20:58 -07:00
TreeHugger Robot
aed0fed078 Merge "Add uid field annotation in atoms.proto and statd memory usage optimization." into pi-dev 2018-03-20 17:12:25 +00:00
David Chen
bd78991bc6 Moves the settings changed logging for statsd.
Previously, we wrote a log entry regardless of permission checks, so
the logging could be misleading. Now we only send the log to statsd
after verifying that this setting mutation is valid.

Test: Flashed onto marlin-eng and verified stats-log as expected.
Bug: 73493944
Change-Id: I2a8b052aa8c380ffc5d15caec089fffcdc5823f4
2018-03-19 17:11:03 -07:00
TreeHugger Robot
9859c29a8f Merge "Fix a UidMap crash." into pi-dev 2018-03-19 23:07:06 +00:00
TreeHugger Robot
dba47fcd09 Merge "Atoms: Mobile Connection" into pi-dev 2018-03-19 20:45:55 +00:00
Yao Chen
34900c3b4d Fix a UidMap crash.
Bug: 75968717

Test: CTS with sanitizer
Change-Id: I9516d3b59f72816159c9fc1fe75ca64bfe21d799
2018-03-19 13:43:29 -07:00
TreeHugger Robot
f5de606f51 Merge "Deletes default allowed_log_sources in statsd." into pi-dev 2018-03-19 18:14:18 +00:00
Chenjie Yu
83baaa1212 Fix pulling interval may become 0 in cts
If the bucket size is lower than 1 min, the interval should be at least
1 min.

Bug: 74533948
Test: cts
Change-Id: Icb72579367cd12d3f475c7e2935b98c0ebc66419
2018-03-19 10:41:35 -07:00
Tej Singh
eee317b7b6 Atoms: Mobile Connection
Atom definitions for MobileConnectionStateChanged and
MobileRadioTechnologyChanged

Also cleans up batterystats.

Bug: b/72320589
Test: verified logs appear in adb logcat -b stats
Change-Id: I9feb258cf6dd4a8c8bf1cffc9566b5d0a851a9fa
2018-03-19 09:48:22 -07:00
TreeHugger Robot
790befca1d Merge "Delete TODO about renumbering statd atoms" into pi-dev 2018-03-19 05:54:22 +00:00
TreeHugger Robot
ad121b9fdc Merge changes I3ffb6e97,I689df136,Ia67a8eb6 into pi-dev
* changes:
  Statsd: remove DurationAnomalyTracker.resetStorage
  Statsd AnomalyDetection stopAlarm also checks old
  Statsd AnomalyDetection improvements
2018-03-19 05:49:27 +00:00
Bookatz
555ad97637 Delete TODO about renumbering statd atoms
Test: none
Bug: 72553942
Change-Id: If59ee407dffaed713a3a2f7543314aef3e70ef2c
2018-03-16 15:47:57 -07:00
Bookatz
6a1d3af7f5 Statsd: remove DurationAnomalyTracker.resetStorage
The explicit resetStorage function in the subclass isn't needed.
It does exactly what its superclass does.
The previous check for !mAlarms.empty() was actually not needed, since
there can be legit cases where !mAlarms.empty() (namely, when the
mMostRecentBucket is moved forward initially - we may call reset, but we
still want the old alarms to remain).

Test: still pass
Change-Id: I3ffb6e97c02b75170c246f57d55ccf59cd368b9c
Fixes: 74607818
2018-03-16 15:25:49 -07:00
Yao Chen
c40a19d2e4 Add uid field annotation in atoms.proto and statd memory usage optimization.
[memory]
  statsd binary size from 664k -> 600k
  memory usage 1978k -> 1813k (with no configs)
  + Avoid initialize any static map in statslog.h to avoid many copies of the map in each include.
    - Do it in cpp so that it is initialized only in places that use them

[Uid annotation]
+ Uid annotation is needed for extracting uid from dimension for UidCpuPuller.
+ After the change, stand-alone uids don't need to be in field 1 anymore.
+ Also added exclusive bit annotation in AppDied
+ Currently only allow one uid field in an Atom. This is to keep things simple until
  we find an exception.

Test: statsd_test
Bug: 73958484
Bug: 72129300

Change-Id: I8a916d5c00d5930e24ae7e0825a57dea19c0e744
2018-03-16 13:56:38 -07:00
Bookatz
3e8cd35b55 Statsd AnomalyDetection stopAlarm also checks old
Every time stopAlarm() is called, it should also,
right then, check to see if the alarm should actually
have already fired (but didn't due to AlarmManager lag).
Right now, the client needs to do this check separately,
but they always go together. Indeed, MaxDurationTracker
forgot to do the check, which is a bug. It would make
much more sense if the stopAlarm takes care of it for
them, to prevent such mistakes.

Bug: 75273733
Test: make statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert
Change-Id: I689df13690df822090ac34b1171e948be1ad0d9f
2018-03-16 13:23:19 -07:00
Bookatz
6bf9825b15 Statsd AnomalyDetection improvements
Various fixes and improvements to statsd's anomaly detection.

Bug: 74607818
Test: make statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test

Change-Id: Ia67a8eb6da0ea9293f698949e1565f7f024a7cb9
2018-03-16 11:34:21 -07:00
David Chen
8faaa01489 Deletes default allowed_log_sources in statsd.
We should fail right away if someone forgets to set this field
instead of setting default values since this may lead to hard to
explain bugs in the future (eg, why isn't systemui logging an atom
to a config).

Bug: 74608359
Test: Verified unit-tests still pass on marlin-eng.
Change-Id: Ibd8a6ccbc5cc8d2dfb8a1577c64bf9b49822a2c3
2018-03-15 17:45:58 -07:00
David Chen
f384b90049 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
2018-03-15 13:33:04 -07:00
TreeHugger Robot
a825c8ee5d Merge "Support slicing by chain." into pi-dev 2018-03-15 02:27:15 +00:00
TreeHugger Robot
8568931d6f Merge "Add stats from storage manager to dumpsys result" into pi-dev 2018-03-14 23:05:33 +00:00
Yangster-mac
e06cfd777a Support slicing by chain.
BUG: b/73975181

Test: statsd test
Change-Id: I913ae0f68ff21ed0703bb5da9c60d3eaa3bf5981
2018-03-14 15:36:24 -07:00
yro
665208d743 Add stats from storage manager to dumpsys result
Bug: 74601313
Test: manual test, statsd_test
Change-Id: Ifdde6bb10d29f3983b0c27a66a6e30f1f40308ee
2018-03-14 12:46:27 -07:00
TreeHugger Robot
c7ce1a0978 Merge "Add wall clock timestamp for ConfigMetricsReport and gauge atoms." into pi-dev 2018-03-14 19:03:06 +00:00
TreeHugger Robot
a9e73469c5 Merge "Remove unused shared lib from statsd" into pi-dev 2018-03-14 18:48:20 +00:00
TreeHugger Robot
aaadf6663f Merge "Statsd: Remove storage of bucketNum" into pi-dev 2018-03-14 16:51:41 +00:00
TreeHugger Robot
dc8e7fa0ae Merge "Dump the stats for count/gauge/value metrics." into pi-dev 2018-03-14 16:45:49 +00:00
Yangster-mac
a78d00874d Dump the stats for count/gauge/value metrics.
Bug: b/74159560

Test: statsd test
Change-Id: I1410309ecfdfc2a5becf8d0c620c68a621ebc5fa
2018-03-14 16:45:37 +00:00
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