iops_profiler.magic

IPython magic module for IOPS Profiler.

This module contains the IPython magic command integration and orchestration: - IOPSProfiler magics class - Line/cell magic command handling - Extension loading/unloading - Coordination between data collection and display modules

Classes

IOPSProfiler

IPython magic commands for profiling I/O operations per second (IOPS).

Functions

load_ipython_extension(ipython)

Load the extension

unload_ipython_extension(ipython)

Unload the extension

Module Contents

class IOPSProfiler(shell)[source]

Bases: IPython.core.magic.Magics

IPython magic commands for profiling I/O operations per second (IOPS).

Provides %iops (line magic) and %%iops (cell magic) commands to measure I/O performance of Python code in Jupyter notebooks.

platform = 'linux'[source]
collector[source]
_profile_code(code, show_histogram=False)[source]

Internal method to profile code with I/O measurements.

Parameters:
  • code – The code string to profile

  • show_histogram – Whether to generate histograms

Returns:

Dictionary with profiling results

iops(line, cell=None)[source]

Measure I/O operations per second for code.

Line magic usage (single line):

%iops open(‘test.txt’, ‘w’).write(‘data’) %iops –histogram open(‘test.txt’, ‘w’).write(‘data’)

Cell magic usage (multiple lines):

%%iops # Your code here with open(‘test.txt’, ‘w’) as f:

f.write(‘data’)

%%iops –histogram # Your code here (with histograms) with open(‘test.txt’, ‘w’) as f:

f.write(‘data’)

load_ipython_extension(ipython)[source]

Load the extension

unload_ipython_extension(ipython)[source]

Unload the extension