create both 32 and 64 bit variants
fixes libstatssocket_test for 32 bit devices
Bug: 154652564
Test: make mts, adb push, adb shell all 4 tests
Change-Id: Ia6b51686c06e786b38cb3713315977533f1bb819
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.
Exempt-From-Owner-Approval: cherry-pick from AOSP
Bug: 150999716
Test: m
Merged-In: I8fd2a3c9b69454c6018c72f5198898bc90dc4d0d
(cherry picked from commit 937b4bf173)
Change-Id: I8fd2a3c9b69454c6018c72f5198898bc90dc4d0d
Test: bit statsd_test:*
Test: bit libstatssocket_test:*
Test: bit libstatspull_test:*
Bug: 153349659
Change-Id: Ief3d0e062ed3e5cabf5b8b6198510caf3f64eefd
Originally, the native implementation would discard everything clients
wrote to the buffer before the setAtomId call. Thus, the atom id was
always placed in the "correct position." However, for consistency with
the Java implementation, we now allow write calls before setAtomId to
occur and log an error in that case.
Test: bit libstatssocket_test:*
Bug: 152119205
Change-Id: Ib109c7a939a5ae92c1d5fc70aa647ac7390fadad
The ABI dump for libstatspull can't be built due to the link error.
Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py
Bug: 151102177
Bug: 151694054
Change-Id: Id324890235679b9593995b6e12a60ef055b4c825
1. Rename registerPullAtomCallback to setPullAtomCallback
2. Rename unregisterPullAtomCallback to clearPullAtomCallback
3. Change Ns to Millis for consistency with java
4. Swap metadata and callback params in setPullAtomCallback to match
java
5. Added getters for PullAtomMetadata
6. Added libstatspull_test to test PullAtomMetadata
7. Changed the types on setAdditiveFields from int to int32_t
Test: make
Test: atest LibStatsPullTests
Test: bit libstatspull_test:*
Bug: 1507885621
Bug: 151875223
Change-Id: I5cb07bfe71b1002180403828d5e8e6a5b88ce6fe
Refactors implementation details to allow for atom-level annotations.
This CL does not change the API surface. addBoolAnnotation and
addInt32Annotation work for both atom-level and proto field annotations.
Test: bit libstatssocket_test:*
Bug: 151158794
Change-Id: I2c340b201aeb3bcddd5cfde171b7c4df1d8d69a4
liblog is a platform library that provides stable C API. There is no
need to include the library, especialy by statically linking to it, in
any APEX. It not only wastes the storage/ram, but also is incorrect
because the socket interface to logd which is implemented in liblog is
not guaranteed to be stable.
Fixing this issue by converting static_libs: ["liblog"] into
shared_libs: ["liblog"], in which case the dependency to the library
is satisfied via the stub variant of the library.
As a result, we could restrict the availablity of the library to
the platform and the runtime APEX.
Exempt-From-Owner-Approval: already approved when this was in internal
master (ag/10572699)
Bug: http://b/151051671
Bug: http://b/150827719
Test: m
Merged-In: I5aab863cb12b8767b6979255c247000a59355b0e
(cherry picked from commit 95b6f45b0e)
Change-Id: I5aab863cb12b8767b6979255c247000a59355b0e
Also fixes a bug in the tests where the platform version was being
checked by querying version.release instead of version.codename
(currently, version.release == 10, while version.codename == R).
Test: bit libstatspush_compat_test:* (on Q and R)
Test: libsstatssocket.so is not placed in resolv apex (on R)
1|bonito:/ $ ls apex/com.android.resolv/lib64
libclang_rt.ubsan_standalone-aarch64-android.so
libcrypto.so
libnetd_resolv.so
libssl.so
Test: NETWORK_DNS_EVENT_REPORTED atom is logged to statsd (on R)
- adb shell cmd stats print-stats (atom 116 count > 0)
Bug: 148743333
Change-Id: Ib3eaa32835905bcf6e3b003054bf0f3c4e7ec0a4
Merged-In: Ib3eaa32835905bcf6e3b003054bf0f3c4e7ec0a4
(cherry picked from commit 9848eb4f1c)
Make libstatssocket unable to be linked as a static lib on the platform.
Test: bit libstatssocket_test:*
Test: bit statsd_test:*
Test: atest LibStatsPullTests
Bug: 149340100
Change-Id: I5889dd718536f5f2c693b4c2e7331c9cc2eb2ac9
This change is done in internal master because the flag has not been
switched in AOSP, so stats_event_list is still being used there.
Test: m -j
Bug: 145573568
Change-Id: Ica525d0fd731b8d3e9d273ce2220a3d3179d93d9
Create a function to overwrite timestamp for LogEvent tests. This
function is not exposed outside of the APEX.
Test: bit libstatssocket_test:*
Change-Id: Id0eac485af60e952cc700f7d1231b1b971400982
As part of statsd becoming a Mainline module in R, we need to formalize
the statsd APIs called from outside the statsd apex.
Bug: 145923416
Test: m
Change-Id: I296a018cc93d95bda77d95f8161acbbe983a5d51
Since libstatspull will be placed within the APEX, we need to move to
libbinder_ndk.
Test: m -j libstatspull
Test: atest LibStatsPullTests
Bug: 145213327
Change-Id: I86dd6e759efa5eb20bffc76492d5fa72cf279872
pass the byte array pointer; not the reference to the pointer.
Also turn on new socket protocol.
Bug: 148909969
Bug: 143979391
Test: m
Test: fastboot flashall
Test: atest android.cts.statsd.atom.UidAtomTests#testLmkKillOccurred
Test: atest LibStatsPullTests
Test: atest GtsStatsdHostTestCases
Change-Id: If7abae5cadb036555540d1b9b5e7f2cabe99beb8
Libstatspull will ship as a part of the statsd apex in R.
Also update libstatssocket to have version 30 to align with api level,
as per native api council feedback.
Change both libraries to use NDK style naming conventions (AStatsEvent,
AStatsManager), and remove unneeded APIs in libstatssocket.
Remove KeyValuePairs from libstatssocket. KeyValuePairs will not be
supported in native code.
Bug: 147499386
Test: make libstatspull
Test: make libstatssocket
Test: atest libstatssocket_test
Change-Id: Ie79771461215a057529aaac91db95e4334c3960e
This cl modifies getStatsService to use the blocking getService, but
also makes the binder call in a separate thread to not block the client
thread. This is needed because it is possible for pullers to be
registered before statsd starts, and calling checkService before statsd
is up will fail. We also would never receive the binderDied to register
it, because we would never have a binder object to linkToDeath on.
Bug: 147682855
Test: atest LibStatsPullTests
Change-Id: I68c04bc24c7fe066eca88cab4f6a76885581c1ee
Changes the API to return an int instead of a bool.
Creates API to unregister pullers.
Test: atest LibStatsPullTests
Bug: 144373250
Change-Id: I6d395237082337a22f37190343a1fc59703d39bf
Add unit tests for the native API to log atoms to statsd.
Test: bit libstatssocket_test:*
Bug: 145231901
Change-Id: 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
This cleanup makes it clear that there are only two acceptable ways of
logging to the socket: either through libstatspush_compat or
libstatssocket (which will soon be renamed to libstatspush).
Test: m -j
Change-Id: I467b08bc300c2ef394b22422c6acf55a978a380a
Merged-In: I6a49b4995b56df462e1be901ea5e54acfe2e8bac
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
Simplifications/changes:
(1) We remove the bufPos field and track the end of the buffer using
only the size field.
(2) We rename put_<type>() functions to append_<type>() to signify that the
value will be placed at the end of the buffer. We also move the
increment of event->size to within the append_<type>() functions;
this improves readability of the write_<type>() functions.
(3) We immediately write the timestamp and atom id to the buffer in
order to simplify stats_event_build().
(4) We never check for null pointers; checking for null pointers
delays errors and obfuscates the root problem.
(5) We change the the annotationId and numPairs parameters to be
uint8_t's. This helps signify to clients that these values must fit
in 1 byte.
(6) Clients no longer have to pass in the length of strings. Instead, we
expect them to pass in null-terminated strings, and we will
calculate the length outselves using strnlen.
Test: m -j libstatssocket
Change-Id: I6d192768876a23d7016173bcdaf59f8b7e92b182
Merged-In: I0173f8bc76ef25118379dce5d2481f5f7a9b7519
Encoding of key-value pairs follows strategy described in
go/statsd-socket-doc.
Fixed bug where timestamp and atom id were not contributing to the
number of fields in the buffer.
Note: Similar to ag/9603344, which was abandoned because of git rebasing
issues.
Test: m -j libstatssocket compiles
Bug: 143079361
Change-Id: I15abdf13ad8debf83ae1f6c372676db4fe390289
Merged-In: I8d23ddf2dbfee518ad970894ac09ba3ad5b5b4ad
This allows the parsing code within statsd to access the type ids.
Also, we move stats_event.h to the include directory for consistency.
Test: m -j libstatssocket
Change-Id: I7030416872677f3a523c2baf7bf6bcb4ca0ae6a4
Merged-In: I1db7fc9e9d0efd2225612353a8fc49bb13220ff0
This cleanup makes it clear that there are only two acceptable ways of
logging to the socket: either through libstatspush_compat or
libstatssocket (which will soon be renamed to libstatspush).
Test: m -j
Change-Id: I6a49b4995b56df462e1be901ea5e54acfe2e8bac
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: 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: Idf35ccb6669798166475f08b2fbab40534b5db19
Create a new library for the native puller callback API. The library has
2 main interfaces: register_stats_pull_atom_callback, which is used to
register a callback, and stats_pull_atom_callback_t, which is the
callback for the puller. It also exposes pulled_stats_event_list, which
is a struct wrapper around a vector of stats_event.
Test: make libstatspull
Bug: 142969725
Change-Id: I14fe4dc523d6f81fdeaa3fe6fad3e95aeecfe92e
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: I0048e392c2f5039eb70dacf4e91a43d3f32e8749
Break up libstatssocket into libstatssocket_q and libstatssocket.
libstatssocket_q is for Q Mainline modules.
Bug: 145569088
Test: m -j
Test: bit statsd_test:*
Test: adb shell cmd stats print-logs && adb logcat "*:S statsd:*"
Change-Id: I9d113b37640345ebad6aa269ab710db0d2179671
Simplifications/changes:
(1) We remove the bufPos field and track the end of the buffer using
only the size field.
(2) We rename put_<type>() functions to append_<type>() to signify that the
value will be placed at the end of the buffer. We also move the
increment of event->size to within the append_<type>() functions;
this improves readability of the write_<type>() functions.
(3) We immediately write the timestamp and atom id to the buffer in
order to simplify stats_event_build().
(4) We never check for null pointers; checking for null pointers
delays errors and obfuscates the root problem.
(5) We change the the annotationId and numPairs parameters to be
uint8_t's. This helps signify to clients that these values must fit
in 1 byte.
(6) Clients no longer have to pass in the length of strings. Instead, we
expect them to pass in null-terminated strings, and we will
calculate the length outselves using strnlen.
Test: m -j libstatssocket
Change-Id: I0173f8bc76ef25118379dce5d2481f5f7a9b7519
Encoding of key-value pairs follows strategy described in
go/statsd-socket-doc.
Fixed bug where timestamp and atom id were not contributing to the
number of fields in the buffer.
Note: Similar to ag/9603344, which was abandoned because of git rebasing
issues.
Test: m -j libstatssocket compiles
Bug: 143079361
Change-Id: I8d23ddf2dbfee518ad970894ac09ba3ad5b5b4ad
This allows the parsing code within statsd to access the type ids.
Also, we move stats_event.h to the include directory for consistency.
Test: m -j libstatssocket
Change-Id: I1db7fc9e9d0efd2225612353a8fc49bb13220ff0
Cherry pick to aosp.
stats_event_list changes for creating a generic api for statsd mainline
logging.
Test: builds
Test: existing logs continue to flow
Change-Id: I4163edc80ffcca61db7ab2a1e14ae8c14aab2347
Merged-In: I4163edc80ffcca61db7ab2a1e14ae8c14aab2347
(cherry picked from commit 4c2f079dad)
In addition to the dgram queue size, the sender buffer size also matters.
Set it to a higher value (default is 224KB).
Test: manual
Change-Id: Ib610c1fa1eaf3c5e36f51854a2b0720f387dc1b8
stats_event_list changes for creating a generic api for statsd mainline
logging.
Test: builds
Test: existing logs continue to flow
Change-Id: I4163edc80ffcca61db7ab2a1e14ae8c14aab2347
readv() isn't used by anyone, writev() has one easily replaced user.
uio.h can be left as a private header for windows compatibility with
struct iovec.
Test: build
Change-Id: I33d4c6bdee6fd818271f78ae06abdd2aa09430f2
The existing APIs will truncate the byte array in case of '\0' in between.
Test: test_drive with atom 103
Change-Id: I104d35b330c6b52e2fdce1f5d4305dca08228f1b
Previous submission of this change, aosp/790068, caused a failure in
sdk_mac for CLOCK_REALTIME and <endian.h> not being available.
Bug: 110537511
Test: compiles without failures and verified the correct metric
Change-Id: Iba1dc920ad82e88a4bcdd2feaee9a06202a440c2