Commit Graph

83 Commits

Author SHA1 Message Date
Joe Onorato
758bc85bf7 Merge changes from topic "b_144187174"
* changes:
  Remove this TEST_MAPPING file until I can figure out what this error means
  Make libincident into a stable C API.
2020-02-06 03:09:52 +00:00
TreeHugger Robot
d27eec1829 Merge "Update StatsLogProcessor to handle BinaryPushStateChanged" 2020-02-05 19:15:29 +00:00
Joe Onorato
255ffff56d Make libincident into a stable C API.
Test: atest GtsIncidentConfirmationTestCases GtsIncidentManagerTestCases libincident_test
Bug: 144187174
Change-Id: I65b5a13cfb6a57aa56f738e25a76c5ecb8e7a1a8
2020-02-05 08:29:23 -08:00
Howard Ro
6269383520 Turn back to the old socket schema
Bug: 148909969
Test: GTS tests pass after this change (they fail otherwise)
Change-Id: Iee8d6506c4fb2fbf3acef474f9ee13df1b764c41
2020-02-04 21:53:40 -08:00
Jonathan Nguyen
a0e6de15df Update StatsLogProcessor to handle BinaryPushStateChanged
Also changed StatsLog to call write() instead of the hard coded function
in StatsService.

Test: gts-tradefed run gts-dev --module GtsStatsdHostTestCases
Change-Id: I26171fa4cfc877e1e179b74ec8076d964aff8548
2020-02-04 20:09:26 -08:00
Howard Ro
2688fe61c4 Merge "Turn on new socket schema" 2020-02-04 05:09:57 +00:00
Jeffrey Huang
88b313eb4a Merge "Delete unused imports in Statsd" 2020-02-03 17:42:39 +00:00
Muhammad Qureshi
af77b79ab6 Turn on new socket schema
This switches stats-log-api-gen to use StatsEvent.java and
stats_event.c/StatsLogCompat.cpp in generated StatsLog write methods.

Bug: 143979391
Test: m
Test: fastboot flashall
Test: atest CtsStatsdHostTestCases
Change-Id: I56f58d5545e51a0d7a34ec835110f5bc1b069d57
2020-02-03 02:22:48 +00:00
Jeffrey Huang
cabd127c19 Delete unused imports in Statsd
Delete libplatformprotos since its not used.

Test: m -j
Bug: 147599928
Change-Id: I80203756d714bf123978d26bbe81351a1abdc967
2020-02-01 10:41:43 -08:00
Jeffrey Huang
104249d5d5 Migrate SubsystemSleepStatePuller to jni
Bug: 148619050
Test: adb shell cmd stats pull-source 10005
Change-Id: I17f77bd95d65a2e48e776064028ade22188d4b0e
2020-01-31 14:11:02 -08:00
Jeffrey Huang
4c52716287 Migrate onDevicePowerMeasurement to JNI code
Formatted PowerStatsPuller with clang.

Bug: 148618655
Test: atest HostAtomTests#testOnDevicePowerMeasurement
Change-Id: I08c9a64ebaa469d94b1c72a85e8e44f9d8cb7cb8
2020-01-31 10:54:47 -08:00
Jeffrey Huang
43f4d26d41 Migrate HealthHal to StatsPullAtomService
Bug: 148618655

Test: atest HostAtomTests
Test: adb shell cmd stats pull-source 10019
Test: adb shell cmd stats pull-source 10020
Test: adb shell cmd stats pull-source 10030
Test: adb shell cmd stats pull-source 10045
Change-Id: I10a0682828b086751b90c3cc133fb51c34cbea23
2020-01-30 14:08:42 -08:00
Ruchir Rastogi
f60603ccd7 Delete CarStatsPuller class
The CarStatsPuller class is not needed because CarStatsService will now
directly register the VMS_CLIENT_STATS puller with StatsManager.

Test: m -j
Bug: 148123503
Change-Id: Icd46af829c8f559315f72feab1eda3b687c57148
2020-01-24 12:05:37 -08:00
Ruchir Rastogi
f9aa8d04bd Delete StatsCompanionServicePuller
Since pulls now go through StatsPullAtomService, instead of
StatsCompanionService, we no longer need the StatsCompanionServicePuller
class.

Test: m -j
Change-Id: Id7050fbda1118808aade0754747248b21c11b814
2020-01-21 17:16:51 -08:00
Jeffrey Huang
67ad2e7a55 Delete References to Statsd in StatsManager
Test: adb shell cmd stats pull-source 10000 (chosen randomly)
Change-Id: I9578f84213e6c2787da60ae7e2c20157087d5b6a
2020-01-17 13:28:27 -08:00
Alec Mouri
9724a45515 [SfStats] Remove puller implementation from statsd
Now that we're using statsd's C api, we can define the puller callback
in the surfaceflinger process directly.

Bug: 119885568
Test: builds
Change-Id: Ieb6a843c26cf7f19142e05cc170beedbd1af14d9
2020-01-09 09:25:41 -08:00
Jonathan Nguyen
804ce8e61e Merge "Move some libraries in statsd from shared to static" 2020-01-08 21:58:18 +00:00
Jonathan Nguyen
8896f8d626 Move some libraries in statsd from shared to static
Test: in progress

Change-Id: Ib07b22b485f232506b6ddcf8364c6fef374449b7
2020-01-08 11:08:25 -08:00
Muhammad Qureshi
2ee00fb249 Remove dependency on libutils in native autogen
Right now, Q schema generated code has a dependency on libutils.
Turning on R schema for clients will remove libutils as a required
dependency. Once libutils is removed from clients, turning the flag off
again will be complicated as all clients will need to re-include
libutils. To fix this problem, remove dependency on libutils in Q
schema.

Right now, we only use SystemClock.h from libutils in Q schema autogen.
Use timespec from C standard library instead.

Bug: 146808265
Test: m
Test: flashes successfully
Test: adb logcat "*:S statsd:*"
Test: bit statsd_test:*
Change-Id: I00efeab1be351a95083f3b6e2dbc9067849bee20
2020-01-02 14:54:39 -08:00
Anton Hansson
791551a70f Stop building against core_platform where possible
This is not a stable API surface, so modules shouldn't be building
against it. Compiling against core_platform also disables link-checking,
which can hide other problems.

Bug: 137191822
Test: m
Change-Id: I7ce7dad8c02b094c565daf8c178bc6f89bb610ef
2019-12-21 08:11:31 +00:00
Muhammad Qureshi
c8e226610c Move statsd metadata from statslog to atoms_info
Clients don't need to know about statsd metadata. Extract out metadata
from statslog.h/cpp into atoms_info.h/cpp which is only used by statsd.

Generated atoms_info.h: https://paste.googleplex.com/6303016724463616
Generated atoms_info.cpp: https://paste.googleplex.com/5717940978581504

Test: m -j
Test: old metadata in statslog matches the metadata in
atoms_info
Test: Flashes successfully
Test: adb logcat "*:S statsd:*"

Change-Id: I56ef3cc4ea1fbd2cd0130d4e9576b242efb9f627
2019-12-17 12:59:01 -08:00
Tej Singh
89817631b5 Puller API: Unit tests.
Tests 4 key things: A successful pull, a failed pull and two timeout
cases.

Timeout case 1: StatsPullerCallback should stop early and return true.
Timeout case 2: StatsCallback should note that the pull timed out,
notify statsd stats, and return false.

Test: bit statsd_test:*
Bug: 145310627
Change-Id: Id87089f04e1cf54a622b3f15585341ecdcd21f7f
2019-12-10 15:10:54 -08:00
Ruchir Rastogi
1fb525ecb0 Added tests for new socket parsing
New tests are guarded by NEW_ENCODING_SCHEME flag.

Test: bit statsd_test:* (passes both when the flag is turned on or off)

Change-Id: I429f478355e3e19941e4796706405ab0774e11d9
2019-11-26 11:43:42 -08:00
Ruchir Rastogi
1736ba467f First pass at parsing new socket encoding scheme
New parsing logic can be turned on using the DNEW_ENCODING_SCHEME flag.
Currently, we do not support parsing annotations or errors.

To simplify the LogEvent constructor, we remove the creation of
log_msg objects within StatsSocketListener. This change to the LogEvent
constructor also forced us to modify the LogEvent benchmarking code.

Test: m -j128
Test: bit statsd_test:* (passes when flag is off)
Test: atest StatsdHostTestCases (passes when flag is off)
Test: bit statsd_benchmark:*
Change-Id: I827b72f46a617dbc5194ad778fcf7c3d794efb7b
2019-11-26 00:12:16 -08:00
Tej Singh
6a5c94364c Statsd implementation of puller API
Internal implementation of the puller API. Registers pullers by putting
them in the kAllPullAtomInfo map. Implements the actual pull,
with condition variables to timeout.

Lastly, keys the kAllPullAtom info by a PullerKey, which is a uid and
atom id. However, the uid is just set to a default of -1 for now. I will
work the security implementation in a follow up CL.
Test: builds, boots
Test: I will write unit tests in the future. It's very difficult to
write any without StatsEvent being completed.

Change-Id: Id602dd297b6ba7df811e2d5ab2e77efc0684e418
2019-11-19 14:32:49 -08:00
Mark Tabry
9dc13578f7 Add AIDL interface and puller implementation for automotive devices.
Changes:
  - Adds hidden ICarStatsService AIDL API.
  - Adds CarStatsPuller for pulling atoms from ICarStatsService.
  - Pulls VmsClientStats via CarStatsPuller.

Bug: 141697665
Test: Manual testing on hawk using statsd_testdrive
Change-Id: I44e104d430f64b1bd3dce96e9749df79ab3d2fbf
2019-11-14 23:38:34 -08:00
tsaichristine
d21aacffed Take 2: Integrate StateTracker into statsd
Changes in this CL compared to previous StateTracker version:
- MetricsManager parses StatsdConfig for State information and updates
MetricProducers accordingly
- MetricProducer implements StateListener
- MetricProducer has a list of atom ids of its slice_by_states and any
state maps from these states. MetricProducers are responsible for
handling the conversion from original state value to mapped state value.
- More unit tests added and e2e CountMetric test added

Test: bit statsd_test:*
Bug: 136566566
Change-Id: I07ce468733a1affcadf2be0206e081fddbbce4c5
2019-10-14 16:04:00 -07:00
Tej Singh
a02bfab6cf Add bytes interface to LogEvent for pulled atoms
This adds a writeBytes interface to LogEvent for native pulled atoms,
which have been using write(string). The function still takes in a
string, but instead uses the write_char_array interface to avoid
stopping on null termination.

Test: modified tests and ran statsd_test
Test: statsd_testdrive 10055 to test against gpu app stats
Bug: 141965020
Change-Id: Iaedfb73310769165d8b61affb55e784f109355cf
2019-10-02 18:12:34 +00:00
TreeHugger Robot
9d9e19c5d3 Merge "[SfStats] Implement global atom puller for SfStats" 2019-09-25 20:15:13 +00:00
Alec Mouri
1dc5f1ed1b [SfStats] Implement global atom puller for SfStats
Bug: 119885568
Bug: 136597024
Test: adb shell cmd stats pull-source 10062
Test: statsd_testdrive 10062
Test: atest statsd_test
Change-Id: Ib113066faf67f6abba6cd377aaf1fe17cf16d4d0
2019-09-24 17:15:09 -07:00
tsaichristine
109786412e Add StateTracker classes
One shared StateManager object will manage all StateTrackers across all configs, maintaining a map of atom ids to StateTrackers.

StateManager is responsible for initializing and removing StateTrackers and notifying them of event or StateListener changes.

Each StateTracker maintains a list of StateListeners and is responsible for tracking state values to primary keys and notifying StateListeners when a state change occurs.

Test: bit statsd_test:*
Bug: 136566566

Change-Id: Icb61c668a01b611aa75caa7bdc2a6801c650b119
2019-09-19 10:39:18 -07:00
Ruchir Rastogi
23d60f94d1 Sort imports in statsd/Android.bp
Test: manual - checked that device booted up
Test: bit statsd_test passed
Change-Id: I1854202f64a1c526b6e80e94895e94c11dc5f902
2019-09-16 15:23:56 -07:00
Colin Cross
fe163c6f7d Merge changes from topic "protobuf-3.9.1"
* changes:
  Convert statsd_test and statsd_benchmark to proto lite
  Adapt to google::protobuf::uint64 type change
2019-09-06 18:01:08 +00:00
tsaichristine
c46fbf97a0 Rename old StateTracker
- The old StateTracker tracked state through a SimplePredicate defined
with only a "start" atom matcher that matched a state atom. This
StateTracker will be renamed StateConditionTracker to avoid confusion
with the new StateTracker.

Test: bit statsd_test:*
Bug: 136566566
Change-Id: I161aa463e83bd63d0fd52eb8579dab531f566dd5
2019-09-04 15:47:57 -07:00
Colin Cross
3f51ab5c82 Convert statsd_test and statsd_benchmark to proto lite
libplatformprotos for the device is compiled using proto lite, and
statsd_test and statsd_benchmark have protos that reference the
libplatformprotos.  With protobuf 3.9.1 compiling a full proto
against a lite proto doesn't work.  Convert them to lite.  Requires
adding the protobuf internal protos to the sources,
libprotobuf-cpp-lite does not contain the compiled version of
field_options.proto.

Bug: 117607748
Test: m checkbuild
Exempt-From-Owner-Approval: approved at https://android-review.googlesource.com/q/I0b101555ff604df17b2e3e06f3b3ce25adb1c9fb
Change-Id: I0b101555ff604df17b2e3e06f3b3ce25adb1c9fb
2019-09-04 12:48:41 -07:00
TreeHugger Robot
bcc0b1c2e2 Merge "Removed unused dependencies from statsd" 2019-08-22 20:33:13 +00:00
tsaichristine
7685337fe7 Remove dimensions_in_condition from statsd metrics
The dimensions_in_condition field is not used for any configs in statsd.
The functionality that it was intended to provide will be replaced by
StateTracker which is being tracked in b/136566566.

go/remove-dic contains background information on what was
removed/changed and why

Test: bit statsd_test:*
&& atest CtsStatsdHostTestCases
&& atest GtsStatsdHostTestCases

Change-Id: Ic328fa5fe027377380ba57363d9bc77985f18376
2019-08-22 10:03:33 -07:00
Tej Singh
7b306528c1 Removed unused dependencies from statsd
Deleting these did not cause a build error, so I do not think we need
them anymore.

Test: make statsd
Test: atest_statsd_test
Change-Id: If86365ae691b05c4922fe4edb07aad1ebf25e2d9
2019-08-21 15:54:27 -07:00
Elliott Hughes
5a12f19ee1 Remove perfprofd support.
This isn't finished, and no-one's working on finishing it.

Test: builds
Change-Id: I0406afadc0663ef3c07acafcdf40f76c9bba27bf
2019-07-12 13:18:54 -07:00
Paul Duffin
8fcace4404 Replace no_framework_libs: true with sdk_version: "core_platform"
(cherry picked from commit 7954524e3cc618830f0bf7b23687bf222ecd285b)

Bug: 134566750
Test: m
Change-Id: I0260942108a13cc5e9bed1d6005abfb8daffe0ac
Exempt-From-Owner-Approval: minor build change
2019-06-19 10:48:09 +01:00
TreeHugger Robot
d0ffaeb4b5 Merge "Handle condition changes when metric is not active." into qt-dev 2019-06-01 05:31:14 +00:00
Muhammad Qureshi
18e469298e Handle condition changes when metric is not active.
Treat metric activation like conditions as much as possible. Keep track
of condition changes even when metric is not active. Right now, we
ignore all condition changes if metric is not active.

This is a band-aid fix. Ideally, we should re-think how metric activation is
implemented and consider implementing it as a condition with a timebomb.

Bug: 130838341
Test: statsd_test
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t
android.cts.statsd.metric

Change-Id: I96bb7a7c6ee88359f310065e166f858be945eaff
2019-05-31 15:38:36 -07:00
Max Dashouk
11e0d40bbe Fixes the bug that can occur when StatsCompanionService calls
StatsService to update UID data and overflows kernel transfer buffer.

In this case, the IPC call silently fails. The issue was discovered in Android Automotive Embedded use case that employs multiuser setup. This causes more uid data being sent via one-way StatsCompanionService::informAllUidData call than usual and can trigger the issue. As the result, uid map on statsd side is empty and many metrics are not captured.

Bug: b/132444397
Fixes: b/132444397
Test: Did a clean build of master branch and flashed the device. adb
shell cmd stats print-uid-map returned without any result. Repeated the
steps after implementing the fix, print-uid-map returns the results now.

Change-Id: I1451c13b36696449c145c51618c68d10e29a596a
2019-05-23 20:53:58 +00:00
Yao Chen
e6cfb1417d Add a condition timer to track the duration of condition being true.
+ Plug it in ValueMetric as the frist step as we often need to normalize the values
  by the duration of condition being true.

  E.g., Coulomb counter drop / screen_on_and_on_battery_time

  Having a simple timer inside the metric will eliminate the need of creating
  another duration metric and joining them on server side.

Test: statsd_test
Fix: 130048020

Change-Id: Ie377dc6de917176ab07843e0dfd8506ed1d5db75
2019-04-09 19:21:12 +00:00
Yao Chen
0f861867c6 Make StatsLog drop less.
+ Create a thread-safe LogEventQueue to buffer log events.

+ The socket listner thread will read from socket and write to the buffer as quickly as possible
  to minimize the data loss in socket.

+ All pushed data is fetched from the the buffer and processed in a dedicated thread. After an
  event is fetched from the queue, we no longer block the socket listener thread.

+ Report event queue stats via statsdstats, including the min and max queue event history span in
  the queue (to understand how slow statsd can be and how fast the events can be)

Bug: 119031518
Test: unit tests added in statsd_test

Change-Id: I6b65ed9a678935b2e24302ba4b36e69c157adde4
2019-03-28 14:44:37 -07:00
Joe Onorato
99598ee6ee incidentd can now handle multiple callers asking it for incident reports
Test: bit incident_test:* GtsIncidentManagerTestCases:*
Bug: 123543706
Change-Id: I9f671dd5d8b2ad139f952a23e575c2be16120459
2019-03-26 11:20:48 -07:00
Yiwei Zhang
d476542338 Game Driver Metrics: add tests for GpuStatsPuller
Bug: 123529932
Test: atest GpuStatsPuller_test
Change-Id: I325f90d203539b51ee0a9deb2b048b8671e5e89a
2019-03-12 15:29:49 -07:00
TreeHugger Robot
55805af719 Merge "Add receiver info to IncidentdDetails in statsd_config" 2019-03-05 09:15:31 +00:00
Yao Chen
a8e78b9b88 Add receiver info to IncidentdDetails in statsd_config
This can be used for sending a broadcast to an app which incidentd
would share the incident report with.

Test: added unit test in statsd_test

Change-Id: Ieaf5b3b4d67168e2a99ff54e6392c77d8372ed4e
2019-03-04 23:47:27 -08:00
Yiwei Zhang
7e6330353e Game Driver Metrics: add GpuStatsPuller to get gpu global stats
Bug: 123529932
Test: adb shell cmd stats pull-source 10054
Change-Id: Ib43a93661d24ce0d4b1e1ae6b6d0b50dbdfd3c15
2019-03-01 22:43:32 -08:00