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.1.0.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.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flametracker-0.1.0.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.1.0.tar.gz
Algorithm Hash digest
SHA256 57187f8e62d31d6881aa154349e96f3d92b91c4e838aa529d961c5a623b4d295
MD5 2a7fca0aca8d500f16b1c45bac8c58d0
BLAKE2b-256 c04b1819dba8b89c57dec82c2144fd7026be7c2ecbc0a70ddb618913e2c925c5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: flametracker-0.1.0-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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80c72d290a804a91e6523ccc66304aad0e583e256cb40ff2539ffdb8ac0b1925
MD5 2ead41d47515c9b0dfdd84e34c2db8b2
BLAKE2b-256 e182a1c477812824b44dc544b3a1f77e46371e4110f2f6fe58f513941bddc5ce

See more details on using hashes here.

Provenance

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