summaryrefslogtreecommitdiff
path: root/tnet_io/KaldiLib/Timer.h
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2015-06-25 12:56:45 +0800
committerDeterminant <ted.sybil@gmail.com>2015-06-25 12:56:45 +0800
commita74183ddb4ab8383bfe214b3745eb8a0a99ee47a (patch)
treed5e69cf8c4c2db2e3a4722778352fc3c95953bb2 /tnet_io/KaldiLib/Timer.h
parentb6301089cde20f4c825c7f5deaf179082aad63da (diff)
let HTK I/O implementation be a single package
Diffstat (limited to 'tnet_io/KaldiLib/Timer.h')
-rw-r--r--tnet_io/KaldiLib/Timer.h103
1 files changed, 0 insertions, 103 deletions
diff --git a/tnet_io/KaldiLib/Timer.h b/tnet_io/KaldiLib/Timer.h
deleted file mode 100644
index b220b93..0000000
--- a/tnet_io/KaldiLib/Timer.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef Timer_h
-#define Timer_h
-
-#include "Error.h"
-#include <sstream>
-
-
-
-#if defined(_WIN32) || defined(MINGW)
-
-# include <windows.h>
-
-namespace TNet
-{
- class Timer {
- public:
- void
- Start(void)
- {
- static int first = 1;
-
- if(first) {
- QueryPerformanceFrequency(&mFreq);
- first = 0;
- }
- QueryPerformanceCounter(&mTStart);
- }
-
- void
- End(void)
- { QueryPerformanceCounter(&mTEnd); }
-
- double
- Val()
- {
- return ((double)mTEnd.QuadPart - (double)mTStart.QuadPart) /
- ((double)mFreq.QuadPart);
- }
-
- private:
- LARGE_INTEGER mTStart;
- LARGE_INTEGER mTEnd;
- LARGE_INTEGER mFreq;
- };
-}
-
-#else
-
-# include <sys/time.h>
-# include <unistd.h>
-
-namespace TNet
-{
- class Timer
- {
- public:
- void
- Start()
- { gettimeofday(&this->mTStart, &mTz); }
-
- void
- End()
- { gettimeofday(&mTEnd,&mTz); }
-
- double
- Val()
- {
- double t1, t2;
-
- t1 = (double)mTStart.tv_sec + (double)mTStart.tv_usec/(1000*1000);
- t2 = (double)mTEnd.tv_sec + (double)mTEnd.tv_usec/(1000*1000);
- return t2-t1;
- }
-
- private:
- struct timeval mTStart;
- struct timeval mTEnd;
- struct timezone mTz;
- };
-}
-
-#endif
-
-
-
-
-
-
-
-///////////////////////////////////////////////////////////////
-// Macros for adding the time intervals to time accumulator
-#if PROFILING==1
-# define TIMER_START(timer) timer.Start()
-# define TIMER_END(timer,sum) timer.End(); sum += timer.Val()
-#else
-# define TIMER_START(timer)
-# define TIMER_END(timer,sum)
-#endif
-
-#endif
-
-
-