summaryrefslogblamecommitdiffstats
path: root/src/util/timeUtil.h
blob: 90d647d2e349c0c83ab27eb791e216a52f732c71 (plain) (tree)

































                                                                                                         
#ifndef TIME_UTIL
#define TIME_UTIL

#include <sys/time.h>
#include <stdio.h>
#include <unistd.h>


#ifdef PROFILE
#define startTime(aaa) TimeUtil aaa ## Time = TimeUtil(); aaa ## Time.start();
#define endTime(aaa) aaa ## Time.stop(); printf("Time to execute " #aaa " : %ld\n", aaa ## Time.getMS());
#endif

#ifndef PROFILE
#define startTime(aaa)
#define endTime(aaa)
#endif



class TimeUtil
{

public:
    TimeUtil();
    void start();
    void stop();
    long getMS();
private:
    long mtime, seconds, useconds;
    struct timeval Begin, End;             //initialize Begin and End for the timer
};

#endif