How to take systrace in android

  • Install python 2.7. As systrace does not support python 3.6. Python has its own package manager 'pip'. Use it to install new packages.
        download python2.7
  • install pywin32 and six module on windows. Open power shell in C:/Python27/Scripts path,
         pip install pywin32
         pip install six 
  • Above packages are not required to be installed on Ubuntu. But if you want other packages of python, we have to install python-pip, however not required for systrace.
          sudo apt install python-pip

       Then do pip list to see what packages are installed in Ubuntu.
  • Install android studio
       Start android studio from the downloaded android studio. That will
       have a script to start android studio. In my case its here

        ~/Downloads/android-studio/bin/studio.sh

       Run it and open a blank activity.

       Open SDK Manager as given in image below,



       Now install android studio SDK tools for adb, systrace script and
       other tools etc, as given in image below,



  • Once everything is installed, you will get a new directory Android. These tools are installed in this directory. On Ubuntu it will be on $HOME, and on Windows, it will be inside user>username>AppData>local. AppData directory is hidden in windows 10 so un hide it from view>organise folders tab.
  • Now open power shell in windows or terminal in Ubuntu. Run below command,

           ~/Android/Sdk/platform-tools/systrace$ python systrace.py --list-categories

       Same way go to Android directory in windows at this path,

           C:/Users/Username/AppData/Local/platform-tools/systrace

      Open powershell in this directory and run above command.

       Now we are ready to capture systrace either in windows or Ubuntu. This
       command will list all categories for which we can take systrace. For
       e.g., I want for graphics. To get systrace of graphics module on the
       device,I will run a graphical intensive app on the device. Then run above
       command as below,

         ~/Android/Sdk/platform-tools/systrace$ python systrace.py gfx

      An html file with all data will be generated in systrace folder. Open this file
      which is named as trace.html in Chrome and analyze.

  • References:
        six python module
        pywin32 python module



Comments

Post a Comment

Popular posts from this blog

dev_get_platdata understanding

Getting started with pinctrl subsystem linux