Code Monkey home page Code Monkey logo

atune's Introduction

atune

A simple profiler in C which gives the output as the number of ticks between any two arbitrary points in code.

Usage:

  1. Include "profiler.h" in your code.
  2. You need to add probe points within your code to enable profiling for that portion of the code. You can specify a start point using - BEGIN_PROFILING(Probe1); and an endpoint using - END_PROFILING(Probe1); eg : BEGIN_PROFILING(malloc10000); char *temp = (char ) malloc (10000sizeof(char)); free (temp); END_PROFILING(malloc10000); The above would count the number ticks of the processor tsc that elapse by malloc'ing a block of 10000 chars and then free'ing them.
  3. Compile the program with the PROF defined. eg: gcc file1.c -o file1 -DPROF=1
  4. Run your program to get the output.

Limitations:

  1. May not work well with recursive calls.
  2. Single threaded.

TODO:

  1. Support recursive function calls. (Already underway)
  2. Support multi-threading.
  3. Formatting output
  4. There seems to be some code duplication in the way the macros are defined, cleanup is required.
  5. Output is available only at the end of the program execution and is printed on the console. This will surely mess up the expected outputs of piped programs. Need to provide a way to gather this data in a third location and make available on demand.

Idea:

This is loosely based on the idea from here :: http://locklessinc.com/articles/profiling/

atune's People

Contributors

adityajaltade 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.