Loading core/java/android/os/Trace.java +17 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import dalvik.annotation.optimization.FastNative; * href="{@docRoot}tools/debugging/systrace.html">Analyzing Display and Performance * with Systrace</a>. */ @android.ravenwood.annotation.RavenwoodKeepWholeClass public final class Trace { /* * Writes trace events to the kernel trace buffer. These trace events can be Loading Loading @@ -123,10 +124,26 @@ public final class Trace { @UnsupportedAppUsage @CriticalNative @android.ravenwood.annotation.RavenwoodReplace private static native long nativeGetEnabledTags(); @android.ravenwood.annotation.RavenwoodReplace private static native void nativeSetAppTracingAllowed(boolean allowed); @android.ravenwood.annotation.RavenwoodReplace private static native void nativeSetTracingEnabled(boolean allowed); private static long nativeGetEnabledTags$ravenwood() { // Tracing currently completely disabled under Ravenwood return 0; } private static void nativeSetAppTracingAllowed$ravenwood(boolean allowed) { // Tracing currently completely disabled under Ravenwood } private static void nativeSetTracingEnabled$ravenwood(boolean allowed) { // Tracing currently completely disabled under Ravenwood } @FastNative private static native void nativeTraceCounter(long tag, String name, long value); @FastNative Loading core/tests/coretests/src/android/os/TraceTest.java +47 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import org.junit.runner.RunWith; * while tracing on the emulator and then run traceview to view the trace. */ @RunWith(AndroidJUnit4.class) @IgnoreUnderRavenwood(blockedBy = Trace.class) public class TraceTest { private static final String TAG = "TraceTest"; Loading @@ -45,8 +44,52 @@ public class TraceTest { private int fMethodCalls = 0; private int gMethodCalls = 0; @Test public void testEnableDisable() { // Currently only verifying that we can invoke without crashing Trace.setTracingEnabled(true, 0); Trace.setTracingEnabled(false, 0); Trace.setAppTracingAllowed(true); Trace.setAppTracingAllowed(false); } @Test public void testBeginEnd() { // Currently only verifying that we can invoke without crashing Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Trace.asyncTraceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, 42); Trace.asyncTraceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, 42); Trace.asyncTraceForTrackBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, TAG, 42); Trace.asyncTraceForTrackEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, 42); Trace.beginSection(TAG); Trace.endSection(); Trace.beginAsyncSection(TAG, 42); Trace.endAsyncSection(TAG, 42); } @Test public void testCounter() { // Currently only verifying that we can invoke without crashing Trace.traceCounter(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, 42); Trace.setCounter(TAG, 42); } @Test public void testInstant() { // Currently only verifying that we can invoke without crashing Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG); Trace.instantForTrack(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, TAG); } @Test public void testNullStrings() { // Currently only verifying that we can invoke without crashing Trace.traceCounter(Trace.TRACE_TAG_ACTIVITY_MANAGER, null, 42); Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, null); Loading @@ -62,6 +105,7 @@ public class TraceTest { @Test @SmallTest @IgnoreUnderRavenwood(blockedBy = Debug.class) public void testNativeTracingFromJava() { long start = System.currentTimeMillis(); Loading @@ -82,6 +126,7 @@ public class TraceTest { // This should not run in the automated suite. @Suppress @IgnoreUnderRavenwood(blockedBy = Debug.class) public void disableTestNativeTracingFromC() { long start = System.currentTimeMillis(); Loading @@ -97,6 +142,7 @@ public class TraceTest { @Test @LargeTest @Suppress // Failing. @IgnoreUnderRavenwood(blockedBy = Debug.class) public void testMethodTracing() { long start = System.currentTimeMillis(); Loading ravenwood/ravenwood-annotation-allowed-classes.txt +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ android.os.SystemClock android.os.SystemProperties android.os.ThreadLocalWorkSource android.os.TimestampedValue android.os.Trace android.os.UidBatteryConsumer android.os.UidBatteryConsumer$Builder android.os.UserHandle Loading Loading
core/java/android/os/Trace.java +17 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import dalvik.annotation.optimization.FastNative; * href="{@docRoot}tools/debugging/systrace.html">Analyzing Display and Performance * with Systrace</a>. */ @android.ravenwood.annotation.RavenwoodKeepWholeClass public final class Trace { /* * Writes trace events to the kernel trace buffer. These trace events can be Loading Loading @@ -123,10 +124,26 @@ public final class Trace { @UnsupportedAppUsage @CriticalNative @android.ravenwood.annotation.RavenwoodReplace private static native long nativeGetEnabledTags(); @android.ravenwood.annotation.RavenwoodReplace private static native void nativeSetAppTracingAllowed(boolean allowed); @android.ravenwood.annotation.RavenwoodReplace private static native void nativeSetTracingEnabled(boolean allowed); private static long nativeGetEnabledTags$ravenwood() { // Tracing currently completely disabled under Ravenwood return 0; } private static void nativeSetAppTracingAllowed$ravenwood(boolean allowed) { // Tracing currently completely disabled under Ravenwood } private static void nativeSetTracingEnabled$ravenwood(boolean allowed) { // Tracing currently completely disabled under Ravenwood } @FastNative private static native void nativeTraceCounter(long tag, String name, long value); @FastNative Loading
core/tests/coretests/src/android/os/TraceTest.java +47 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import org.junit.runner.RunWith; * while tracing on the emulator and then run traceview to view the trace. */ @RunWith(AndroidJUnit4.class) @IgnoreUnderRavenwood(blockedBy = Trace.class) public class TraceTest { private static final String TAG = "TraceTest"; Loading @@ -45,8 +44,52 @@ public class TraceTest { private int fMethodCalls = 0; private int gMethodCalls = 0; @Test public void testEnableDisable() { // Currently only verifying that we can invoke without crashing Trace.setTracingEnabled(true, 0); Trace.setTracingEnabled(false, 0); Trace.setAppTracingAllowed(true); Trace.setAppTracingAllowed(false); } @Test public void testBeginEnd() { // Currently only verifying that we can invoke without crashing Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Trace.asyncTraceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, 42); Trace.asyncTraceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, 42); Trace.asyncTraceForTrackBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, TAG, 42); Trace.asyncTraceForTrackEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, 42); Trace.beginSection(TAG); Trace.endSection(); Trace.beginAsyncSection(TAG, 42); Trace.endAsyncSection(TAG, 42); } @Test public void testCounter() { // Currently only verifying that we can invoke without crashing Trace.traceCounter(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, 42); Trace.setCounter(TAG, 42); } @Test public void testInstant() { // Currently only verifying that we can invoke without crashing Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG); Trace.instantForTrack(Trace.TRACE_TAG_ACTIVITY_MANAGER, TAG, TAG); } @Test public void testNullStrings() { // Currently only verifying that we can invoke without crashing Trace.traceCounter(Trace.TRACE_TAG_ACTIVITY_MANAGER, null, 42); Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, null); Loading @@ -62,6 +105,7 @@ public class TraceTest { @Test @SmallTest @IgnoreUnderRavenwood(blockedBy = Debug.class) public void testNativeTracingFromJava() { long start = System.currentTimeMillis(); Loading @@ -82,6 +126,7 @@ public class TraceTest { // This should not run in the automated suite. @Suppress @IgnoreUnderRavenwood(blockedBy = Debug.class) public void disableTestNativeTracingFromC() { long start = System.currentTimeMillis(); Loading @@ -97,6 +142,7 @@ public class TraceTest { @Test @LargeTest @Suppress // Failing. @IgnoreUnderRavenwood(blockedBy = Debug.class) public void testMethodTracing() { long start = System.currentTimeMillis(); Loading
ravenwood/ravenwood-annotation-allowed-classes.txt +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ android.os.SystemClock android.os.SystemProperties android.os.ThreadLocalWorkSource android.os.TimestampedValue android.os.Trace android.os.UidBatteryConsumer android.os.UidBatteryConsumer$Builder android.os.UserHandle Loading