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.6.tar.gz (13.3 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.6-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lblprof-0.1.6.tar.gz
  • Upload date:
  • Size: 13.3 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.6.tar.gz
Algorithm Hash digest
SHA256 c1424ddbf5f56633831c4a70c85ded42c00f3b26b140c715a6d9232d69425fe1
MD5 81eed41a6fe6c6abd3cad0f3bd6dc37e
BLAKE2b-256 0524e13f0283e30a5c257821d1d53bd9fddbfb91c3788445979ab8a3feac9aec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lblprof-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 13.7 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0a82f21a7e815b47481dc30e137cc5b3d9523ffb916e6b3a85cfa1554c08750f
MD5 bd2aacfce248a595bf5de19207f60218
BLAKE2b-256 57b030f2db429043017d02bca215eb01bf9247d8facee9fad5a97dd80dd13a35

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