Skip to main content

A Python performance tracking package

Project description

PerfTracker

PerfTracker is a Python performance tracking package. It allows you to measure and record the execution time of your functions. The package provides a decorator you can add to any function to track its performance.

Features

  • Easy to use: Simply add a decorator to your functions.
  • Flexible: Set a maximum number of entries to keep for each function.
  • Detailed statistics: Get the execution times and calculate the average calls per minute over a certain period.

Installation

Install PerfTracker with pip:

pip install perftracker

Usage

Here is a quick example:

from perftracker import perf, get_stats

@perf(max_entries=100)
def my_function():
    # Your code here...

# Get performance statistics
stats = get_stats()

Methods

  • perf(max_entries=None): A decorator to measure and record the execution time of a function. If max_entries is set, it will limit the number of records kept for the function to this value.
  • get_stats(): Returns the current Performance instance, which contains all recorded performance data.
  • Performance.add(function_name, exe_time, max_entries=None): Adds an execution time record for a function.
  • Performance.get(function_name): Returns the execution time records for a function.
  • Performance.cpm(function_name, time_delta): Calculates the average calls per minute (CPM) of a function over a certain period.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the terms of 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

perftracker-0.1.2.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file perftracker-0.1.2.tar.gz.

File metadata

  • Download URL: perftracker-0.1.2.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for perftracker-0.1.2.tar.gz
Algorithm Hash digest
SHA256 39cb72177665540b25c2d1b0cf52c4ee72776b7a34870145edf607b330a835b5
MD5 5f7399294a96570ce95cfcd6ccfcb2ac
BLAKE2b-256 3a3881cf251ec6394a98385db3ccc2a314e5a5b86f42635765d9f09962a749c0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page