You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

40 lines
587 B

#if !defined(DEF_TTIMING)
#define DEF_TTIMING
#include <sys/time.h>
class TTiming
{
protected:
struct timeval start;
struct timeval stop;
void getTime(timeval &tv);
public:
TTiming(void);
void Begin(void);
long End(void);
};
inline TTiming::TTiming(void)
{
}
inline void TTiming::Begin(void)
{
getTime(start);
}
inline long TTiming::End(void)
{
getTime(stop);
return ((stop.tv_sec-start.tv_sec) * 1000 + (stop.tv_usec-start.tv_usec)/1000.0) + 0.5;
}
inline void TTiming::getTime(timeval &tv)
{
gettimeofday(&tv,NULL);
}
#endif