• Stars
    star
    315
  • Rank 128,578 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 12 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python decorators for profiling/tracing/timing a single function

profilehooks

https://github.com/mgedmin/profilehooks/workflows/build/badge.svg?branch=master https://ci.appveyor.com/api/projects/status/github/mgedmin/profilehooks?branch=master&svg=true https://coveralls.io/repos/mgedmin/profilehooks/badge.svg?branch=master

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.

More Repositories

1

objgraph

Visually explore Python object graphs
Python
686
star
2

check-manifest

Tool to check the completeness of MANIFEST.in for Python packages
Python
282
star
3

restview

ReStructuredText viewer
Python
210
star
4

indicator-netspeed

Stupid network speed indicator for Unity, inspired by the old netspeed GNOME applet
C
103
star
5

findimports

Static analysis of Python import statements
Python
103
star
6

dozer

WSGI middleware for profiling CPU/memory and inspecting logs
Python
86
star
7

irclog2html

Convert IRC logs to HTML
Python
80
star
8

coverage-highlight.vim

Vim plugin to highlight Python source code lines that lack test coverage
Python
56
star
9

strace-process-tree

Tool to help me make sense out of `strace -f` output.
Python
50
star
10

pdf2html

Wrapper for pdftohtml that tries to extract paragraph structure
Python
49
star
11

python-imports.vim

Vim plugin that adds Python import statements semi-automatically
Vim Script
47
star
12

imgdiff

Compare two images side-by-side
Python
44
star
13

ghcloneall

Script to clone/update all user/organization repos from GitHub
Python
34
star
14

zodbbrowser

ZODB browser
Python
18
star
15

check-python-versions

Check that supported Python versions in a setup.py match tox.ini, .travis.yml and a bunch of other files
Python
18
star
16

scripts

My ~/bin
Shell
16
star
17

bootable-iso

Bootable USB disk that lets you choose an ISO image
Python
16
star
18

memgraphinator

Graph the memory usage of a single process
Python
16
star
19

dotvim

My ~/.vim
Vim Script
15
star
20

dotfiles

My personal Linux shell settings
Shell
12
star
21

gitlab-jobs

Show a summary of GitLab job durations
Python
11
star
22

mgp2pdf

MagicPoint to PDF converter
Python
8
star
23

taghelper.vim

vim plugin that shows the current function/tag in the statusline
Python
7
star
24

chelper.vim

Vim plugin that shows the current C function name in the status line
Python
7
star
25

webtreemap-du

Visualize disk usage using web-based treemaps
Python
7
star
26

project-summary

Script to generate a summary page for all my projects.
JavaScript
6
star
27

vboxpanel

Simple webapp to control headless VirtualBox machines
Python
6
star
28

pyspacewar

A game with Newtonian mechanics
Python
5
star
29

Inupy

Abandoned fork to turn Dozer into Pylons debug tool
JavaScript
5
star
30

test-switcher.vim

Vim plugin that switches between code and tests
Python
4
star
31

eazysvn

Subversion branching and merging made a bit easier
Python
4
star
32

ztk-py3-status

Produce a list of Zope Foundation packages and Python versions they support
Python
3
star
33

qml-time-tracker

A prototype user interface of a time tracking application for the Nokia N9
C++
3
star
34

pytag.vim

Vim plugin: a smarter :tag for Python projects
Python
3
star
35

python-project-skel

Reusable Makefile rules for automating Python package releases
Makefile
3
star
36

gitlab-trace

Show a GitLab pipeline status or job trace
Python
3
star
37

ppa-copy-packages

Copy Ubuntu PPA packages from one release pocket to another
Python
3
star
38

pythonhelper.vim

Displays Python class, method or function the cursor is in on the status line
Python
2
star
39

source-locator.vim

Vim plugin to find the source line from filename + line number
Python
2
star
40

ubuntu-images

Makefile that downloads Ubuntu ISO images and verifies them
Makefile
2
star
41

SnakeMUD

A 48-hour game for the Global Game Jam 2012
JavaScript
2
star
42

planet-mg

Blogs I read
JavaScript
2
star
43

gedmin.as

Blogofile source for http://gedmin.as/
Mako
2
star
44

py-test-runner.vim

Run (Python) unit tests under cursor
Python
2
star
45

adventofcode2020

Python
1
star
46

zcml-tool

Hacks to parse and analyze ZCML files because I got sick of tracing them by hand
Python
1
star
47

ShoppingList

A mobile web app for my own use
Python
1
star
48

vim-plugins

ghcloneall config for Vim plugins I maintain
Shell
1
star
49

ep2013-dojo

EuroPython 2013 coding dojo: write a Scorched Earth clone in 60 minutes
Python
1
star
50

check-pypi-wheels

Check if PyPI has the right wheels available for a set of packages
Python
1
star
51

letsencrypt-java

Adding LetsEncrypt root certificates to the Java keystore on Windows. Obsolete.
Batchfile
1
star
52

repozo-testcases

Some ad-hoc functional testcases to reproduce repozo (the ZODB online backup tool) bugs
Python
1
star
53

python-refactorings.vim

Vim plugin for a bunch of hacky random Python code refactorings
Vim Script
1
star