Add unit tests for the native API to log atoms to statsd.
(This CL is being cherrypicked into AOSP in order to prevent automerger
issues with the rename from libstatssocket to libstatspush.)
Test: bit libstatssocket_test:*
Bug: 145231901
Change-Id: If427c17319787200260cbe3b71075ca556c9a82b
Merged-In: If427c17319787200260cbe3b71075ca556c9a82b
Now, the number of elements in each simulated stats_event is correctly
sampled from a uniform distribution.
Rerunning the benchmarking tests indicates that truncating the buffer
increases the number of cycles require to log an event by only 1.6%.
Test: m libstatssocket_benchmark
Test: bit libstatssocket_benchmark:*
Change-Id: I8d5c1734861038beec8eeb7ce1f84a24bde25a75
We create a .map.txt file that lists all the stable entry points into
libstatssocket. This should allow other APEXes to link to libstatssocket
without having to copy the library within the APEX.
Test: m -j libstatssocket
Bug: 146377784
Change-Id: I9f77a0c380b6884d9ca60807a8974380420cfe0a
We now truncate the buffer to the appropriate length when clients call
stats_event_build().
Benchmarking tests indicate that truncating the buffer to the
appropriate length increases the cost clients pay to write to the socket
by 2%. This is negligible enough that I decided to truncate the buffer
for both pushed and pulled atoms in order to simplify the API.
Test: m libstatssocket
Test: bit libstatssocket_benchmark:*
Bug: 144126231
Change-Id: I35dec748ff87c0821d0d06779a406997e6e64966
Merged-In: Ife976bb383ecff8de5064730692a95e2a3a82c9d
StatsEventCompat is a wrapper library that toggles between the old
logging scheme and the new logging scheme. It was designed particularly
for the DNS Resolver module and should not be used by others.
We will merge libstatspush_compat and libstatssocket_q in a future CL.
Test: m libstatspush_compat
Test: bit libstatspush_compat_test:* (passes on Q and R)
Bug: 145534143
Change-Id: Ib355031f3573101ea90bd8694861fbfc33b0c788
Merged-In: Idf35ccb6669798166475f08b2fbab40534b5db19
Move iovec* construction and noteLogLoss from stats_event_list to
stats_buffer_writer.h.
Expose write_buffer_to_statsd that takes in a byte array and writes
it to the statsd socket. Currently exposed for StatsLog.write JNI call.
This change also allows getting rid of stats_event_list once all clients
have migrated to stats_event
Bug: 145619049
Test: m -j libstatssocket
Change-Id: I73f914985421fc1a4f094982c826bf364604b788
Merged-In: I0048e392c2f5039eb70dacf4e91a43d3f32e8749