GithubHelp home page GithubHelp logo

bm's Introduction

BM

Header only, nanosecond resolution, C++ microbenchmark library.

Status

Prints mean, variance and std deviation of critical sections with rdtsc. However, doesn't allow for passing arguments to critical section via Controller, doesn't allow for threading via Controller, doesn't yet support lfence and DoNotOptimize(). Will add these as I or you need them.

Sample

#include "bm.hpp"

#include <string>

static void BM_KMP(BM::Controller& c) {
  std::string space;
  std::string query;
  for (auto _ : c) {
    KnuthMorrisPrattSearch(space, query);
  }
}
BM_Register(BM_KMP);
BM_Main();

Then, compile and run.

g++ -I/path/to/headers -I/path/to/bm.h benchmark_library.cc -O3 -o bm
./bm --output_format=csv --output_file=benchmark.csv

Requires

  • Intel or AMD x86 chipset with rdtsc instruction available
  • Linux with sysfs pseudofilesystem
  • g++ or clang with at least C++11 and x86 intrinsics

Development and Testing

NOTES.txt contains objectives, requirements, non-requirements, TODO and design notes.

Requires:

  • CMake at least 3.5
  • Python at least 3.5
mkdir -p build
cmake -Bbuild -GNinja -S .
cmake --build build --target check-all

Flag testing

If you are testing a flag, please add a Python script that passes the flag and gets expected output. Check check_flags_integration.py as an example.

Format and linting

Requires python3 black, clang-tidy and clang-format for C++. Run

# pip install -r requirements.txt  # if you haven't already
cmake --build build --target lint

Note: we ignore errors about exception throwing for static/global variables. Exception safety is a non-requirement. Check NOTES.txt for more design notes.

bm's People

Contributors

samkhn avatar

Stargazers

 avatar

Watchers

 avatar

bm's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.