Skip to main content

A script tracking utility to generate flamegraph

Project description

FlameTracker Library

Overview

The FlameTracker library provides a way to track and visualize function calls and execution times within Python programs. It includes features like:

  • Hierarchical action tracking
  • Timing of function calls
  • JSON and string representation of call structures
  • Flamegraph generation for performance visualization

Installation

To use the FlameTracker library, install it in your Python environment:

pip install flametracker

Usage

Basic Tracking

import flametracker

with flametracker.Tracker() as tracker:
    with tracker.action("example_action"):
        # Some computation here
        pass

print(tracker.to_str())

Nested Actions

import flametracker

with flametracker.Tracker() as tracker:
    with tracker.action("parent_action") as parent:
        with tracker.action("child_action") as child:
            child.set_result("Hello for child !")

Function Wrapping

import flametracker

@flametracker.wrap
def my_function(x):
    return x * 2

with flametracker.Tracker() as tracker:
    result = my_function(5)

Generating a Flamegraph

html_output = tracker.to_flamegraph()
with open("flamegraph.html", "w", encoding="utf-8") as f:
    f.write(html_output)

Running Tests

To run the test suite using pytest, execute:

pytest

License

This project is licensed under the MIT License.

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

flametracker-0.0.9.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

flametracker-0.0.9-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file flametracker-0.0.9.tar.gz.

File metadata

  • Download URL: flametracker-0.0.9.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for flametracker-0.0.9.tar.gz
Algorithm Hash digest
SHA256 5d525c94192077ae691891d2f0aa8f960471105a8b112b80d14521e6b01775fd
MD5 825363624c32460337726945395ab004
BLAKE2b-256 586cc80115147faadd473e7b54e54ea5669877cea9bd79da9ff35c19d7cbed17

See more details on using hashes here.

Provenance

The following attestation bundles were made for flametracker-0.0.9.tar.gz:

Publisher: workflow.yml on EtienneMR/flametracker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flametracker-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: flametracker-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for flametracker-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f746eac1d8ae9f153404a69c65d4134ec21b262b47b36a65cb1fd115bba5b0ee
MD5 062bff9d3233bea3f6c0bfd119cfc111
BLAKE2b-256 23491d3c05e2b38ef04b25f84fcc4a6f951e631d54864b8dd11516cc64da6ac2

See more details on using hashes here.

Provenance

The following attestation bundles were made for flametracker-0.0.9-py3-none-any.whl:

Publisher: workflow.yml on EtienneMR/flametracker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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