Skip to main content

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

scope_profiler-0.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scope_profiler-0.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

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

Hashes for scope_profiler-0.1.tar.gz
Algorithm Hash digest
SHA256 7e6a20eca50802bc2b37fa7f6f6b44f3d4150b9db2b1abdd143fd771e24d5afe
MD5 271b7b5b95af805a70f9c4cf45e371bc
BLAKE2b-256 24bda42aa42ca82b0ae28e2850b431078e9e42fbcaf82735e061e9a72bdd5cd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for scope_profiler-0.1.tar.gz:

Publisher: publish.yml on max-models/scope-profiler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for scope_profiler-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b67bec5bbce83916b034101c1b883328338cbb182b85d8a74b2493a6c28a4969
MD5 3f15006b5d4ddb4bc6456bc1caae73f3
BLAKE2b-256 ca1f3b98b5160f6626effe4e307715c41af979d4d8b07603f43a36c9795aa5ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for scope_profiler-0.1-py3-none-any.whl:

Publisher: publish.yml on max-models/scope-profiler

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