- Record perfetto traces using the instruction. Make sure phone has some available memory on disk. Increase max trace size and length. Record only memory-related activities to reduce trace file size. You can stop recording and start a new one. Put all tracess from the session to one directory on your computer.
- install Pyton3
brew install python3
pip3 install pandas perfetto
- Run
./analyse.py pathToTraceFolder applicationId
. Pass directory with traces and application id a parameter, for example if you have traces in directorytestTraces
and you want to build memory threndline for an applicationcom.mapbox.navigation.examples
, run./analyse.py testTraces com.mapbox.navigation.examples
If analyse.py
fails because random port allocation fails, try running it one more time.
Result of the trace is a chart with memory usage (blue) + trend line(red). It additionally output cooficient of the trenline linear function to command line, like rss trendline has coefficient -0.00034122302415542287
. Positive coeficient means that value is groving, negative that memory usage is slowly decreasing, ideal value is close to 0.