CPU Profile
This is a simple package to measure CPU speed by calculating the time it takes to compute Fibonacci numbers. It is useful in contexts where CPU speed is unknown or can fluctuate, such as cloud function environments, and can serve as a rough measure of how long subsequent compute-intensive code will take to run.
Installation
pip install cpuprofile
Usage
from cpuprofile import profile_cpu
# Calculate the CPU speed by computing Fibonacci numbers.
elapsed_time = profile_cpu()
# elapsed_time is ~0.18 (seconds) on a 2.5 GHz Intel Core i7 2015 Macbook Pro.
# Or, a number can be specified to calculate the nth Fibonacci (default: 28).
elapsed_time = profile_cpu(15) # 15th Fibonacci; takes around 0.0006 seconds
elapsed_time = profile_cpu(35) # 35th Fibonacci; takes about 5 seconds
Credit
The minimalist approach of recursively calculating Fibonacci numbers as a way to profile the CPU is inspired by:
- Booth, J. (2015). Not so incognito: Exploiting resource-based side channels in javascript engines (Undergraduate thesis, Harvard University).
Metadata
Release files for cpuprofile 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cpuprofile-1.0.1.tar.gz | 2.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cpuprofile-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.4 kB
Release files / cpuprofile-1.0.1.tar.gz
| Download URL | cpuprofile-1.0.1.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
774b5636b2619dcc75d240497b3bb62a43f167862a0eadf959ac55d294a17bca
|
|
BLAKE2b-256 checksum How to use checksums |
9b1472a2d8fb3b7a97c2996262dfd3dd7ef2e7f0b7ce2f7eef35d539ce0ad492
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
|
Release files / cpuprofile-1.0.1-py3-none-any.whl
| Download URL | cpuprofile-1.0.1-py3-none-any.whl |
|---|---|
| Size | 2.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9991e9c2af83cd4060aacfbaddcd324954d409bcdf676d0d549afa57435e1892
|
|
BLAKE2b-256 checksum How to use checksums |
48c302813ed0da595c9d32a48098b44f09e1e282f618f4230e613871e4fc792e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
|
Security for cpuprofile 1.0.1
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.