Python/C Profiler Functions
If a performance bottleneck occurs when you run a Python or Python and C/C++ hybrid program, you can use this tool to analyze hotspot functions and locate code problems.
Prerequisites
- The Python/C Profiler has been installed. See Installing the Tool.
- If you have installed the tool using a compressed package, decompress the package and switch to the tool directory. Then run the command in ./ mode, for example, ./devkit py-perf -h. If you have installed the tool using an RPM package, run devkit py-perf -h. This section uses an RPM package as an example.
Command Function
Uses ptrace to sample Python programs and Python & C/C++ hybrid programs, analyzes call stacks, obtains top 20 hotspot functions, and draws flame graphs.
Syntax
1 | devkit py-perf [-h | --help] TASK [ARGS] |
Example
View the information about Python/C performance analysis functions:
1 | devkit py-perf -h |
Command output:
1 2 3 4 5 6 7 | Usage: devkit py-perf [-h | --help] TASK [ARGS] The most commonly used devkit py-perf sub tasks are: help Get help information hotspot Run the hotspot collection and analysis task See 'devkit py-perf TASK --help' for more information on a specific task. |
Function |
Description |
|---|---|
help |
Displays help information. |
hotspot |
Python/C performance hotspot analysis. |
Parent topic: Python/C Profiler