1.0.2 • Published 6 months ago

top2csv v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

How to generate Csv

  1. source ~/.bash_profile (Optional, in case you don't have adb in your $PATH)
  2. adb shell (To Enter Shell)
  3. 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
  4. Ctrl + C (to stop recording)
  5. exit (to Exit from Shell)
  6. adb pull /sdcard/top.txt .
  7. 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

  1. 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/
}
  1. Save
  2. Run source ~/.bash_profile from a new terminal
  3. Run recordtop com.instagram.android to open Instagram App and initiate shell session.
  4. Follow the instructions on the Terminal
  5. After recording, run tocsv Instagram, this will generate csv.
1.0.2

6 months ago

1.0.1

6 months ago