Git Product home page Git Product logo

visualbenchmarking's Introduction

VisualBenchmarking

Visual Benchmarking using C++ and Chrome Tracing for single threaded projects, multithreading will be supported in the future

Usage

Include "benchmark.h" in to your project
To start the session for benchmarking, call this function
START_SESSION("Session Name");
To profile any function in your benchmark while your session is active, add this function in the beginning of the code of your function
PROFILE_FUNCTION();
or
PROFILE_FUNCTION_DETAILED();
To end the session, call this function
END_SESSION();
Example
#include "../benchmark.h"
#include <iostream>

int fibonacci(int number) {
    PROFILE_FUNCTION();     //profiling this function for benchmarking
    if (number == 1) 
        return 1;
    if (number == 0)
        return 0;
    return fibonacci(number - 1) + fibonacci(number - 2);
}

int main() {
    int number;
    std::cin >> number;
    START_SESSION("Fibonacci");     //starting the session from where benchmarking starts
    
    std::cout << fibonacci(number) << std::endl;    //this code will be benchmarked
    
    END_SESSION();      //ending the session
}
Open Chrome Tracing which comes pre-installed with Google Chrome by typing chrome://tracing
After executing your code a file named results.json would appear drag and drop your json file in chrome tracing
To turn off benchmarking just mark BENCHMARKING OFF at line number 6 in the "benchmark.h" header file
#define BENCHMARKING OFF

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.