一个交互式的Python分析器:Profiling
jopen
11年前
该分析包是一个交互式的Python分析器。它受Unity 3D分析器启发。这个包提供了以下功能:
- 剖析统计数据保持架堆栈。
- 一个交互式TUI分析统计查看器。
- 进行远程分析的工具。
- 线程或greenlet感知的CPU定时器。
- 支持的Python2和Python3。
Profiling
To profile a single program, simply run profile
command:
$ python -m profiling profile your-program.py
Then an interactive viewer will be executed:
If your program uses greenlets, choose greenlet
timer:
$ python -m profiling profile your-program.py --timer=greenlet
With --dump
option, it saves the profiling result to a file. You can browse the saved result by using the view
command:
$ python -m profiling profile your-program.py --dump=your-program.prf $ python -m profiling view your-program.prf