Skip to main content

No project description provided

Project description

Python interface to CPU counters on Linux

Or, a minimal wrapper around the py-perf-event2 Rust crate, using the Linux perf subsystem.

To install: pip install py-perf-event

Example

from py_perf_event import measure, Hardware

[instructions1] = measure([Hardware.INSTRUCTIONS], sum, range(1_000_000))
print(instructions1)
[instructions2] = measure([Hardware.INSTRUCTIONS], sum, range(10_000_000))
print(instructions2)
assert instructions1 > 1_000_000
assert 7 < (instructions2 / instructions1) < 15

Other usage

See the tests for more examples.

Until more docs are available, you can use the underlying Rust libraries docs to see what fields are available on the Hardware and CacheId/CacheOp/CacheResult classes.

Changelog

  • 0.2: Exposed Raw events.
  • 0.1: Initial, very minimal release.

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

py_perf_event-0.2.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distributions

py_perf_event-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

py_perf_event-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

File details

Details for the file py_perf_event-0.2.0.tar.gz.

File metadata

  • Download URL: py_perf_event-0.2.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for py_perf_event-0.2.0.tar.gz
Algorithm Hash digest
SHA256 58d5db8c1193a6aecfd5bf986a47529c28d77b0eb611a1d216faf88af8ec139d
MD5 80cec2c2562cba437371793c992279ca
BLAKE2b-256 64a0c896a7aa17614f7e9aff83754b5b06a609f2dbe58171d633e1cba54fccdf

See more details on using hashes here.

File details

Details for the file py_perf_event-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for py_perf_event-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c6d5def379c267487b265671ec2495f9b4e3d507deea996b27ef55469d8b16e9
MD5 5344ad072fcc09b79a07a7f4c9f4dcb2
BLAKE2b-256 9b98d1b99b2bfa8a0fda83c294c43b881790469b8133f799e4ec6cc62e6fec57

See more details on using hashes here.

File details

Details for the file py_perf_event-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for py_perf_event-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b6629b918718fd3a779ed019d8f40c2fb85b8a1a849935705b6bdff9a9cb808e
MD5 6cb52a9982c9c55c0a3dda038752ad48
BLAKE2b-256 934f8a48b6e338e45acf1861eb67d97abaa3d0bbc2f28c25879049531afcae25

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