Skip to main content

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:

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 stats
  • show_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lblprof-0.1.7.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lblprof-0.1.7-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file lblprof-0.1.7.tar.gz.

File metadata

  • Download URL: lblprof-0.1.7.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for lblprof-0.1.7.tar.gz
Algorithm Hash digest
SHA256 fe8bdce52095b5c0d31836ce78603836163d5933265ea2d7dbde5326f7ea1072
MD5 ae0539c9f7d193a698479f22a933608d
BLAKE2b-256 d3e3eeebe1a01adf88b888826e7fe1833b71f2b50ac83846a4a1c0b74172066c

See more details on using hashes here.

File details

Details for the file lblprof-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: lblprof-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for lblprof-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e39e67ffca1e02072ca0c47de606133cd7bd7d1cfdeca689877bad6247b48417
MD5 dd8e1cbf6be15858643012774a121248
BLAKE2b-256 08098e48bc1872b067608aececcac18aa89f9c6e8e167053b5102460ab326a3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page