Win7下systrace环境配置

D:\Android\android-sdk-windows\tools\monitor.bat工具可以用来抓systrace
高通文档KBA-161123204012讲得非常好。
python2.7下载地址:
https://www.python.org/downloads/release/python-2717/
我下载的是当时最新的版本:python-2.7.17.amd64.msi
加入以下环境变量:
C:\Python27;C:\Python27\Scripts;D:\Android\android-sdk-windows\platform-tools\systrace

为什么是安装Python2.7?因为systrace工具报错提示要在Python2.7环境下运行。

安装好Python2.7配置好环境后,运行报错:
C:\Users\Administrator>systrace.py --list-categories

Traceback (most recent call last):
  File "D:\Android\android-sdk-windows\platform-tools\systrace\systrace.py", line 48, in 
    from systrace import run_systrace
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 41, in 
    from devil import devil_env
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\devil_env.py", line 32, in 
    import dependency_manager  # pylint: disable=import-error
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\dependency_manager\dependency_manager\__init__.py", line 29, in 
    from .archive_info import ArchiveInfo
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\dependency_manager\dependency_manager\archive_info.py", line 9, in 
    from dependency_manager import exceptions
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\dependency_manager\dependency_manager\exceptions.py", line 5, in 
    from py_utils import cloud_storage
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\common\py_utils\py_utils\cloud_storage.py", line 22, in 
    from py_utils import lock
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\common\py_utils\py_utils\lock.py", line 20, in 
    import win32con
ImportError: No module named win32con

到网站:https://pypi.org/project/pypiwin32/220/ 下载pywin32-227-cp27-cp27m-win_amd64.whl
cmd执行命令:
C:\Python27\Scripts\pip2.7.exe install pywin32-227-cp27-cp27m-win_amd64.whl

之后报错:

C:\Users\Administrator>systrace.py
Traceback (most recent call last):
  File "D:\Android\android-sdk-windows\platform-tools\systrace\systrace.py", line 48, in 
    from systrace import run_systrace
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 43, in 
    from systrace import systrace_runner
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\systrace\systrace\systrace_runner.py", line 11, in 
    from systrace import output_generator
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\systrace\systrace\output_generator.py", line 15, in 
    from tracing.trace_data import trace_data
  File "D:\Android\android-sdk-windows\platform-tools\systrace\catapult\tracing\tracing\trace_data\trace_data.py", line 17, in 
    import six
ImportError: No module named six

在网站:https://pypi.org/project/six/#files搜索six下载six-1.13.0-py2.py3-none-any.whl
cmd执行命令:
C:\Python27\Scripts\pip2.7.exe install C:\Users\Administrator\Downloads\six-1.13.0-py2.py3-none-any.whl

C:\Users\Administrator>C:\Python27\Scripts\pip2.7.exe install C:\Users\Administrator\Downloads\six-1.13.0-py2.py3-none-any.whl
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained a
ate. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa
st/development/release-process/#python-2-support
Processing c:\users\administrator\downloads\six-1.13.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.13.0

以下升级的估计没啥用:
python -m pip install --upgrade pip
终于好了,贴一下成功的截图:

C:\Users\Administrator>systrace.py --list-categories
         gfx - Graphics
       input - Input
        view - View System
     webview - WebView
          wm - Window Manager
          am - Activity Manager
          sm - Sync Manager
       audio - Audio
       video - Video
      camera - Camera
         hal - Hardware Modules
         app - Application
         res - Resource Loading
      dalvik - Dalvik VM
          rs - RenderScript
      bionic - Bionic C Library
       power - Power Management
          pm - Package Manager
          ss - System Server
    database - Database
     network - Network
         adb - ADB
         pdx - PDX services
       sched - CPU Scheduling
         irq - IRQ Events
        freq - CPU Frequency
        idle - CPU Idle
        disk - Disk I/O
         mmc - eMMC commands
        load - CPU Load
        sync - Synchronization
       workq - Kernel Workqueues
  memreclaim - Kernel Memory Reclaim
  regulators - Voltage and Current Regulators
  binder_driver - Binder Kernel driver
  binder_lock - Binder global lock trace
   pagecache - Page cache

你可能感兴趣的:(Android学习之路,Andoid系统常用修改,Android源码分析)