Forrest logo
back to the py-spy tool

py-spy:tldr:83d59

py-spy: Produce an SVG flame graph of the function call execution time.
$ py-spy record -o ${path-to-profile-svg} --pid ${pid}
try on your machine

This command uses the "py-spy" tool to record the Python program's execution and generate a profiling report in SVG format.

Here's the breakdown of the command:

  • "py-spy": This is the name of the tool or command-line utility being executed.

  • "record": This is the action or subcommand to instruct "py-spy" to start recording the program's execution.

  • "-o ${path-to-profile-svg}": This option specifies the output file path for the generated profiling report in SVG format. You need to replace "${path-to-profile-svg}" with the actual desired path.

  • "--pid ${pid}": This option indicates the process ID (PID) of the Python program you want to profile. Replace "${pid}" with the specific PID you want to target.

Together, the command tells the "py-spy" tool to start recording the execution of a Python program with a specific PID and save the profiling report in SVG format at the provided file path.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the py-spy tool