Add NDK async begin/end & counter
Bug: 111503982 Test: atest CtsAtraceHostTestCases Change-Id: I038b76b505d3103f7b1e85a9469932d23cde2ab8
This commit is contained in:
@@ -34324,7 +34324,7 @@ package android.os {
|
||||
method public static void endAsyncSection(java.lang.String, int);
|
||||
method public static void endSection();
|
||||
method public static boolean isEnabled();
|
||||
method public static void setCounter(java.lang.String, int);
|
||||
method public static void setCounter(java.lang.String, long);
|
||||
}
|
||||
|
||||
public class TransactionTooLargeException extends android.os.RemoteException {
|
||||
@@ -45851,8 +45851,8 @@ package android.text.style {
|
||||
method public deprecated java.lang.String getLocale();
|
||||
method public java.util.Locale getLocaleObject();
|
||||
method public int getSpanTypeId();
|
||||
method public int getUnderlineColor();
|
||||
method public java.lang.String[] getSuggestions();
|
||||
method public int getUnderlineColor();
|
||||
method public void setFlags(int);
|
||||
method public void updateDrawState(android.text.TextPaint);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
|
||||
@@ -109,7 +109,7 @@ public final class Trace {
|
||||
private static native void nativeSetTracingEnabled(boolean allowed);
|
||||
|
||||
@FastNative
|
||||
private static native void nativeTraceCounter(long tag, String name, int value);
|
||||
private static native void nativeTraceCounter(long tag, String name, long value);
|
||||
@FastNative
|
||||
private static native void nativeTraceBegin(long tag, String name);
|
||||
@FastNative
|
||||
@@ -365,7 +365,7 @@ public final class Trace {
|
||||
* @param counterName The counter name to appear in the trace.
|
||||
* @param counterValue The counter value.
|
||||
*/
|
||||
public static void setCounter(String counterName, int counterValue) {
|
||||
public static void setCounter(String counterName, long counterValue) {
|
||||
if (isTagEnabled(TRACE_TAG_APP)) {
|
||||
nativeTraceCounter(TRACE_TAG_APP, counterName, counterValue);
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ static jlong android_os_Trace_nativeGetEnabledTags(JNIEnv*, jclass) {
|
||||
}
|
||||
|
||||
static void android_os_Trace_nativeTraceCounter(JNIEnv* env, jclass,
|
||||
jlong tag, jstring nameStr, jint value) {
|
||||
jlong tag, jstring nameStr, jlong value) {
|
||||
withString(env, nameStr, [tag, value](char* str) {
|
||||
atrace_int(tag, str, value);
|
||||
atrace_int64(tag, str, value);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ static const JNINativeMethod gTraceMethods[] = {
|
||||
// ----------- @FastNative ----------------
|
||||
|
||||
{ "nativeTraceCounter",
|
||||
"(JLjava/lang/String;I)V",
|
||||
"(JLjava/lang/String;J)V",
|
||||
(void*)android_os_Trace_nativeTraceCounter },
|
||||
{ "nativeTraceBegin",
|
||||
"(JLjava/lang/String;)V",
|
||||
|
||||
@@ -229,6 +229,9 @@ LIBANDROID {
|
||||
ATrace_beginSection; # introduced=23
|
||||
ATrace_endSection; # introduced=23
|
||||
ATrace_isEnabled; # introduced=23
|
||||
ATrace_beginAsyncSection; # introduced=29
|
||||
ATrace_endAsyncSection; # introduced=29
|
||||
ATrace_setCounter; # introduced=29
|
||||
android_getaddrinfofornetwork; # introduced=23
|
||||
android_setprocnetwork; # introduced=23
|
||||
android_setsocknetwork; # introduced=23
|
||||
|
||||
@@ -28,3 +28,15 @@ void ATrace_beginSection(const char* sectionName) {
|
||||
void ATrace_endSection() {
|
||||
atrace_end(ATRACE_TAG_APP);
|
||||
}
|
||||
|
||||
void ATrace_beginAsyncSection(const char* sectionName, int32_t cookie) {
|
||||
atrace_async_begin(ATRACE_TAG_APP, sectionName, cookie);
|
||||
}
|
||||
|
||||
void ATrace_endAsyncSection(const char* sectionName, int32_t cookie) {
|
||||
atrace_async_end(ATRACE_TAG_APP, sectionName, cookie);
|
||||
}
|
||||
|
||||
void ATrace_setCounter(const char* counterName, int64_t counterValue) {
|
||||
atrace_int64(ATRACE_TAG_APP, counterName, counterValue);
|
||||
}
|
||||
Reference in New Issue
Block a user