Created
December 11, 2021 15:30
-
-
Save vishalratna-microsoft/cd3857f74d4eea590c3b75e9e93fab7a to your computer and use it in GitHub Desktop.
Snippet setup code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleApplication extends Application { | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
if(BuildConfig.DEBUG) { | |
Snippet.install(new Snippet.MeasuredExecutionPath()); | |
Snippet.newFilter("SampleFilter"); | |
Snippet.addFlag(Snippet.FLAG_METADATA_LINE | Snippet.FLAG_METADATA_THREAD_INFO); | |
} | |
// There are cases where the code flow is spread across different files, | |
// in those kind of scenarios we use tag based startCapture call. | |
// We can then use find() with the tag and end the capture. | |
// It handles the case, when start capture is not called in warm launches and find() and endCapture() | |
// are called. In those case the calls to find() and endCapture() are no-op. | |
Snippet.startCapture("app_start"); // Start the measurement in Application class | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment