iops-profiler
A Jupyter IPython magic extension for measuring I/O operations per second (IOPS) in your code.
Installation
You can install iops-profiler directly from PyPI (once published):
pip install iops-profiler
Or install from source:
git clone https://github.com/lincc-frameworks/iops-profiler.git
cd iops-profiler
pip install -e .
Usage
Load the extension in your Jupyter notebook:
%load_ext iops_profiler
Line Magic Mode
Use the %iops line magic to profile a single line of code:
%iops open('test.txt', 'w').write('Hello World' * 1000)
Cell Magic Mode
Use the %%iops cell magic to profile I/O operations in an entire cell:
%%iops
# Your code here
with open('test.txt', 'w') as f:
f.write('Hello World' * 1000)
The extension will display a table showing:
- Execution time
- Read/write operation counts
- Bytes read/written
- IOPS (operations per second)
- Throughput (bytes per second)
Histogram Visualization
Use the --histogram flag to visualize I/O operation distributions (available for strace and fs_usage measurement modes):
Example - Analyzing I/O patterns with multiple file sizes:
%%iops --histogram
import tempfile
import os
import shutil
# Create test files with different sizes
test_dir = tempfile.mkdtemp()
try:
# Write files of various sizes to create diverse write operations
# Small writes (few KB)
for i in range(5):
with open(os.path.join(test_dir, f'small_{i}.txt'), 'w') as f:
f.write('x' * 1024) # 1 KB
# Medium writes (tens of KB)
for i in range(3):
with open(os.path.join(test_dir, f'medium_{i}.txt'), 'w') as f:
f.write('y' * (10 * 1024)) # 10 KB
# Large writes (hundreds of KB)
for i in range(2):
with open(os.path.join(test_dir, f'large_{i}.txt'), 'w') as f:
f.write('z' * (100 * 1024)) # 100 KB
# Now read back the files to create diverse read operations
# Small reads
for i in range(5):
with open(os.path.join(test_dir, f'small_{i}.txt'), 'r') as f:
_ = f.read()
# Medium reads
for i in range(3):
with open(os.path.join(test_dir, f'medium_{i}.txt'), 'r') as f:
_ = f.read()
# Large reads
for i in range(2):
with open(os.path.join(test_dir, f'large_{i}.txt'), 'r') as f:
_ = f.read()
finally:
# Cleanup
if os.path.exists(test_dir):
shutil.rmtree(test_dir)
This example generates a rich distribution of I/O operations across multiple size ranges, producing histograms like:
When enabled, two histogram charts are displayed alongside the results table:
- Operation Count Distribution: Shows the count of I/O operations bucketed by bytes-per-operation (log scale)
- Total Bytes Distribution: Shows the total bytes transferred bucketed by bytes-per-operation (log scale)
Both charts display separate lines for reads, writes, and all operations combined, making it easy to identify patterns in your code's I/O behavior.
Platform Support
- Linux/Windows: Uses
psutilfor per-process I/O tracking - macOS: Uses
fs_usagewith privilege elevation (requires password prompt)
Requirements
- Python 3.10+
- IPython/Jupyter
- psutil
- matplotlib (for histogram visualization)
- numpy (for histogram visualization)
Dev Guide - Getting Started
Before installing any dependencies or writing code, it's a great idea to create a
virtual environment. LINCC-Frameworks engineers primarily use conda to manage virtual
environments. If you have conda installed locally, you can run the following to
create and activate a new environment.
conda create -n <env_name> python=3.10
conda activate <env_name>
Once you have created a new environment, you can install this project for local development using the following commands:
pip install -e '.[dev]'
pre-commit install
Notes:
- The install command will install the package in editable mode with all development dependencies
pre-commit installwill initialize pre-commit for this local repository, so that a set of tests will be run prior to completing a local commit. For more information, see the Python Project Template documentation on pre-commit
Metadata
Release files for iops-profiler 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| iops_profiler-0.2.0.tar.gz | 99.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iops_profiler-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 114.5 kB
Release files / iops_profiler-0.2.0.tar.gz
| Download URL | iops_profiler-0.2.0.tar.gz |
|---|---|
| Size | 99.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cf4564821a98200ca57c3e06f7a672bb9b67e73346765973126f258edea153d
|
|
BLAKE2b-256 checksum How to use checksums |
a00e3c4fbdbe4d959a401140985b35d35f70edb4a837fd805eb33c00b2d3c1b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2025.
Transparency logRelease files / iops_profiler-0.2.0-py3-none-any.whl
| Download URL | iops_profiler-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aae996bb56527963a255507a7c3200715bfc56efc25281a21226584cf1b8e719
|
|
BLAKE2b-256 checksum How to use checksums |
bf62e13e4f8ffa11f41ad22305c067b8c67a2eeee9be440dd6f249cf3ef58eb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2025.
Transparency log