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.10.tar.gz (7.8 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.10-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flametracker-0.0.10.tar.gz
  • Upload date:
  • Size: 7.8 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.10.tar.gz
Algorithm Hash digest
SHA256 31f544ea2012fa90c68cd3384421e0c748e9c06d2bb88d2e5f347e90cf2debd9
MD5 2858fc4b78e51d94b7c5b1f61c958224
BLAKE2b-256 13b0564c869302f844e4900bb2dcfc3b687453edb9a7291b442c7d2b2e60e835

See more details on using hashes here.

Provenance

The following attestation bundles were made for flametracker-0.0.10.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.10-py3-none-any.whl.

File metadata

  • Download URL: flametracker-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 9.6 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 428924cc845d1dd0e580f8780c8061b68a9dc7fd7f1a3f3424a80cbe31661848
MD5 4ae608e88f151e08d5f62f46a934b5b7
BLAKE2b-256 1040af682194fb6b2df3c9ceba17fff97a6dfcd01c6c5c796008615b379166ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for flametracker-0.0.10-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