Line by line terminal based profiler
Project description
LBLProf
LBLProf is simple a line by line terminal based time profiler. It allows you to track the duration of each line and get a tree of the execution of the code.
It comes with a simple interactive terminal UI to navigate the tree and see the stats of each line. Example of the terminal ui:
[!WARNING] LBLProf is a tool that is based on the sys.monitoring API that is available in Python 3.12 and above. It means that you need to use Python 3.12 or above to use it.
Documentation
Installation
pip install lblprof
The only dependency of this package is pydantic, the rest is standard library.
Usage
This package contains 4 main functions:
start_tracing(): Start the tracing of the code.stop_tracing(): Stop the tracing of the code, build the tree and compute statsshow_interactive_tree(min_time_s: float = 0.1): show the interactive duration tree in the terminal.show_tree(): print the tree to console.
from lblprof import start_tracing, stop_tracing, show_interactive_tree, show_tree
start_tracing()
# Your code here (Any code)
stop_tracing()
show_tree() # print the tree to console
show_interactive_tree() # show the interactive tree in the terminal
How it works
LBLProf is based on the sys.monitoring API that is available in Python 3.12 and above. PEP 669
This new API allow us to cut down tracing when we are entering installed package and limit the tracing to the code of the user.
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 lblprof-0.1.8.tar.gz.
File metadata
- Download URL: lblprof-0.1.8.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3811f292e5d46153ec5ea02e91587ee3f7576584ef4ca58c7d539af4bbd9a964
|
|
| MD5 |
0d68da67650c3b1d0b1f519776d9cef7
|
|
| BLAKE2b-256 |
d2c261cecde03bb83f4055e34827cd220ff377e7e9b1a0f53c1eb6b1f4b852ad
|
File details
Details for the file lblprof-0.1.8-py3-none-any.whl.
File metadata
- Download URL: lblprof-0.1.8-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
975b3875c397e2b7087840e0994db8fc2d582dfd85a77bcda0482f9e9f70b108
|
|
| MD5 |
b4914c0718be25845714e73a0acd950b
|
|
| BLAKE2b-256 |
c2607615af78bbb6ea6d6fabac7ea213e510c36dca44a7eac16830bd2b1fdd31
|