forked from carpentries-incubator/pando-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Episode: Function Level Profiling #3
Copy link
Copy link
Closed
Labels
Description
Learning Objectives
- execute a Python program via
cprofileto collect profiling information about a Python program’s execution - use
snakevizto visualise profiling information output bycprofile - interpret
snakevizviews, to identify the functions where time is being spent during a program’s execution
Exercises
- Example algorithm, with a synthetic bottleneck which produces a clear hierarchy.
- Example algorithm, with a synthetic bottleneck, which produces a more complex hierarchy.
- Example algorithm, with a (hidden) synthetic bottleneck, which leads to a complex function. (to lead into the next episode)
Keypoints
- A python program can be function level profiled with
cprofileviapython -m cprofile -o <output file> <script name/arguments> - The output file from
cprofilecan be visualised withsnakevizviapython -m snakeviz <output file> - Function level profiling output displays the nested call hierarchy, listing both the cumulative and total minus sub functions time.
Reactions are currently unavailable