Skip to main content

A Profiling Library for Python

Project description

tinyprofiler

Tiny Profiler is a sub 200 line profiling utility that records telemetry from your app, provides metrics and a flame graph to help debug latency and throughput.

Installation

pip install tinyprofiler

Usage

from tinyprofiler import Observer

observer = Observer()

@observer.profile()
def your_function():
  # do something

img

API

Observer

Observer(num_samples: int = 10, enabled: bool = True)

  • num_samples (optional): The number of samples to collect. You can configure how many samples to collect during profiling. The default is 10.

  • enabled (optional): You can enable or disable profiling using this parameter. By default, profiling is enabled (True).

Observer.profile (decorator)

profile(self, trace: str = '__main__', parent: bool = False) -> None:

  • trace (optional) - the trace to group functions together

  • parent (optional): Set this to True if you want to treat the decorated function as a parent node in the flame graph hierarchy.

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

tinyprofiler-0.1.8.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

tinyprofiler-0.1.8-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

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