benchmark.c

Basic benchmarking library in C
git clone git://git.finwo.net/lib/benchmark.c
Log | Files | Refs | README | LICENSE

commit 9e3aabf79246319c9b67d50fbc43b4a308f8dcfa
parent 988e180ab28261d325e501bb5ab360635cac645e
Author: finwo <finwo@pm.me>
Date:   Sat, 25 Mar 2023 00:42:58 +0100

Added example output to the readme

Diffstat:
MREADME.md | 16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md @@ -28,21 +28,29 @@ Example ```c #include "finwo/benchmark.h" -static void some_function() { - sleep(1); +void some_function() { + usleep(100 + (rand() % 100)); } int main() { BMARK(some_function); char percentiles[] = { - 1, 5, 50, 95, 99, 0 + 10, 50, 90, 0 }; - return bmark_run(100, percentiles); + return bmark_run(10, percentiles); } ``` +Which in turn will output something similar to this: + +``` +| Description | 10 % | 50 % | 90 % | +|:------------- | ---------:| ---------:| ---------:| +| some_function | 163.00 us | 202.00 us | 245.00 us | +``` + API ---