Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions docs/systrace.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@ title: Systrace

## Example

`Systrace` allows you to mark JavaScript (JS) events with a tag and an integer value. Capture the non-Timed JS events in EasyProfiler.
`Systrace` allows you to mark JavaScript (JS) events with a tag and an integer value. Start profiling with an Android profiling tool such as Perfetto or EasyProfiler, then use these markers to identify the events in the captured trace.

```SnackPlayer name=Systrace%20Example
import {Button, Text, View, StyleSheet, Systrace} from 'react-native';
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';

const App = () => {
const enableProfiling = () => {
Systrace.setEnabled(true); // Call setEnabled to turn on the profiling.
const markEvent = () => {
Systrace.beginEvent('event_label');
Systrace.counterEvent('event_label', 10);
};

const stopProfiling = () => {
Systrace.endEvent();
};

Expand All @@ -31,15 +27,7 @@ const App = () => {
React Native Systrace API
</Text>
<View style={styles.buttonsColumn}>
<Button
title="Capture the non-Timed JS events in EasyProfiler"
onPress={() => enableProfiling()}
/>
<Button
title="Stop capturing"
onPress={() => stopProfiling()}
color="#FF0000"
/>
<Button title="Mark event" onPress={markEvent} />
</View>
</SafeAreaView>
</SafeAreaProvider>
Expand Down
Loading