diff options
author | 2018-12-05 18:18:53 -0800 | |
---|---|---|
committer | 2018-12-06 10:59:47 -0800 | |
commit | 73e5bf2d1a23c4aaa2ea43ca75fa9268c2ef6e52 (patch) | |
tree | 5e605810fa3167a266b8308ae27640868cede4fd | |
parent | 5118e8d029e5e03e8fda19334ba50a356dc0ca72 (diff) |
Add NDK async begin/end & counter
Bug: 111503982
Test: atest CtsAtraceHostTestCases
Change-Id: I030e0bb087dbec7e5f226c3647aa6235cff32725
-rw-r--r-- | include/android/trace.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/android/trace.h b/include/android/trace.h index aa24995cae..bb7ff28f79 100644 --- a/include/android/trace.h +++ b/include/android/trace.h @@ -33,6 +33,7 @@ #define ANDROID_NATIVE_TRACE_H #include <stdbool.h> +#include <stdint.h> #include <sys/cdefs.h> #ifdef __cplusplus @@ -73,6 +74,40 @@ void ATrace_endSection() __INTRODUCED_IN(23); #endif /* __ANDROID_API__ >= 23 */ +#if __ANDROID_API__ >= __ANDROID_API_Q__ + +/** + * Writes a trace message to indicate that a given section of code has + * begun. Must be followed by a call to {@link ATrace_endAsyncSection} with the same + * methodName and cookie. Unlike {@link ATrace_beginSection} and {@link ATrace_endSection}, + * asynchronous events do not need to be nested. The name and cookie used to + * begin an event must be used to end it. + * + * \param sectionName The method name to appear in the trace. + * \param cookie Unique identifier for distinguishing simultaneous events + */ +void ATrace_beginAsyncSection(const char* sectionName, int32_t cookie) __INTRODUCED_IN(29); + +/** + * Writes a trace message to indicate that the current method has ended. + * Must be called exactly once for each call to {@link ATrace_beginAsyncSection} + * using the same name and cookie. + * + * \param methodName The method name to appear in the trace. + * \param cookie Unique identifier for distinguishing simultaneous events + */ +void ATrace_endAsyncSection(const char* sectionName, int32_t cookie) __INTRODUCED_IN(29); + +/** + * Writes trace message to indicate the value of a given counter. + * + * \param counterName The counter name to appear in the trace. + * \param counterValue The counter value. + */ +void ATrace_setCounter(const char* counterName, int64_t counterValue) __INTRODUCED_IN(29); + +#endif /* __ANDROID_API__ >= 29 */ + #ifdef __cplusplus }; #endif |