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

Commit 9f029c5b authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Add NDK async begin/end & counter"

parents a4c83f4c 77b31a5e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34592,7 +34592,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 {
+2 −2
Original line number Diff line number Diff line
@@ -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);
        }
+3 −3
Original line number Diff line number Diff line
@@ -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",
+3 −0
Original line number Diff line number Diff line
@@ -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
+12 −0
Original line number Diff line number Diff line
@@ -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);
}
 No newline at end of file