Metadata-Version: 2.1
Name: sprofiler
Version: 0.0.1
Summary: Lightweight profiler with checkpoints
Home-page: https://github.com/bbrzycki/sprofiler
Author: Bryan Brzycki
Author-email: bbrzycki@berkeley.edu
License: UNKNOWN
Project-URL: Source, https://github.com/bbrzycki/sprofiler
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: numpy (>=1.18.1)

# sProfiler
Python script profiler/timer supporting code checkpoints and reporting.

## Installation
```
pip install sprofiler
```

## Usage
Use the `Timer` to create named checkpoints throughout your code. Checkpoints need a 'start' and a 'stop', and 
multiple iterations are combined to summarize how long it takes to complete each leg. The `report()` function
prints the results from all checkpoints.
```
import sprofiler as sp
from time import sleep

pr = sp.Profiler()

pr.start('program')
print('Code outside loop')
sleep(1)

for _ in range(10):
    pr.start('loop')
    print('Code in loop')
    sleep(1)
    pr.stop('loop')
pr.stop('program')

pr.report()
```

The printed report appears as:
```
program | 11.0 s ± 0.0 s per iteration, n = 1
loop | 1.0 s ± 0.0 s per iteration, n = 10
```

## Future Directions

* Automatic logging, so that `report()` isn't strictly needed
* Function decorators
* Potential support for more complex profiling


