Today, the command of the day is hotspot2calltree.
I do like a lot using kcachegrind to tune my C++ code. You can use KCacheGrind to navigate through the actual function calls in a given execution of your program and seeing very graphically where the time is spent.
Today i needed to optimize some python code but that's not C++ code. No problem. Add in your code this:
import hotshot
prof = hotshot.Profile("profile.hotspot")
prof.runcall(myFunction)
prof.close()
And then, at the shell:
sudo apt-get install kcachegrind-converters
hotspot2calltree -o profile.callgrind profile.hotspot
kcachegrind profile.callgrind
And now you get a nice kcachegrind profile you can navigate on.
No comments:
Post a Comment