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.5.tar.gz (13.0 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.5-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lblprof-0.1.5.tar.gz
  • Upload date:
  • Size: 13.0 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.5.tar.gz
Algorithm Hash digest
SHA256 d547c53ed99764f40c919cea2241492df610ff2144094f0a8c0f52747d4bfc76
MD5 bdfc750acaa2ff049234dccc15a6f146
BLAKE2b-256 9ea70de7e390f3af9ad54a25de75b28163b41b3a50be115304b409a4fa678809

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lblprof-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 13.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 40ebf5c16597dfeba3886165766059d80b17afdf57bf88c6455d8db51038dd00
MD5 564fb51482c892405610b70de3df8e1b
BLAKE2b-256 76220e8c5284a87c7f277b7e7e99a56beb82eedd50efe3f7ff155c62ec4fb285

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