Skip to main content

Cirron measures how many CPU instructions and system calls a piece of Python code executes.

Project description

Cirron

Cirron measures a piece of Python code and report back several performance counters: CPU instruction count, branch misses, page faults and time spent measuring. It uses the Linux perf events interface or @ibireme's KPC demo on OSX.

It can also trace syscalls using strace, Linux only!

Prerequisites

  • Linux with perf events support / Apple ARM OSX
  • C++
  • Python 3.x

Installation

Clone the repository:

git clone https://github.com/s7nfo/Cirron.git
pip install ./Cirron

The Python wrapper automatically compiles the C++ library (cirronlib.cpp) on first use.

Usage

Performance Counters

from cirron import Collector

# Start collecting performance metrics
with Collector() as collector:
    # Your code here
    # ...

# Retrieve the metrics
print(collector.counters)

Syscalls

from cirron import Tracer, to_tef

with Tracer() as tracer:
    # Your code here
    # ...

# Stop collecting and retrieve the trace
print(tracer.trace)

# Save the trace for ingesting to Perfetto
open("/tmp/trace", "w").write(to_tef(trace))

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

cirron-0.2.1.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

Cirron-0.2.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file cirron-0.2.1.tar.gz.

File metadata

  • Download URL: cirron-0.2.1.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for cirron-0.2.1.tar.gz
Algorithm Hash digest
SHA256 382a53468c89176bde889e4ddc0535b1efffc2d55d7c3387be6f24d59c03b7cf
MD5 8594ffbac55bf255d423f7bbffb53694
BLAKE2b-256 d71cfb9299a35a08df22bee4d5808bb6bb55faf84b97a07008fc19fc448a989f

See more details on using hashes here.

File details

Details for the file Cirron-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: Cirron-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for Cirron-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dff675d947a19128ad414f68706a756826f676820a1e3fbdb7ecc2542d9f1253
MD5 1bbb34d256967c5385c3e25c9612dd78
BLAKE2b-256 b57d03702da2cb9c7a85d4cdba93ea8e56ea27e5aae25eaf0087d24d159f8e8b

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