Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73e5bf2d authored by John Reck's avatar John Reck
Browse files

Add NDK async begin/end & counter

Bug: 111503982
Test: atest CtsAtraceHostTestCases
Change-Id: I030e0bb087dbec7e5f226c3647aa6235cff32725
parent 5118e8d0
Loading
Loading
Loading
Loading
+35 −0
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@
#define ANDROID_NATIVE_TRACE_H
#define ANDROID_NATIVE_TRACE_H


#include <stdbool.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/cdefs.h>


#ifdef __cplusplus
#ifdef __cplusplus
@@ -73,6 +74,40 @@ void ATrace_endSection() __INTRODUCED_IN(23);


#endif /* __ANDROID_API__ >= 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
#ifdef __cplusplus
};
};
#endif
#endif