Profilehooks
Python decorators for profiling/tracing/timing a single function
Install / Use
/learn @mgedmin/ProfilehooksREADME
profilehooks
.. image:: https://github.com/mgedmin/profilehooks/actions/workflows/build.yml/badge.svg?branch=master :target: https://github.com/mgedmin/profilehooks/actions
.. image:: https://coveralls.io/repos/mgedmin/profilehooks/badge.svg?branch=master :target: https://coveralls.io/r/mgedmin/profilehooks
It's a collection of decorators for profiling functions. E.g. to profile a single function::
from profilehooks import profile
@profile
def my_function(args, etc):
pass
The results will be printed when the program exits (or you can use
@profile(immediate=True)).
If you're interested in coarse timings and don't want to pay for the overhead of profiling, use ::
from profilehooks import timecall
@timecall # or @timecall(immediate=True)
def my_function(args, etc):
pass
Finally, you may be interested in seeing line coverage for a single function ::
from profilehooks import coverage
@coverage
def my_function(args, etc):
pass
Also functions can be available in Python console or module if run it with -m arg ::
$ python -m profilehooks
>>> profile
<function profile at 0x1005c6488>
$ python -m profilehooks yourmodule
Full documentation is available through pydoc profilehooks after
installation.
The home page for this module is https://mg.pov.lt/profilehooks. It has screensho, uh, that is, more examples.
Related Skills
node-connect
339.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.8kCommit, push, and open a PR
