Differences between revisions 1 and 2
Revision 1 as of 2009-11-13 12:45:28
Size: 1090
Editor: PaulBoddie
Comment: A short summary of the useful lsprofcalltree.py tool and KCachegrind.
Revision 2 as of 2010-01-29 22:41:19
Size: 1119
Editor: PaulBoddie
Comment: Added page to category to make it more accessible.
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
----
CategoryDocumentation

Profiling Python Programs

The lsprofcalltree.py script (referenced in comments on this blog entry) provides output which can then be used by KCachegrind to visualize the most time-consuming functions in a program, presented using tree map, call graph and list views.

The script can be used to run a program as follows:

python lsprofcalltree.py -o output.log yourprogram.py args

Obviously, in the above, yourprogram.py is the program being profiled and args are the desired arguments to be supplied to the program, if any. If the -o option is omitted, a default output file will be chosen based on the name of the profiled program; here, output.log is the file which will contain the profiling results.

Visualising the Output

Once the program has terminated, the results of the profiling activity saved in the output file can be visualised using KCachegrind as follows:

kcachegrind output.log


CategoryDocumentation

PythonSpeed/Profiling (last edited 2022-04-21 22:09:15 by Nudin)

Unable to edit the page? See the FrontPage for instructions.