Skip to content

Commit 40b74e4

Browse files
astreetfoghina
authored andcommitted
Add Systrace support for API 18+ in OSS
Differential Revision: D2627757 fb-gh-sync-id: a01347800d8e9ffda8759cc17df04f7cd139b17c
1 parent f7af7d2 commit 40b74e4

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

ReactAndroid/src/main/java/com/facebook/systrace/Systrace.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99

1010
package com.facebook.systrace;
1111

12+
import android.os.Build;
13+
import android.os.Trace;
14+
1215
/**
13-
* Systrace stub.
16+
* Systrace stub that mostly does nothing but delegates to Trace for beginning/ending sections.
17+
* The internal version of this file has not been opensourced yet.
1418
*/
1519
public class Systrace {
1620

@@ -50,9 +54,15 @@ public static void traceInstant(
5054
}
5155

5256
public static void beginSection(long tag, final String sectionName) {
57+
if (Build.VERSION.SDK_INT >= 18) {
58+
Trace.beginSection(sectionName);
59+
}
5360
}
5461

5562
public static void endSection(long tag) {
63+
if (Build.VERSION.SDK_INT >= 18) {
64+
Trace.endSection();
65+
}
5666
}
5767

5868
public static void beginAsyncSection(

0 commit comments

Comments
 (0)