Metadata-Version: 2.4
Name: microperf
Version: 1.0.2
Summary: A small tool using perf to provide more performance insights.
Project-URL: Homepage, https://github.com/nicovank/microperf
Project-URL: Bug Tracker, https://github.com/nicovank/microperf/issues
Author-email: Nicolas van Kempen <nvankemp@gmail.com>
License-File: LICENSE
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: docker==7.1.0
Requires-Dist: presto-python-client==0.8.4
Requires-Dist: rich==13.9.4
Description-Content-Type: text/markdown

# microperf

[![PyPI](https://img.shields.io/pypi/v/microperf.svg)](https://pypi.org/project/microperf/)
[![downloads](https://static.pepy.tech/badge/microperf)](https://pepy.tech/project/microperf)

`microperf` is a [`perf`](https://perfwiki.github.io) wrapper. The basic idea is
that it converts a `perf.data` file by inserting all samples into a database,
making it then easier to query for specific patterns or code smells.

## Usage

### Generating a profile

First, note that your executable should be compiled with debug symbols (`-g`,
`-DCMAKE_BUILD_TYPE=RelWithDebInfo`, ...).

Since `microperf` is simply a wrapper, generating a profile can be done directly
with `perf`.
```bash
perf record -F99 --call-graph=dwarf -- <COMMAND>
```

Alternatively, `microperf perf` provides a convenience passthrough to `perf`.
This can be useful when a different `perf` executable should be used (see
`MICROPERF_PERF_EXE` option below).

### Running the Patterns analyzer

I've written a couple queries to identify common bad patterns. At time of this
writing, this includes cycles spent in:
 1. tree-based structures (`std::map`, `std::set`): these can often be replaced
    with hash-based data structures.
 2. constructors: these are often signs of excessive copying.

## Options

The environment variable `MICROPERF_PERF_EXE` can be set to the path of a `perf`
executable to be used instead of the default `perf` command.
