summaryrefslogtreecommitdiff
path: root/gi/pyp-topics/src/pyp-topics.cc
diff options
context:
space:
mode:
authorphilblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-02 15:05:47 +0000
committerphilblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-02 15:05:47 +0000
commit5e3ebc102037c7ac61b918f6f3869130d15abce6 (patch)
tree1b5bf442ea6fe9892125d0a998da0b26da8518a2 /gi/pyp-topics/src/pyp-topics.cc
parente9711b0e4ecc939fcfabd8709cf7d93510e5a028 (diff)
Hopefully fixed the time issue now ...
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@108 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/pyp-topics/src/pyp-topics.cc')
-rw-r--r--gi/pyp-topics/src/pyp-topics.cc18
1 files changed, 1 insertions, 17 deletions
diff --git a/gi/pyp-topics/src/pyp-topics.cc b/gi/pyp-topics/src/pyp-topics.cc
index 97f50362..6f4a9169 100644
--- a/gi/pyp-topics/src/pyp-topics.cc
+++ b/gi/pyp-topics/src/pyp-topics.cc
@@ -3,7 +3,7 @@
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <sys/time.h>
-//#include <mach/mach_time.h>
+#include "clock_gettime_stub.c"
struct Timer {
@@ -11,32 +11,16 @@ struct Timer {
void Reset()
{
clock_gettime(CLOCK_MONOTONIC, &start_t);
- //start_t = mach_absolute_time();
}
double Elapsed() const {
timespec end_t;
- //timespec tp;
- //uint64_t end_t = mach_absolute_time();
- //mach_absolute_difference(end_t, start_t, &tp);
clock_gettime(CLOCK_MONOTONIC, &end_t);
const double elapsed = (end_t.tv_sec - start_t.tv_sec)
+ (end_t.tv_nsec - start_t.tv_nsec) / 1000000000.0;
- //const double elapsed = tp.tv_sec + tp.tv_nsec / 1000000000.0;
return elapsed;
}
private:
-// void mach_absolute_difference(uint64_t end, uint64_t start, struct timespec *tp) const {
-// uint64_t difference = end - start;
-// static mach_timebase_info_data_t info = {0,0};
-//
-// if (info.denom == 0)
-// mach_timebase_info(&info);
-// uint64_t elapsednano = difference * (info.numer / info.denom);
-// tp->tv_sec = elapsednano * 1e-9;
-// tp->tv_nsec = elapsednano - (tp->tv_sec * 1e9);
-// }
timespec start_t;
- //uint64_t start_t;
};
void PYPTopics::sample(const Corpus& corpus, int samples) {