dmilos / counter

Count ( make statistics of ) used operators/functions. Exact number of use will give you exact time consumption.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Count every usage of arithmetic/mathematic functions

  • Status:
  • Ready for test use.

Key features:

  • Headers only
  • No third parties
  • No additional binaries
  • One file to include to start the fun
  • Easy to integrate
  • Easy to disintegrate
  • Out of the box ready
  • No need to recompile or start some install process.

Example:

#include <iostream>
#include <iomanip>

#include "counter/counter.hpp"

typedef ::counter::number<double> MyDouble;

int main( int argc, char *argv[] )
 {
  
  MyDouble a, b, c;

  a = a + b + - c;

  std::cout << "Number of calls of assignment operator: " 
            << MyDouble::statistics()[ ::counter::constant::operator_assign ]
            << std::endl
            << "Number of calls of binary plus operator: " 
            << MyDouble::statistics()[ ::counter::constant::operator_plus_binary ]
            << std::endl
            << "Number of calls of unary minus: " 
            << MyDouble::statistics()[ ::counter::constant::operator_minus_unary ]
            << std::endl;

  return EXIT_SUCCESS;
 }

Want to see more:

About

Count ( make statistics of ) used operators/functions. Exact number of use will give you exact time consumption.

License:MIT No Attribution


Languages

Language:C++ 98.3%Language:Shell 1.7%