dull
This is a plain and boring package providing one decorator for dumping profile stats to console or to a file for further inspections.
There are a million of nice packages providing decorators and context managers that can dump cProfile stats and generate visual stuff from them. But usually that is a little too much for just taking a peek at performance of a function. I found myself writing this wrapper again and again or copypasting it around, so why not package it for convenience?
Install with pip:
pip install dull
Wrap a function with profiler:
from dull import profile
@profile()
def foo():
print("well hello")
print("hello there")
foo()
print("goodbye")
Output:
hello there
well hello
---------------------------------------profile foo---------------------------------------
3 function calls in 0.000 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 joku.py:4(foo)
1 0.000 0.000 0.000 0.000 {built-in method builtins.print}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
-----------------------------------------------------------------------------------------
goodbye
Dump profile to file:
@profile(to_file=True) # output defaults to profile/foo.dat
def foo():
print("well hello")
Output:
hello there
well hello
--------------------------foo: profile saved to profile/foo.dat--------------------------
goodbye
Files are plain pstat dumps, get fancy with snakeviz or similar visualizers:
snakeviz profile/foo.dat
Metadata
Release files for dull 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dull-1.0.0.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dull-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.2 kB
Release files / dull-1.0.0.tar.gz
| Download URL | dull-1.0.0.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
513944e2896c9a1054a86a905486471e2c4425ab3063153ca9df6324167da689
|
|
BLAKE2b-256 checksum How to use checksums |
f5096af73e4ad7631109fcc252a45f02b7f2fd65e2ba526d00cf387fcb25e2e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.10 Linux/5.4.0-110-generic
|
Release files / dull-1.0.0-py3-none-any.whl
| Download URL | dull-1.0.0-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a6fa94feb925c92126a8b39827d5a3c36312792cf6923d6c1c63ec137075d6f
|
|
BLAKE2b-256 checksum How to use checksums |
645b3d3d36320e712b2efde7f4bb49c1acbf859b6a5cdb5b490a857430ec29de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.10 Linux/5.4.0-110-generic
|