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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f357f3e49c77a0aef5cc026773fb74bd0f259bffb073ed0dfc9d3d0645f92cd3
|
|
| MD5 |
d60974f24503f5b429edf23a5afa4305
|
|
| BLAKE2b-256 |
17ffccd52da463635b8e035cd8e7e5b6c8b42cb3d12f312545ac35acfe361ad8
|
Provenance
The following attestation bundles were made for flametracker-0.0.4.tar.gz:
Publisher:
workflow.yml on EtienneMR/flametracker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flametracker-0.0.4.tar.gz -
Subject digest:
f357f3e49c77a0aef5cc026773fb74bd0f259bffb073ed0dfc9d3d0645f92cd3 - Sigstore transparency entry: 189077372
- Sigstore integration time:
-
Permalink:
EtienneMR/flametracker@6559696b89cd57f2bf82e4eaa2ba2b6f42e13e55 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/EtienneMR
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@6559696b89cd57f2bf82e4eaa2ba2b6f42e13e55 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb7e1fd4866595903437f387d6bc400a715e99185d09a9b8a3af6ec11f4ca256
|
|
| MD5 |
8afe43e362fd1243939bb3f63318e926
|
|
| BLAKE2b-256 |
d790d85accf6187549763e7d4ca3412e7dc1df904f13a59ccf7126889c6c341d
|
Provenance
The following attestation bundles were made for flametracker-0.0.4-py3-none-any.whl:
Publisher:
workflow.yml on EtienneMR/flametracker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flametracker-0.0.4-py3-none-any.whl -
Subject digest:
cb7e1fd4866595903437f387d6bc400a715e99185d09a9b8a3af6ec11f4ca256 - Sigstore transparency entry: 189077373
- Sigstore integration time:
-
Permalink:
EtienneMR/flametracker@6559696b89cd57f2bf82e4eaa2ba2b6f42e13e55 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/EtienneMR
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@6559696b89cd57f2bf82e4eaa2ba2b6f42e13e55 -
Trigger Event:
push
-
Statement type: