No project description provided
Project description
pfhm (Python Function HeatMap tool)
Mini line-by-line timing tool made for debugging functions in Python.
This is not designed to be used as a large scale profiling tool - rather as a quick debugging of small functions.
Supports doc-strings, and multiline function definitions.
Usage
Install via python setup.py install.
See example.py for a full example.
Either use as a decorator,
from pfhm import profile_func
@profile_func
def func(*args, **kwargs):
...
Where the output will be written to out.html, or inline,
profile_func(func, out_file='custom_location.html')(*args, **kwargs).
Example
As in example.py, we call the function
@profile_func
def func(x):
list = []
for i in range(100):
x += 2
list.append([4] * 500)
x += 3
list.append([4] * 10000)
x += 7
return x
And receive the output:
Custom callbacks
You can also pass a custom callback function to profile_func for per line timing functions. For example, for PyTorch you could profile the time spent in the GPU by passing the following callback:
profile_func(func, callback=torch.cuda.synchronize)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pfhm-0.3.tar.gz.
File metadata
- Download URL: pfhm-0.3.tar.gz
- Upload date:
- Size: 92.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
595fe74d6e7413bac35e2bf4fa2dd29b05a03a25672b115ff2e47b9ec1634fc4
|
|
| MD5 |
4d34389d1fbb785427f892d9bfc0ffd1
|
|
| BLAKE2b-256 |
98944868b082ef74749a887f78f162a747eca7a2c175b03a5182893b7f5668d2
|
File details
Details for the file pfhm-0.3-py3-none-any.whl.
File metadata
- Download URL: pfhm-0.3-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79c93124c4092ec6314cb944ce6ef6fed7c718a8763701269f1bcb139aca51a1
|
|
| MD5 |
88aa11aac2704366a71cf7555317125b
|
|
| BLAKE2b-256 |
dee383f0a4df0a0565689ecaf7dc42f63902430d7cab5b36a75d14d70671632c
|