Metadata-Version: 2.4
Name: benchpulse
Version: 1.0.0
Summary: Hardware resource benchmarking framework for Python
Author: Agnik Bakshi
License: MIT License
        
        Copyright (c) 2026 Agnik Bakshi
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/Agnik7/benchpulse
Project-URL: Repository, https://github.com/Agnik7/benchpulse
Project-URL: Issues, https://github.com/Agnik7/benchpulse/issues
Keywords: benchmark,profiling,cpu,memory,performance,monitoring
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: C
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: System :: Benchmark
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Dynamic: license-file

# BenchPulse

BenchPulse is a dependency-free hardware benchmarking library for Python. Add `@benchpulse` to any function, method, or async callable to capture execution time, CPU utilization, memory usage, and thread activity while your code runs.

The performance-sensitive monitoring engine is implemented in C17 and exposed to Python through a thin native extension. Python is used only for the public API, validation, formatting, and export helpers.

## Quick start

```python
from benchpulse import benchpulse

@benchpulse
def train():
    return sum(range(100_000))

report = train()
print(report.return_value)
print(report.cpu_statistics.process_utilization_percent.mean)
```

`@benchpulse` is the primary decorator. `@benchmark` is provided as an alias.

## Features

- Native C runtime with OS-level collectors
- CPU, memory, and thread metrics out of the box
- Optional GPU collector hook (vendor libraries are optional)
- Decorator, context manager, and class decorator APIs
- Async function support
- JSON, CSV, Markdown, and HTML export
- Zero runtime Python dependencies
- Windows, Linux, and macOS support

## Installation

```bash
pip install benchpulse
```

Prebuilt wheels are published for Windows (x64), Linux (x86_64 and aarch64),
and macOS (Intel and Apple Silicon) on CPython 3.11+. No compiler or extra
setup is required.

### Development install

```bash
pip install -e ".[dev]"
```

Building from source requires:

- Python 3.11+
- A C17 compiler (MSVC 2019 16.8+ on Windows, GCC 8+/Clang 7+ on Linux and macOS)

CMake is optional and only used for standalone native-library builds.

## API overview

```python
from benchpulse import benchpulse, Benchmark, BenchmarkConfiguration, OutputMode

@benchpulse(sampling_interval_ms=50, output_mode=OutputMode.SILENT)
def work():
    ...

with Benchmark() as session:
    result = compute()
report = session.report
```

Decorated functions return a `BenchmarkReport`. The original return value is available as `report.return_value`.

## Project layout

```
benchpulse/          Python package
native/              C runtime and collectors
include/benchpulse/  Public C headers
tests/               Python tests
CMakeLists.txt       Native build definition
```

## License

See `LICENSE`.
