Last active
October 5, 2016 09:48
-
-
Save nvdv/40960e333187eaaf562a288613a3f981 to your computer and use it in GitHub Desktop.
How profilers work - summary deterministic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_summary(stats, total_time): | |
print('Total time: %f s' % total_time) | |
for f_name in stats: | |
func_time = 0 | |
for caller in stats[f_name]: | |
func_time += stats[f_name][caller] | |
percentage = float(func_time) / total_time | |
print('Function: %s, caller: %s, function run time: %f s, percentage: %f %%' % ( | |
f_name, caller, func_time, 100 * percentage)) | |
print_summary(stats, total_time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment