Git Product home page Git Product logo

instrument's Introduction

Instrument

This is an C instrumentation library to profile and measure performance of C codes.

Usage

The usage is very simple. The example shows the basic use:

#include "instrumentation.h"
#include <stdint.h>
#include <stdlib.h>

#define N 1000000

int func_1(void)
{
	INST_START

	int i, j;
	for (i = 0; i < N; ++i)
		j =+ i;

	INST_END

	return j;
}

int main(void)
{
	int sol;

	sol = func_1();
	sol = func_1();
	sol = func_1();

	INST_PRINT
}

The macros INST_START and INST_END should be placed at the beginning and end of the function where the elapsed time want to be measured and INST_PRINT should be located where the information is going to be printed to stdout.

After compiling and run the code the output should be approximately:

------------------------------------------------------------
Instrument
------------------------------------------------------------
Function                Time            Calls           Mean            Stdev[%]
func_1           :      0.012215        3               0.004072        0.025676

More simple and easy to understand examples of the usage of this library can be found in the test folder.

instrument's People

Contributors

gagiuntoli avatar

Stargazers

 avatar

Watchers

 avatar

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.