Skip to content

tragisch/Simple-Benchmark-C-Header

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Benchmark C-Header

An C-header only library for a simple benchmark of a function or code_block. One macros is (currently) provided:

BENCH(FCALL)

where FCALL is a function call or a code block. The macro will print the (CPU) time it took to execute the function call or code block. And it returns from "rusage" a snapshot of the current resource usage (RSS) of the function. Of course it is more a hint of the real memory consumption.

It should work on Linux and MacOS.

Usage

see example folder:

int main() {

  BENCH(sleep_some_time(3,4));

  return 0;
}

results in: Alt text

Installation

Just use the header file.

Or if you would like to build the example, you can clone the repository and build it with Bazel:

bazel build //examples:bench_1

About

simple benchmark macros

Resources

License

Stars

Watchers

Forks

Packages

No packages published