Age | Commit message (Collapse) | Author |
|
Add statsd protos to platform_protos rule
BUG: 167962588
TEST: TH
TEST: Local build [ crosshatch-userdebug ]
Change-Id: I053f2a211ea28c2f181937af3d58ad16b235d096
|
|
There are two primary steps:
1. Determine which matchers to update
2. Perform the update
Added unit tests
Test: atest statsd_test
Bug: 162322018
Change-Id: I6dbaeb781eef362e2d024a560904497a3525cad2
|
|
This ensures that only one helper thread is created per subscription.
Previously, there could be up to two.
+ fixes thread sleep duration if the pulled atoms have different pull
frequencies
+ rename attemptWriteToSocketLocked to attemptWriteToPipeLocked
Test: atest statsd_test
Test: atest CtsStatsdHostTestCases:ShellSubscriberTest
Test: manual testing on Android Studio
Bug: 156678125
Change-Id: I7074bbba5981a591a30e8b70a1ad1d83eadfcc30
|
|
If a pull happens at the same event time, we should reuse the existing
data, regardless of whether or not the cool down has been met. For
example, if an app upgrade happens at time t, and two metrics need to
pull atom a, if metric one pulls at time t, but metric two initiates the
pull at time t+2, we should still reuse the pull from time t since that
is when the app upgrade happened.
Bug: 156294650
Test: atest statsd_test
Change-Id: I4efc49545093f6683bf6dd89ed68c5dfa5b44d8f
|
|
This CL creates a sendHeartbeat thread that ocassionally sends
heartbeats, consisting of a dataSize of 0, to perfd. perfd will discard
those heartbeats, recheck if the user has canceled the subscription, and
if not, wait for more data from statsd. Sending heartbeats solves two
big problems:
(1) Allows statsd to robustly check if writes to the socket fail because
the read end of the pipe has closed. Previously, if no atoms were pushed
or pulled, statsd never attempted to write to perfd, so statsd could
never detect the end of the subscription. However, now, writes are
regularly made regardless of if statsd receives data. Note that even if
atoms were pushed or pulled, there is no guarantee that they would have
matched the atom matchers sent in perfd's config.
(2) Allows perfd to escape a blocking read call and recheck whether the
user has canceled the subscription. If no data is sent to perfd, perfd
will block in this read call and the AndroidStudio UI will freeze up.
Heartbeats are only sent if statsd has not sent any data to perfd within
the last second, so we do not spam perfd with writes.
+ decomposes the startNewSubscription function
+ prevents startPull from holding the lock while sleeping
Test: atest stastd_test
Test: atest CtsStatsdHostTestCases
Test: manually confirm that AndroidStudio is not freezing
Bug: 153595161
Change-Id: I78f0818e8ed29bdadd02c151444ee7c9555623a4
|
|
(a) Clean up LogEvent::parseBuffer - having those variables be member
variables really helps with code readability.
(b) Don't hold locks when writing to pipe within ShellSubscriber -
ag/150969574 describes why holding a lock is necessary.
Test: m
Bug: 150312423 (allows this bug to be marked as obsolete)
Change-Id: I4903de1dc87a552932b70e5975a7cde91df05b3b
|
|
Overall flow of implementation:
1. parsing the config in MetricsManager to store the uids per atom. It
follows the mAllowedLogSources logic very closely
2. MetricsManager register itself as a PullUidProvider with the
PullerManager.
3. Metrics pass the config key when pulling (for both registering
receivers and normal pulls) , and the puller manager gets
the allowed uids from the PullUidProvider for that config.
4. PullerManager keys receivers by <atomId, configKey> so that it can
look up the uids for that atom using the PullUidProvider as well.
5. Added shell subscriber support. Hardcode a default of AID_SYSTEM for
them and also allow packages per atom. This involved adding a second
interface to Pull that simply accepts the uids, since I didnt want to
make the ShellSubscriber a PullUidProvider as well.
6. Change adb shell cmd stats pull-source to allow users to specify a
package. Default to AID_SYSTEM as well.
Notes:
The feature is flagged off right now, since configs do not pass in the
desired package. Another approach could be to hardcode in the current
mapping, but that doesn't work for OEM pulled atoms.
Test: m statsd
Test: bit statsd_test:* with useUids = false
Test: bit statsd_test:* with useUids = true
Bug: 144099783
Bug: 151978258
Change-Id: I4a7481d7402a52b9beb4ea28b102803f9e50e79f
|
|
We initialize 'mToken' instead of leaving it uninitialized, making
it much less likely to rollover. In additional, we change our
check to inequality, to handle rollover if that were to happen.
There is the (theoretical) possibility of exactly 2^32 other
requests being claimed between our claim and our check. It's
assumed that is essentially impossible and not a concern.
Test: TreeHugger
Bug: 150619687
Change-Id: Iee303e05082a6b3b31ed546bd62d3afe67c771d8
|
|
Because we no longer linkToDeath against a binder object to detect if
the cmd process has died, we detect deaths by checking if writes fail.
ag/10476582 proves that writes fail if the cmd process dies.
Test: m statsd
Test: bit statsd_test:ShellSubscriberTest.testPushedSubscription
Test: bit statsd_test:ShellSubscriberTest.testPulledSubscription
Bug: 150619687
Change-Id: I44a777ffff11e5b9298912b2906063c65e9009eb
|
|
Major changes include:
- Removing unused permission checks within StatsService. These
include ENFORCE_DUMP_AND_USAGE_STATS, checkDumpAndUsageStats,
kOpUsage, and kPermissionUsage.
- Converting from sp to shared_ptr
- Using libbinder_ndk functions instead of libbinder functions
(e.g. for installing death recipients, getting calling uids, etc.)
- New death recipients were added in StatsService,
ConfigManager, and SubscriberReporter.
- Using a unique token (timestamp) to identify shell subscribers
instead of IResultReceiver because IResultReceiver is not exposed by
libbinder_ndk. Currently, statsd cannot detect if perfd dies; we
will fix that later.
Bug: 145232107
Bug: 148609603
Test: m statsd
Test: m statsd_test
Test: bit stastd_test:*
Test: atest GtsStatsdHostTestCases
Change-Id: Ia1fda7280c22320bc4ebc8371acaadbe8eabcbd2
|
|
Delete libplatformprotos since its not used.
Test: m -j
Bug: 147599928
Change-Id: I80203756d714bf123978d26bbe81351a1abdc967
|
|
Bug: 125843868
Test: N/A, remove logging
Change-Id: I204e900d3c6415142d7d6ed469445afde0953c9c
|
|
Test: cts added
Change-Id: I0fe854fcfd5535ed03e502a4cad3f57079b45381
|
|
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
|
|
+ Changed the output format from Atom to ShellData, which is a wrapper for repeated Atom
This is useful because pulled atoms are usually a list of atoms.
Test: statsd_test added
Bug: 110536553
Change-Id: I0e2f55bdd9015c9bc95b87a630297c6f13e39636
|
|
Test: statsd_test
Change-Id: Iaf0558ec2a2dc190bedb240da8019868266ec8f5
|
|
+ This feature is for supporting perfd.
+ Perfd is built outside android and doesnot depend on any android libraries.
So the communication between perfd and statsd can only be via non-android IPCs
(such as socket, pipe, file descriptors etc.)
+ Perfd runs as a shell user, so using the existing shell cmd is a natural choice.
+ The input is a simple config, and output is a stream of atoms proto binary data.
+ Also cleaned up the code so that we use file descriptor directly instead of creating another
FILE*.
TODO: pulled atom subscription.
Bug: 110536553
Test: statsd_test and manually tested
Change-Id: I64b0061cc66b5f7648147885a2ac1af531c19917
|