Skip to main content

Perfwatch

Perfwatch is a python package that allows you to monitor the performance of your code. It is designed to be used in a Jupyter notebook, but can also be used in a Python script.

Table of Contents

Installation

To install perfwatch, run the following command:

pip install perfwatch

Development

To install perfwatch for development, clone the repository and run the following command:

poetry install

To setup pre-commit hooks, run the following command:

poetry run pre-commit install

To run the tests, run the following command:

poetry run pytest

Usage

Available Profiler Types

The profiler supports the following profiler types:

  • cpu: Profiles CPU usage using the cProfile module.
  • memory: Profiles memory usage using the memory_profiler module.
  • thread: Profiles thread creation and usage.
  • io: Profiles I/O operations.
  • network: Profiles network traffic using the NetworkProfiler class.
  • gpu: Profiles GPU usage using the GPUProfiler class.
  • cache: Profiles cache performance (not implemented).
  • exception: Profiles exception handling (not implemented).
  • system: Profiles system performance (not implemented).
  • distributed: Profiles distributed system performance (not implemented).
  • line: Profiles line-by-line execution using the line_profiler module.
  • time: Profiles execution time.

Basic Usage

from perfwatch import watch

@watch(["line", "cpu", "time"])
def test():
    for _ in range(1000000):
        pass

if __name__ == "__main__":
    test()

Customizing Profiling

You can customize the profiling behavior by passing additional keyword arguments to the watch decorator. For example:

@watch(["network"], packet_src="localhost")
def my_function(x, y):
    # function implementation
    pass

Logging

You can log the profiling results to a file by assigning LOG_FILE_PATH envar to desired file location

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for perfwatch 1.6.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for perfwatch 1.6.5
File Size Uploaded Provenance Actions
perfwatch-1.6.5.tar.gz 8.0 kB Without provenance Details for perfwatch-1.6.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for perfwatch 1.6.5
File Interpreter ABI Platform Actions
perfwatch-1.6.5-py3-none-any.whl Python 3 none any Details for perfwatch-1.6.5-py3-none-any.whl

Total release size: 19.7 kB

Release files / perfwatch-1.6.5.tar.gz

Download URL perfwatch-1.6.5.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f5557b235a241669496405709c163aeb1eaa3583c27bd3216615eaa2b2352a11
BLAKE2b-256 checksum
How to use checksums
c073b7f67ea4bad7b4a6b07ae121d687969fdf4baa4a66a1a9f3e1ee0de6b1f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1025-azure

Release files / perfwatch-1.6.5-py3-none-any.whl

Download URL perfwatch-1.6.5-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7011e4164ae68c9ebfd949fa47d17c47c313881a99cefccfca417ae5a3cf987
BLAKE2b-256 checksum
How to use checksums
01bd4a75abf4a8dc26cb404a3efc32b58af19e0f981f17c50dd0845a8c0de1e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1025-azure

Security for perfwatch 1.6.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page