diff --git a/libkoviz/libkoviz.pro b/libkoviz/libkoviz.pro index f7e213e..b642fae 100644 --- a/libkoviz/libkoviz.pro +++ b/libkoviz/libkoviz.pro @@ -73,9 +73,6 @@ SOURCES += bookmodel.cpp \ parameter.cpp \ runs.cpp \ snaptable.cpp \ - timeit.cpp \ - timeit_linux.cpp \ - timeit_win32.cpp \ timestamps.cpp \ datamodel.cpp \ datamodel_trick.cpp \ @@ -164,9 +161,6 @@ HEADERS += bookmodel.h \ roundoff.h \ runs.h \ snaptable.h \ - timeit.h \ - timeit_linux.h \ - timeit_win32.h \ timestamps.h \ trick_types.h \ tricktablemodel.h \ diff --git a/libkoviz/timeit.cpp b/libkoviz/timeit.cpp deleted file mode 100644 index 3462638..0000000 --- a/libkoviz/timeit.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "timeit.h" - -TimeIt::TimeIt() -{ -} diff --git a/libkoviz/timeit.h b/libkoviz/timeit.h deleted file mode 100644 index 93d5f40..0000000 --- a/libkoviz/timeit.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef TIMEIT_H -#define TIMEIT_H - -#include -#include - -class TimeIt -{ -public: - TimeIt(); - - long snap() - { - long elapsed = stop(); - start(); - return elapsed; - } - - void snap(const char* msg) - { - fprintf(stderr,"%s %lf\n",msg,stop()/1000000.0); - start(); - } - virtual void start() = 0; - virtual long stop() = 0; // return microseconds since start -}; - -#endif // TIMEIT_H diff --git a/libkoviz/timeit_linux.cpp b/libkoviz/timeit_linux.cpp deleted file mode 100644 index 326341c..0000000 --- a/libkoviz/timeit_linux.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "timeit_linux.h" - -#ifdef __linux - -TimeItLinux::TimeItLinux() -{ -} - -void TimeItLinux::start() -{ - gettimeofday(&_tp_start,NULL); -} - -long TimeItLinux::stop() -{ - gettimeofday(&_tp_stop,NULL); - - long elapsed = _tp_stop.tv_usec - _tp_start.tv_usec ; - - if ( _tp_start.tv_sec < _tp_stop.tv_sec ) { - elapsed += 1000000*(_tp_stop.tv_sec - _tp_start.tv_sec) ; - } - - return elapsed; -} - - -#endif diff --git a/libkoviz/timeit_linux.h b/libkoviz/timeit_linux.h deleted file mode 100644 index 9cd7857..0000000 --- a/libkoviz/timeit_linux.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef TIMEIT_LINUX_H -#define TIMEIT_LINUX_H - -#ifdef __linux -#include "timeit.h" -#include -#include - -using namespace std; - -class TimeItLinux : public TimeIt -{ -public: - TimeItLinux(); - virtual void start(); - virtual long stop(); // return microseconds since start - -private: - struct timeval _tp_start; - struct timeval _tp_stop; - -}; - -#endif - -#endif // TIMEIT_LINUX_H diff --git a/libkoviz/timeit_win32.cpp b/libkoviz/timeit_win32.cpp deleted file mode 100644 index f3c1e56..0000000 --- a/libkoviz/timeit_win32.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "timeit_win32.h" - -#ifdef __WIN32__ - -TimeItWin32::TimeItWin32() -{ -} - -void TimeItWin32::start() -{ - _gettimeofday(&_tp_start); -} - -long TimeItWin32::stop() -{ - _gettimeofday(&_tp_stop); - - long elapsed = _tp_stop.tv_usec - _tp_start.tv_usec ; - - if ( _tp_start.tv_sec < _tp_stop.tv_sec ) { - elapsed += 1000000*(_tp_stop.tv_sec - _tp_start.tv_sec) ; - } - - return elapsed; -} - -int TimeItWin32::_gettimeofday(struct timeval* tp, void* timezone) -{ - if ( timezone != NULL ) { - cerr << "WinTimeIt::_gettimeofday(): no support for timezone" - << endl; - return(-1); - } - - static BOOL is_first = true; - static LONGLONG freq ; - static LONGLONG sec0 = 0; - static LONGLONG usec0 = 0; - - LARGE_INTEGER pc; - - if ( is_first ) { - - static LARGE_INTEGER ifreq ; - QueryPerformanceFrequency( &ifreq ) ; - freq = ifreq.QuadPart; - if ( freq < 1 ) { - cerr << "my_gettimeofday(): no clock support" - << endl; - return(-1); - } - - is_first = false; - - } - - ::QueryPerformanceCounter(&pc); - - LONGLONG clicks = pc.QuadPart; - lldiv_t dv = lldiv(clicks,freq); - - if ( dv.quot > LONG_MAX ) { - cerr << "my_gettimeofday(): long int overflow!" << endl; - return(-1); - } - tp->tv_sec = (long) (dv.quot); - - // I think the rem and freq will not lose precision when cast this way - // I assume this because rem < freq ... and freq is not THAT big - tp->tv_usec = (long) (1000000.0*((double)dv.rem/(double)freq)); - - return 0; -} - -#endif diff --git a/libkoviz/timeit_win32.h b/libkoviz/timeit_win32.h deleted file mode 100644 index d11c172..0000000 --- a/libkoviz/timeit_win32.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef WINTIMEIT_H -#define WINTIMEIT_H - -#ifdef __WIN32__ -#include -#include -#include -#include -#include -#include - -#include "timeit.h" - -using namespace std; - -class TimeItWin32 : public TimeIt -{ -public: - TimeItWin32(); - virtual void start(); - virtual long stop(); // return microseconds since start - -private: - int _gettimeofday(timeval *tp, void *timezone=NULL); - struct timeval _tp_start; - struct timeval _tp_stop; - -}; - -#endif - -#endif // WINTIMEIT_H