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>
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
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>
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
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
The pulling code will be added in the next commit.
Bug: 130526489
Test: statsd_testdrive
Change-Id: I0fea4b6a7a8dbbdc574fb342c1e07aa0165bf797
(cherry picked from commit 77987ed47f)
This atom contains information about historical AppOps performed by
applications.
Bug: 128925078
Test: builds
adb shell cmd stats pull-source 10060
Change-Id: Iaaec0987712779e2062139d3ad0e2d4544d4d45f
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)
Allows gauge/value metrics to work with pulled atoms that were
registered after the config was received.
Test: gts
Bug: 130314103
Change-Id: I9cddd28efd464d8bb78da868d8c0d850ffb0235c
information about all types of external storage (e.g. USBs).
Bug: 123688171
Test: Manually tested using statsd_testdrive script
Change-Id: I4bc7c43bb7f5ee9dee3989eb724d05c4d350aff2
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
Creates a hidden api to register puller callbacks for vendor atoms.
Test: manual local test
Test: statsd unit tests
Bug: 119898637
Change-Id: Id28817b8fc718e128adc4e1c6b2e997db84517f9
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
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
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
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
This adds to PulledAtomStats and creates a new stats atom AtomMetricStats.
Test: none
Bug: 123572169
Change-Id: Ifea682005210a6342a027643e162f8ce7785cb06
Framework will add logging in the next CL
Bug: 120161047
Bug: 117060268
Bug: 121072756
Bug: 121071984
Test: Builds
Change-Id: I673d8af8be78be11b5eac249c47847ebeca2cd2e
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
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>
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
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
This reverts commit 9c7b131996.
Reason for revert: Fixed build failures due to merge
Change-Id: I7d7bfed3a3234b966f3fe3fd6e0cbc63d2bedf83
Test: unit test
Atom to pull abttery level directly from health hal
Test: manual on blueline
Test: will do cts
Bug: 119686325
Change-Id: If2e40633b2bb9a6da61fbe1f63484735727e9ac2
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