Currently, statsd uses wall clock seconds to write data to disk. This
issue affects both thermal and normal shutdowns, because if two writes
occur in the same second, the more recent write will overwrite the older
write, erasing the actual data that we want.
For thermal shutdowns, we write twice. Once because of termination
signal received, and once because of binder death recipient from
statscompanion service.
For normal clean shutdowns, we write 3 times. In addition to the two
above, we write for the shutdown received signal.
This fix introduces a cool down period of 3 seconds between writing to
disk.
Bug: 112432890
Test: statsd unit tests
Test: statsd cts tests
Test: manually verified normal shutdown had 1 file written to disk
Test: manually verified thermal shutdown had 1 file written to disk
Change-Id: I4cd39de9063935e762ff7d00051ccc915f31e89a
Atoms from Stats HAL which only has fields in depth 1 were incorrectly
being noted with the mark of last position. This changes fixes the
offsets of the last fields for those 7 atoms.
Test: statsd_test passes
Change-Id: I9be1c22cadb850093ed6483675d162837f976823
The error code will give us some clue on what caused the loss (e.g., EBUSY, or ENOENT)
Test: manual
Bug: 80538532
Change-Id: I446c6e2255bdae063dfb8803ad0b702ead87c645
This is savaged from the large cl.
1. Simplify the logic in ValueMetricProducer.
1.1 for pull data on bucket boundary, we pull on bucket end, instead of
playing with timestamp twice.
1.2 for data that require diffing, we keep a rolling diff base that gets
updated.
1.3 Now we check condition in onMatchedLogEventInternalLocked for pushed atoms. For pulled atoms, check before commit time. This was very error prone in P and caused multiple bugs. It is much simpler now.
2. Treat pushed and pulled atoms the same way and share the same
aggregation types.
4. Allow decreasing values for diffing.
5. Allow diffing for pushed atoms.
6. For diff based aggregation, if the diff value is zero, we skip
output.
Bug: 117224984
Bug: 115683963
Bug: 117975256
Bug: 113268259
Test: unit test
Change-Id: I6ee306e9f6e5a166b392c443594704e7d2792ef5
* Creates an incident section for statsd data.
* Allows dump to output statsd data, in proto format.
* Hooks up two statsd outputs to bugreports:
-statsd report data in proto format
-statsd metadata (statsdstats) in text format
The incident section does not import stats_log.proto because that turns
out to be extremely difficult: stats_log.proto imports atoms.proto,
which imports more things and is enormous and causes all sorts of
problems. atoms.proto was purposefully never compiled in AOSP, so to
retain that feature, the incident section uses 'bytes' instead of an
actual message. Since this isn't ever read in AOSP (other than testing),
this should be fine.
Bug: 115678461
Test: take a bug report and confirm valid proto
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.HostAtomTests#testDumpsysStats
Change-Id: I1c370af7678d1dc7440ce299ea5ea4da6d33832b
GaugeMetric need only pull on first bucket and partial bucket if it is
random_one_sample type
Test: unit test
Change-Id: I85cfbc2a14829245ce34ab801c553a3097e2e4b8
libplatformprotos for the device is compiled using proto lite, and
statsd_test and statsd_benchmark have protos that reference the
libplatformprotos. With protobuf 3.5.2 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
Change-Id: I6a618c4118972c0e5ffb07a361ac6612b9069c5d
Protobuf 3.5.2 redefines google::protobuf::uint64 from unsigned long
long to uint64_t, which is sometimes unsigned long and sometimes
unsigned long long. Use PRIu64 to print it, and add an implementation
of ProtoOutputStream::write for long.
Bug: 117607748
Test: m checkbuild
Change-Id: I48912f58e2f63f4a98c3aefaa4f78cc2c719bb68
Also, add the start time to non-additive in statsd.
Bug: 118249210
Test: manually verified values are included in a report
Change-Id: Ib91d4d0f416a1cbd298f4a010e8264a3e8f0ee16
Bug: 118509430
Test: builds successfully. logging tests will be conducted once client
implementation is in.
Change-Id: If0085273b43316bce4c266829012a618193d6bd8
See build/soong/README.md for more information.
Test: m checkbuild
Merged-In: I8c80878cec46c9299234c6f4c1e0e19efc0a221e
Change-Id: I8c80878cec46c9299234c6f4c1e0e19efc0a221e
Each config can choose to include version strings and installer with
each metrics report. This data may be useful in the cloud to filter
the app-specific data.
BUG: 115626330
Change-Id: I3972ff2a94e7f0347ac0cc8a443cf328c1731e13
Test: Modified unit-tests, verified on marlin-eng
N.B.: This calls CpuThreadProcReader synchronously in
StatsCompanionService::pullData. This call takes approximately 50.079ms on a
Pixel 2.
Bug: 111534779
Test: `adb shell cmd stats pull-source 10035` returns correct data
Change-Id: I6fe6d178e28669f10ba9c076cbf19dc443d171c9
Process start time is recorded to detect whether two memory samples
come from the same process and how long the process was alive.
Bug: 118249210
Test: atest MemoryStatUtilTest and manually verified that data is in
statsd report
Change-Id: I7f49cd8bfc81c5e7e70e4f8b49729632eeec5798