Systers Community
(Part 1 of 2) Generate multiple Trace Logs by Instrumenting Powerup app
Prerequisite
- Setup Powerup Android using the instructions given [here].(https://github.com/systers/powerup-android#setup-for-developers).
- Before you start generating trace logs, make sure your app has permission to write to external storage (WRITE_EXTERNAL_STORAGE) so that it can save trace logs to the device.
Steps
- Instrument your app:
- To create trace logs, call startMethodTracing() where you want the system to start logging tracing data.
- In the call, specify the name for the .trace file, and the system saves it to a package-specific directory that's intended for persistent app data on the target device. This file contains the binary method trace data and a mapping table with thread and method names. To stop tracing, call stopMethodTracing().
- Save multiple logs: To save multiple trace logs to your device, dynamically rename the trace log each time your app calls startMethodTracing().
- Access trace logs using File exploree: To open the Device File Explorer, click View > Tool Windows > Device File Explorer (or click the Device File Explorer button in the tool window bar). Locate the .trace files by navigating to your app's package-specific directory.
- Copy the file to your local machine using the "adb pull" command.
Work Submission
- Submit atleast 3 trace files along with sample starts and stops recording files.
- Continue to (Part 2 of 2) of this task AFTER work is completed.
Resources
- Ask any questions in #powerup on Systers Open source Slack.
- Reference article.
Task tags
Students who completed this task
Yuyuan Luo, Valentun, Aryaman Agrawal