Commit Graph

85 Commits

Author SHA1 Message Date
Nick Desaulniers
fceda70a03 statsd: fix -Wreorder-init-list
C++20 will require members in a designated initializer to be in order
unlike C99.

Bug: 139945549
Test: lunch flame-userdebug && mm
Change-Id: I8260ee03b0e6d98fdbe42ebf38bbc9f216303efe
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-11-21 12:23:57 -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
Nick Desaulniers
8bbeb4db27 Merge "[frameworks][base][statsd] fix -Wreorder-init-list" am: 00ae277630 am: 8208b201ca am: 45129d073e
am: 6425745177

Change-Id: Ia55d8b88ec2970478eb60eae92d8d2755124e4f1
2019-10-11 09:57:38 -07:00
Nick Desaulniers
691e1a093c [frameworks][base][statsd] fix -Wreorder-init-list
C++20 would like members of designated initializers to be ordered, so
that initialization side effects match member initialization in explicit
constructors. This differs from C99.

Bug: 139945549
Test: mm
Change-Id: Iadc96f8f0bf57181970ca3e96b5c5f68ac40a030
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-10-10 13:08:34 -07:00
Rafal Slawik
203c3dbde9 Cleanup: remove old memory atoms
Memory stats has been migrated to ProcessMemorySnapshot. This CL cleans
up the old atoms:
- remove telemetry-specific additions to ProcessMemoryState
- remove NativeProcessMemoryState atom
- move reading process cmdline under stats

Bug: 140986627
Test: atest MemoryStatUtilTest
Test: atest ProcfsMemoryUtilTest
Test: atest UidAtomTests#testProcessMemoryState
Change-Id: I5339577184d17e5cef6d657cf9b08a2fb8e75fca
2019-09-26 16:39:13 +01: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
Rafal Slawik
7efcefb5d7 Add ProcessMemorySnapshot atom
Introduce new atom to replace existing ProcessMemoryState and
NativeProcessMemoryState ones for telemetry purposes.

This change is the first step to decouple memory stats from the
framework internals. Follow-up CLs will remove the telemetry parts
from the existing atoms.

Test: atest ProcfsMemoryUtilTest
Test: statsd_testdrive 10064
Change-Id: I7959c6e473201c10e7da17fa49d864bb03a2403c
2019-09-23 12:23:43 +01:00
Rafal Slawik
6d44d6dafa Add atom for per-process system ion heap size
The pulling code will be added in the next commit.

Bug: 130526489
Test: statsd_testdrive
Change-Id: I0fea4b6a7a8dbbdc574fb342c1e07aa0165bf797
(cherry picked from commit 77987ed47f)
2019-06-24 09:54:42 +00:00
Rafal Slawik
77987ed47f Add atom for per-process system ion heap size
The pulling code will be added in the next commit.

Bug: 130526489
Test: statsd_testdrive
Change-Id: I0fea4b6a7a8dbbdc574fb342c1e07aa0165bf797
2019-06-18 11:32:29 +01:00
Martijn Coenen
cd95d4613f Atom and puller for historical AppOps.
This atom contains information about historical AppOps performed by
applications.

Bug: 128925078
Test: builds
      adb shell cmd stats pull-source 10060

Change-Id: Iaaec0987712779e2062139d3ad0e2d4544d4d45f
2019-05-14 14:05:04 +02:00
Rafal Slawik
44af3b3202 Monitor swap
Pull value of VmSwap from /proc/PID/status when capturing
ProcessMemoryState atom.

Before change:
(average pull time nanos) 43355896
(max pull time nanos) 75649278

After change:
(average pull time nanos) 86307073
(max pull time nanos) 151681474

Delta: 2x increase
Pulling frequency is controled via statsd and we trade-off more
expensive reads for more actionable data (helping detect memory leaks).

Bug: 130624561
Test: atest MemoryStatUtilTest
Test: benchmark pulling ProcessMemoryState atom
Test: manually take a statsd report
Change-Id: I1d90563b70b5253b3d31ddab4810db870620c4d4
(cherry picked from commit 65a9b7122a)
2019-04-19 06:13:27 +00:00
Maggie White
442b6314e5 thermal: Add pulled cooling device atom and a field to Temperature atom
Bug: 119688911
Test: adb shell cmd stats pull-source 10058
Test: adb shell cmd stats pull-source 10021
Test: Injected artificially high temp via emul_temp
Change-Id: I1afe53380a38f342d7f59e0c61c487e05be31d85
Signed-off-by: Maggie White <maggiewhite@google.com>
2019-04-15 11:35:04 -07:00
joshmccloskey
34c1f8e929 Adding Face Setting Stats.
Test: Verified that fields are set.
Bug: 128349976
Change-Id: I49b30401ebf3063adf7d137ff40505d6504226ab
2019-04-12 12:45:18 -07:00
Tej Singh
de473b5138 Fix puller callback with gauge/value metric
Allows gauge/value metrics to work with pulled atoms that were
registered after the config was received.

Test: gts
Bug: 130314103
Change-Id: I9cddd28efd464d8bb78da868d8c0d850ffb0235c
2019-04-10 20:41:59 -07:00
Carmen Agimof
a769c156c1 Pull info about apps installed on external storage.
Bug: 123688171
Test: Manually tested using statsd_testdrive script
Change-Id: Ie47c69c1177d77993907d7ff8ef52691a0c2eaef
2019-03-27 14:36:23 +00:00
Carmen Agimof
12dec126d3 Change the pulled atom SDCardInfo to ExternalStorageInfo so that we log
information about all types of external storage (e.g. USBs).

Bug: 123688171
Test: Manually tested using statsd_testdrive script
Change-Id: I4bc7c43bb7f5ee9dee3989eb724d05c4d350aff2
2019-03-18 21:14:42 +00:00
Rafal Slawik
93fc5bb44a Merge "Pull system ion heap size." 2019-03-14 11:53:55 +00:00
Yiwei Zhang
4fb9289a18 Game Driver Metrics: get gpu app stats with GpuStatsPuller
Bug: 123529932
Test: adb shell cmd stats pull-source 10055
Change-Id: I04320221de6ac457acd0b0533a05ce2f8dfbdde0
2019-03-12 14:53:04 -07:00
Rafal Slawik
d4e8757fb6 Pull system ion heap size.
Test: m -j
Test: atest MemoryStatUtilTest
Bug: 128412961
Change-Id: I9a12b03ef92d0df067253fee5165107586bdad54
2019-03-12 15:47:35 +00: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
Carmen Agimof
35f7f6f3ed Pull sdcard mounted atom.
Change-Id: I334fef334b67e94ee040026880ffbec2803b9982
Bug: 123688171
Test: Manually tested using statsd_testdrive script
2019-02-15 17:53:36 +00:00
Neil Fuller
db14b487b0 Add an atom for TimeZoneDataVersion
The atom records the tzdb version in use on the device
as reported by the public SDK ICU APIs.

Test: build / boot
Bug: 119010737
Change-Id: Ifa2bed2eabf192da7adbc29b064cbb41f85f9ba7
2019-02-14 17:14:20 +00:00
Chenjie Yu
97dbb206de TrainInfo persist onto disk
+ TrainInfo puller

Bug: 122807604
Test: will add gts
Change-Id: Iac9576ba0edc235dc117950f92bc7d7a8ad75ca8
2019-02-13 17:42:35 -08:00
Tej Singh
a0c89dd5b6 Statsd Puller Callback Registration
Creates a hidden api to register puller callbacks for vendor atoms.

Test: manual local test
Test: statsd unit tests
Bug: 119898637
Change-Id: Id28817b8fc718e128adc4e1c6b2e997db84517f9
2019-02-11 14:24:03 -08:00
Olivier Gaillard
2a464632d0 Merge "Unify the way we process events on condition change and bucket boundaries." 2019-02-08 13:33:10 +00:00
Olivier Gaillard
11203df2a2 Unify the way we process events on condition change and bucket
boundaries.

- We now always process empty data and events that exceeds the max delay
in a consistent way

- Fix one bug which caused base data not to be reset, e.g.
bucket h+1 on condition change to true, we pull the following data (key A / value 1, key B / value 2)
bucket h+2 on bucket boundary, we pull the following data (key A / value 2)
In this case the previous code, did not reset Key B. It should be reset
since it is not present in the most recent data.

Test: atest statsd_test
Bug: 124046337
Change-Id: I19456bbe1529e72befbb621be185ce24bd65077a
2019-02-08 11:43:40 +00:00
Kevin Chyn
fce424f854 Merge "Update puller method to support other modalities" 2019-02-08 07:21:27 +00:00
Olivier Gaillard
c5f11c4006 Reset the base when pull fails.
Without resetting the base, we will compute the wrong diff when we have
a condition change.

Move the responsability of handling failures to the PullReceivers. This
is more consistent with #onConditionChanged which does handle the
failure cases.

We also always compute nextPullTimeNs in order to only call onDataPulled
on bucket boundaries. The current code does not update nextPullTimeNs
which means a new alarm might trigger a pull and onDataPulled in the
middle of the bucket. The behavior in this case is undefined.

Bug: 123181864
Test: atest statsd_test
Change-Id: I0910b7db26a0de764436c46c8d7d11cafa52dcd9
2019-02-06 12:49:07 +00:00
Philip P. Moltmann
f21a350d23 Pull dangerous permission state as atom
Pull all state for all dangerous permissions of all apps.

Test: adb shell cmd stats pull-source 10050
      atest CtsStatsdHostTestCases:android.cts.statsd.atom.UidAtomTests#testDangerousPermissionState
Bug: 123661303, 123594188
Change-Id: I4060282f58220ea514b13865d7cad04e10af90e4
2019-02-01 10:59:24 -08:00
Philip P. Moltmann
4ef7a11a67 Merge "Pull all current role holders into statsd" 2019-01-30 22:20:24 +00:00
Philip P. Moltmann
70b42ae8ee Pull all current role holders into statsd
Create a new atom RoleHolder that maps a uid -> role and add the
mappings that currently exist in RoleManagerService

Test: - ./out/host/linux-x86/bin/statsd_testdrive 10049
      - adb shell cmd stats pull-source 10049
Bug: 123594188
Change-Id: Ib0fa60b07a95c06a219f3e3b37d51f59b624a017
2019-01-29 21:04:49 -08:00
Misha Wagner
1eee22107f Add more statistics on failure cases for value metrics
This adds to PulledAtomStats and creates a new stats atom AtomMetricStats.

Test: none
Bug: 123572169
Change-Id: Ifea682005210a6342a027643e162f8ce7785cb06
2019-01-29 16:44:30 +00:00
Kevin Chyn
6ecc570bc3 Update puller method to support other modalities
Bug: 120161047
Bug: 117060268

Test: Builds
Change-Id: Ieaeadbb32b2b3a7aa2436ca2328a8f9c56e79d62
2019-01-28 12:00:37 -08:00
Kevin Chyn
1741a07f4e Update Biometric Atoms
Framework will add logging in the next CL

Bug: 120161047
Bug: 117060268
Bug: 121072756
Bug: 121071984

Test: Builds

Change-Id: I673d8af8be78be11b5eac249c47847ebeca2cd2e
2019-01-26 21:53:00 -08:00
Olivier Gaillard
18d4522058 Add pullers for debugging.
These pullers return deterministic values so we'll be able to confirm
to validate the data easily server side locally.

For instance,
- the diff of the elapsed_clock_millis field should always be equal to the bucket size
- the diff of pull_count should always be one unless we hit the cache

Test: manual
Change-Id: I4fab30df287e90f8691740d90d87b67022b9c420
2019-01-25 18:30:01 +00:00
Tej Singh
e765dc6e5f Merge "Statsd uses ThermalService to pull temperatures" 2019-01-24 06:10:13 +00:00
Maggie White
8735b85958 statsd: Add BatteryCycleCount atom
The health HAL specifies a charge cycles path that currently has no
atoms allocated to it. This change will allow statsd to collect this
information. I also ran 'clang-format -i --style=file' on this file.

Bug: 120680509
Test: cts-tradefed run singleCommand cts-dev -m CtsStatsdHostTestCases \
      -t android.cts.statsd.atom.HostAtomTests#testBatteryCycleCount
Test: adb shell cmd stats pull-source 10045
Change-Id: I796b275c5d6880e9d7ec5bc468b55d7dc421ac78
Signed-off-by: Maggie White <maggiewhite@google.com>
2019-01-18 17:24:15 -08:00
Tej Singh
9876a3bc5b Statsd uses ThermalService to pull temperatures
Make statsd use thermal service to pull temperature events. This way we
do not have to directly use thermal hal and manage multiple versions.

Test: adb shell cmd stats pull-source 10021 on blueline-userdebug
Received 8 CPU temps, 2 GPU, 1 skin, 1 battery, 1 usbc, and 1 NPU
Numbers looked reasonable: CPUs were at ~35C, GPU at 34-35, battery at
28, skin at 30, NPU was higher at 43.
Bug: 119228310

Change-Id: Id84b7855bfb91d0439d856a30ad4e40a087f2d4f
2019-01-11 15:25:42 -08:00
Chenjie Yu
0bd73dbaac Puller refactor
1) Refactor pullers and add tests.

2) Add timeout to a puller.
mPullTimeoutNs is intrinsic to puller. A pull taking longer than this is
deemed failed and the data discarded.
A metric or StatsPullerManager requesting a pull should monitor the pull
and have deadlineNs. A successful pull may come later than desired due
to statsd processing delays.

3) Add unit tests to puller now that the base puller is more
complicated.

Bug: 118756964
Test: unit test
Change-Id: I0e5d47e2527391f7beef4b2d06bfd5c2f82f1179
2018-12-21 09:46:09 -08:00
Misha Wagner
fde6958b8b Change CpuTimePerThreadFreq to contain all frequencies in one atom
Test: make, flash, inspect pull-source output
Bug: 120016054
Change-Id: I56de3aec85d5f82339eb4eb876a1349d66698a63
2018-11-30 16:29:36 +00:00
Chenjie Yu
d7e3a228be Revert "Revert "support work chain in pulled atoms""
This reverts commit 9c7b131996.

Reason for revert: Fixed build failures due to merge

Change-Id: I7d7bfed3a3234b966f3fe3fd6e0cbc63d2bedf83
Test: unit test
2018-11-28 15:53:09 -08:00
Fabian Kozynski
e3b92ab6ba Merge "Revert "support work chain in pulled atoms"" 2018-11-28 20:32:50 +00:00
Fabian Kozynski
9c7b131996 Revert "support work chain in pulled atoms"
This reverts commit ce8e4dce60.

Reason for revert: breaking multiple targets in master

Change-Id: I3ee74b314e06cb2c4d3d6da82ca116a91aad67d4
2018-11-28 20:13:22 +00:00
Chenjie Yu
fbc5842d16 Merge "support work chain in pulled atoms" 2018-11-28 19:10:30 +00:00
Bookatz
366a4430a3 Statsd atom: pull Build information
Pulls Build information, such as Build.ID.

Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.HostAtomTests#testBuildInformation
Bug: 114443697
Change-Id: If1d573dbdc49543d4268f4d62e02b3ea360e75d5
2018-11-27 11:36:07 -08:00
Chenjie Yu
ce8e4dce60 support work chain in pulled atoms
+ also rewrite map and merge isolated uid to host uid.

output:
Pull from 10014: { 1541137009000000000 10430748770707
(10014)0x2010101->1[I] 0x2010182->lala1[S] 0x2010201->2[I]
0x2018282->lala2[S] 0x20000->10430750[L]  }

Bug: 119043339
Bug: 117975376
Test: unit test
Change-Id: Ib6e3ea0f76594438ee1b3e12e965d85fefb405d7
2018-11-20 16:15:31 -08:00
Tej Singh
b1dbc8b4a5 Atom: Pulled battery level
Atom to pull abttery level directly from health hal

Test: manual on blueline
Test: will do cts
Bug: 119686325
Change-Id: If2e40633b2bb9a6da61fbe1f63484735727e9ac2
2018-11-19 18:21:39 -08:00
Rafal Slawik
3bea895a62 Add ProcessMemoryHighWaterMark atom
Collection of the RSS high-water mark is moved to a separate atom to
improve performance, increase flexibility and overcome security
constrainsts.
Performance: avoid reading /proc/pid/status in ProcessMemoryState;
flexibility: allow pulling RSS high-water mark on a different schedule;
security: add single point where we can trigger the high-water mark
reset.
The RSS high-water mark will be removed from ProcessMemoryState and
NativeProcessMemoryState atoms in a followup-up CL to ensure that the
collected data is continuous.

Bug: 119598534
Test: atest UidAtomTests#testProcessMemoryHighWaterMark
Change-Id: I52da7b5e695f771f1551e1f6a6a773bded4504d1
2018-11-19 15:44:06 +00:00