top2csv
v1.0.2
Published
Convert Memory Logs to Csv format
Downloads
2
Readme
How to generate Csv
- source ~/.bash_profile (Optional, in case you don't have adb in your $PATH)
- adb shell (To Enter Shell)
- Run top command in shell // For ShareChat: top -o PID,TIME,RES,USER -p $(pidof in.mohalla.sharechat) -d 1 -q > /sdcard/top.txt // For Instagram: top -o PID,TIME,RES,USER -p $(pidof com.instagram.android) -d 1 -q > /sdcard/top.txt
- Ctrl + C (to stop recording)
- exit (to Exit from Shell)
- adb pull /sdcard/top.txt .
- generateCsv ShareChat
Output csv file is saved in ./outputs/ folder in project root. Import this csv in Google Sheet/Spreadsheet program to visiualize the data.
Install Local npm package
npm link
Create shortcuts
- Edit and add following methods in your
~/.bash_profile
recordtop() {
if [ $# -eq 0 ]
then
pckg="in.mohalla.sharechat"
else
pckg="$1"
fi
adb shell monkey -p $pckg -c android.intent.category.LAUNCHER 1
echo "\n\nNext Steps:"
echo "1. First Shell command is copied, Paste!"
part1="top -o PID,TIME,RES,USER -p $"
part2="(pidof "
part3="$pckg"
part4=") -d 1 -q > /sdcard/top.txt"
echo $part1$part2$part3$part4| pbcopy
echo "2. Ctrl + C to stop recording"
echo "3. exit (to Exit Shell)"
echo "4. Run tocsv [Label], eg. tocsv ShareChat\n\n"
adb shell
}
tocsv() {
if [ $# -eq 0 ]
then
label="ShareChat"
else
label="$1"
fi
adb pull /sdcard/top.txt .
mkdir -p outputs
generateCsv $label
rm top.txt
open ./outputs/
}
- Save
- Run
source ~/.bash_profile
from a new terminal - Run
recordtop com.instagram.android
to open Instagram App and initiate shell session. - Follow the instructions on the Terminal
- After recording, run
tocsv Instagram
, this will generate csv.