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

Uploaded Python 3

File details

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

File metadata

  • Download URL: flametracker-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 f357f3e49c77a0aef5cc026773fb74bd0f259bffb073ed0dfc9d3d0645f92cd3
MD5 d60974f24503f5b429edf23a5afa4305
BLAKE2b-256 17ffccd52da463635b8e035cd8e7e5b6c8b42cb3d12f312545ac35acfe361ad8

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: flametracker-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cb7e1fd4866595903437f387d6bc400a715e99185d09a9b8a3af6ec11f4ca256
MD5 8afe43e362fd1243939bb3f63318e926
BLAKE2b-256 d790d85accf6187549763e7d4ca3412e7dc1df904f13a59ccf7126889c6c341d

See more details on using hashes here.

Provenance

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