TestUseZeroDefaultBaseWithPullFailures was failing on hwasan builds
because the test had a reference to an Interval object that was
deleted. The test tried to get another Interval object and assign it to
the reference. However, what this really did is change the Interval
object that the reference referred to. Since that Interval object had
been deleted, hwasan failed the test.
This fixes the issue. Also clean up some usages of auto to make
the test more readable.
Test: bit statsd_test:* on blueline_hwasan
Bug: 152354576
Change-Id: I392740770715391c727d190b1ed8ba22cc01210f
Also removed unused CreateEvent helper functions in metric_util.cpp
Test: bit statsd_benchmark:*
Bug: 149794614
Change-Id: I14bcc254c44773eb42f749305beadaaf23a19b2b
EncodedBuffer is used a lot in incidentd. EncodedBuffer uses malloc
internally to acquire memory. Frequently creating and destroying
EncodedBuffer creates memory fragmentation, leading to high memory
usage after taking an incident report.
Also fixes a few other places with lots of malloc/free operations.
This change:
* Creates a pool of EncodedBuffer in incidentd. The saving is
significant. It reduces EncodedBuffer creation from 3 per section to
3 per report.
* Replaces malloc with mmap inside EncodedBuffer. mmap is guaranteed
to be mem page aligned, so there will be no mem fragmentation after
destroying EncodedBuffer.
* Replaces new with mmap inside TombstoneSection
* Forks a process to execute LogSection, because liblog malloc & free
significant amount of memory
Result:
PSS before taking a report: 1295 KB
PSS after taking a report: 1336 KB
Bug: 150311553
Test: heapprofd
Change-Id: I83bd9c969b751c80b2f42747020799bd85d8aae6
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
The API is simple enough, so just reimplement everything using the
C API directly.
Bug: 148940365
Test: treehugger
Change-Id: I0a75744e975e8d3c2a557e533eacd03200388ddc
Update statsd to take in times in milliseconds instead of nanoseconds.
Also make appropriate updates for graphics stats, odpm, subsystem sleep
state, and LibStatsPullTests
Test: atest LibStatsPullTests
Test: bit statsd_test:*
Bug: 150788562
Change-Id: I593552d6c50bb4dcb89ca9cc1c737781653e7cc5
First CL at ag/10697747. Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.
Updates from TestInvalidBucketWhenMultipleBucketsSkipped to TestSlicedStateWithPrimaryField_WithDimensions
Test: bit statsd_test:*
Bug: 149590301
Change-Id: I682a19ea6fe39dd750ca396c9de479befa658f0d
TextDumpsysSection used to inherent WorkerThreadSection, which
allocates 2x more memory than the dumped content. This change saves
the extra allocation by writing dumpsys content directly to FdBuffer.
Bug: 150311553
Test: Manually run "incident -p EXPLICIT 4000"
Change-Id: I9c0c0db75c8595822ee0711040e8865dd69378b6
First CL at ag/10697747. Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.
Updates from TestUseZeroDefaultBase to TestEmptyDataResetsBase_onDataPulled
Test: bit statsd_test:*
Bug: 149590301
Change-Id: I91601123e8aaeb92aa6e6618dbd12467949a94e4
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
First CL at ag/10697747. Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.
Updates from TestPushedEventsWithoutCondition to TestSkipZeroDiffOutputMultiValue
Test: bit statsd_test:*
Bug: 149590301
Change-Id: Ie429f36124d475c16652eb52fed41ab88128ffdd
The detached thread may live longer than the caller, and then "data"
goes out of scope. Fix it by managing data using a strong pointer.
Fixes: 151335416
Test: turn on hwasan, tweak WorkerThreadSection timeout, verify no
hwasan error
Change-Id: I179204b17c381e4e920b9aee07900150d9497639
First CL at ag/10697747. Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.
Updates from TestEmptyDataResetsBase_onConditionChanged to TestInvalidBucketWhenPullFailed
Test: bit statsd_test:*
Bug: 149590301
Change-Id: I915b47e086ee5065eaa71094b83d2b271ce847b7
First CL at ag/10697747. Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.
Updates from TestPulledEventsTakeAbsoluteValueOnReset to TestPulledValueWithUpgradeWhileConditionFalse
Test: bit statsd_test:*
Bug: 149590301
Change-Id: I31b4a635262586aedeb23f84cae3d66f48593b3f
This is part of the migration to remove libstatslog from statsd
Since we still depend on libstatsmetadata, we cannot fully mock out
all the atoms. So we will create a new libstatslog_statsdtest to house
atoms used only in the tests.
Bug: 150976524
Test: bit statsd_test:*
Change-Id: I6368305eb89b2c35e670e42907a308afd922e604
Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.
I added a few different CreateLogEvent functions that account for tests
that need events with 0, 2, and 3 values.
The old #createEvent function took in one value but added it twice to the
LogEvent. I replaced this with #CreateRepeatedValueLogEvent. Any events
made with #createEvent or that took the form of:
event.write(tagId)
event.write(value)
was replaced with a call to #CreateRepeatedValueLogEvent. I assumed
that the tagId was used as the first field because an arbitrary number
was needed.
Test: bit statsd_test:*
Bug: 149590301
Change-Id: I26de8074a66babcf3ab7ee395be0598d88b4ba59
Add operation ids which are used only for logging. They will
allow to reduce bandwidth required for logging. Mapping between
operation string ids (OPSTR_, public API) and Logging ids
is enforced by statsd CTS test.
Bug:143519689
Test: android.cts.statsd.atom.UidAtomTests#testAppOps
Test: android.cts.statsd.atom.UidAtomTests#testForegroundServiceAccessAppOp
Exempt-From-Owner-Approval: discussed with moltmann@ in chat.
Change-Id: I2f85d6889e946219557d26b28334d4bacde06b12
Merged-In: I2f85d6889e946219557d26b28334d4bacde06b12
Delay uniform sampling of packages.
Introduce boot time sampling of packages - simplified sampling designed
to save time during start up sequence.
Bug: 150239020
Test: manual verification
Change-Id: I5911b663cfefe324a443b0ba3f97c46e0984a0f3
This is a preliminary CL that parses annotations within LogEvent, but
does nothing with the annotations provided. Annotation information will
be exposed from LogEvent/FieldValue in a future CL. (That CL will also
contain tests for parsing annotations.)
Test: m statsd
Bug: 150414043
Change-Id: Iae79644ea8455280a654076bfd5819927d4183d3
In the core functionality this changes everything including aidl's and
field names:
- Context
- ContentProvider
- AppOps*
- Package parsing
For the rest, this is a shallow change to only change to the changed
APIs. This keeps the change small-ish
Exempt-From-Owner-Approval: Rename
Fixes: 148792795
Test: TH
Change-Id: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
Merged-In: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
To reduce the discrepance between old code which still uses
std::unique_ptr and new code using std::optional.
This might help to avoid merge-conflicts between branches.
Bug: 144773267
Test: m
Merged-In: Ie3196ee5cce17d77950eea9479d2cc1406e9e674
Merged-In: I33822bc76ef87637d5408849f64a0607e121792e
Change-Id: I33822bc76ef87637d5408849f64a0607e121792e
(cherry picked from commit ad62e8cbf5cf6083568f6f230ef7d73ad8776971)
Exempt-From-Owner-Approval: cherry-pick from master with owner's approval