Profile code regions in python, optionally with LIKWID markers.
Project description
scope-profiler - Python Profiling System with Optional LIKWID Integration
This module provides a unified profiling system for Python applications, with optional integration of LIKWID markers using the pylikwid marker API for hardware performance counters. It allows you to:
- Configure profiling globally via a singleton ProfilingConfig.
- Collect timing data via context-managed profiling regions.
- Use a clean decorator syntax to profile functions.
- Optionally record time traces in HDF5 files.
- Automatically initialize and close LIKWID markers only when needed.
- Print aggregated summaries of all profiling regions.
Documentation: https://max-models.github.io/scope-profiler/
Install
pip install scope-profiler
Usage
from scope_profiler.profiling import (
ProfilingConfig,
ProfileManager,
)
config = ProfilingConfig(
use_likwid=False,
time_trace=True,
flush_to_disk=True,
)
@ProfileManager.profile("main")
def main():
x = 0
for i in range(10):
with ProfileManager.profile_region(region_name="iteration"):
x += 1
main()
ProfileManager.print_summary()
ProfileManager.finalize()
Execution:
❯ python test.py
Profiling Summary:
========================================
Region: main
Number of Calls: 1
Total Duration: 0.000315 seconds
Average Duration: 0.000315 seconds
Min Duration: 0.000315 seconds
Max Duration: 0.000315 seconds
Std Deviation: 0.000000 seconds
----------------------------------------
Region: iteration
Number of Calls: 10
Total Duration: 0.000007 seconds
Average Duration: 0.000001 seconds
Min Duration: 0.000000 seconds
Max Duration: 0.000003 seconds
Std Deviation: 0.000001 seconds
----------------------------------------
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
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 scope_profiler-0.1.tar.gz.
File metadata
- Download URL: scope_profiler-0.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e6a20eca50802bc2b37fa7f6f6b44f3d4150b9db2b1abdd143fd771e24d5afe
|
|
| MD5 |
271b7b5b95af805a70f9c4cf45e371bc
|
|
| BLAKE2b-256 |
24bda42aa42ca82b0ae28e2850b431078e9e42fbcaf82735e061e9a72bdd5cd8
|
Provenance
The following attestation bundles were made for scope_profiler-0.1.tar.gz:
Publisher:
publish.yml on max-models/scope-profiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scope_profiler-0.1.tar.gz -
Subject digest:
7e6a20eca50802bc2b37fa7f6f6b44f3d4150b9db2b1abdd143fd771e24d5afe - Sigstore transparency entry: 700991535
- Sigstore integration time:
-
Permalink:
max-models/scope-profiler@e8464cef6c5b8f57b4764ef68e02d999c905cc98 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/max-models
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e8464cef6c5b8f57b4764ef68e02d999c905cc98 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scope_profiler-0.1-py3-none-any.whl.
File metadata
- Download URL: scope_profiler-0.1-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b67bec5bbce83916b034101c1b883328338cbb182b85d8a74b2493a6c28a4969
|
|
| MD5 |
3f15006b5d4ddb4bc6456bc1caae73f3
|
|
| BLAKE2b-256 |
ca1f3b98b5160f6626effe4e307715c41af979d4d8b07603f43a36c9795aa5ac
|
Provenance
The following attestation bundles were made for scope_profiler-0.1-py3-none-any.whl:
Publisher:
publish.yml on max-models/scope-profiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scope_profiler-0.1-py3-none-any.whl -
Subject digest:
b67bec5bbce83916b034101c1b883328338cbb182b85d8a74b2493a6c28a4969 - Sigstore transparency entry: 700991537
- Sigstore integration time:
-
Permalink:
max-models/scope-profiler@e8464cef6c5b8f57b4764ef68e02d999c905cc98 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/max-models
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e8464cef6c5b8f57b4764ef68e02d999c905cc98 -
Trigger Event:
push
-
Statement type: