Skip to content

Instantly share code, notes, and snippets.

@axelborja
axelborja / profiling_python.py
Last active June 13, 2023 03:57
Profile your python code using CProfile or Yappi and KCachegrind / QCachegrind
################
# CPROFILE #
#############################################################################
# 1 - Profile myfunc() from ipython
import cProfile
filename = 'filename.prof'
cProfile.run('myfunc()', filename)
# 2 - Convert your file to a usable kcachegrind file in your shell