certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] certi libCERTI/CMakeLists.txt libCERTI/WinClock...


From: certi-cvs
Subject: [certi-cvs] certi libCERTI/CMakeLists.txt libCERTI/WinClock...
Date: Fri, 10 Oct 2008 11:29:07 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Mathé <jmm>    08/10/10 11:29:07

Modified files:
        libCERTI       : CMakeLists.txt WinClock.cc 
        test/utility   : CertiUtilTests.cc 
Added files:
        libCERTI       : WinPerfClock.cc WinPerfClock.hh 

Log message:
        Update Window clock classes
        We now have "classic" 1ms clock class
        + "high perf" HW clock class

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/CMakeLists.txt?cvsroot=certi&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/WinClock.cc?cvsroot=certi&r1=4.1&r2=4.2
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/WinPerfClock.cc?cvsroot=certi&rev=4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/WinPerfClock.hh?cvsroot=certi&rev=4.1
http://cvs.savannah.gnu.org/viewcvs/certi/test/utility/CertiUtilTests.cc?cvsroot=certi&r1=1.12&r2=1.13

Patches:
Index: libCERTI/CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libCERTI/CMakeLists.txt,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- libCERTI/CMakeLists.txt     10 Oct 2008 07:34:54 -0000      1.15
+++ libCERTI/CMakeLists.txt     10 Oct 2008 11:29:06 -0000      1.16
@@ -93,7 +93,8 @@
 IF (HAVE_WIN_CLOCK)
     SET(CERTI_SUPPORT_SRCS 
            ${CERTI_SUPPORT_SRCS}
-           WinClock.cc WinClock.hh)              
+           WinClock.cc WinClock.hh 
+           WinPerfClock.cc WinPerfClock.hh)              
 ENDIF(HAVE_WIN_CLOCK)
 
 SET(CERTI_SOCKET_SRCS

Index: libCERTI/WinClock.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/WinClock.cc,v
retrieving revision 4.1
retrieving revision 4.2
diff -u -b -r4.1 -r4.2
--- libCERTI/WinClock.cc        10 Oct 2008 07:34:54 -0000      4.1
+++ libCERTI/WinClock.cc        10 Oct 2008 11:29:06 -0000      4.2
@@ -1,5 +1,5 @@
 #include "WinClock.hh"
-#include <stdio.h>
+#include <iostream>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
@@ -8,17 +8,17 @@
 
 WinClock::WinClock() : Clock("WinClock")
 {
-resolution = 1.0e9 / CLOCKS_PER_SEC ;  
+       resolution = 1.0e9 / CLOCKS_PER_SEC ;
 }
 
 double WinClock::getResolution() 
 {
-return resolution;
+   return resolution;
 }
 
 uint64_t WinClock::getCurrentTicksValue() 
 {
-return static_cast<uint64_t>(clock());
+  return static_cast<uint64_t>(clock());
 }
        
 double WinClock::tick2NanoSecond(const uint64_t ticks) 

Index: test/utility/CertiUtilTests.cc
===================================================================
RCS file: /sources/certi/certi/test/utility/CertiUtilTests.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- test/utility/CertiUtilTests.cc      10 Oct 2008 10:53:59 -0000      1.12
+++ test/utility/CertiUtilTests.cc      10 Oct 2008 11:29:07 -0000      1.13
@@ -53,6 +53,7 @@
 
 #ifdef HAVE_WIN_CLOCK
 #include "WinClock.hh"
+#include "WinPerfClock.hh"
 #endif
 
 
@@ -250,6 +251,7 @@
 #endif
 #ifdef HAVE_WIN_CLOCK
        certi::WinClock   WinClk;
+       certi::WinPerfClock   WinPerfClk;
 #endif
 
        certi::MessageBuffer MsgBuf;
@@ -274,6 +276,7 @@
 #endif
 #ifdef HAVE_WIN_CLOCK
        clockTests(WinClk);
+       clockTests(WinPerfClk);
 #endif
 
        cout << "CERTI Utility Test->END." <<endl;

Index: libCERTI/WinPerfClock.cc
===================================================================
RCS file: libCERTI/WinPerfClock.cc
diff -N libCERTI/WinPerfClock.cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ libCERTI/WinPerfClock.cc    10 Oct 2008 11:29:06 -0000      4.1
@@ -0,0 +1,41 @@
+#include "WinPerfClock.hh"
+#include <iostream>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+namespace certi {
+
+WinPerfClock::WinPerfClock() : Clock("WinPerfClock")
+{      
+LARGE_INTEGER freq;
+if (QueryPerformanceFrequency(&freq))
+       {
+       std::cout << "Perffreq = " << freq.QuadPart <<std::endl;        
+       resolution = 1.0e9 / static_cast<double>(freq.QuadPart);
+       } 
+else   resolution = 0.0 ;
+}
+
+double WinPerfClock::getResolution() 
+{
+return resolution;
+}
+
+uint64_t WinPerfClock::getCurrentTicksValue() 
+{  
+   LARGE_INTEGER tick;
+       QueryPerformanceCounter(&tick);
+       return static_cast<uint64_t>(tick.QuadPart);
+}
+       
+double WinPerfClock::tick2NanoSecond(const uint64_t ticks) 
+{
+return resolution*ticks;
+}
+
+WinPerfClock::~WinPerfClock()
+{
+}
+
+}

Index: libCERTI/WinPerfClock.hh
===================================================================
RCS file: libCERTI/WinPerfClock.hh
diff -N libCERTI/WinPerfClock.hh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ libCERTI/WinPerfClock.hh    10 Oct 2008 11:29:07 -0000      4.1
@@ -0,0 +1,40 @@
+#ifndef WinPerfClock_HH_
+#define WinPerfClock_HH_
+
+#include "Clock.hh"
+
+namespace certi {
+/**
+ */
+class CERTI_EXPORT WinPerfClock : public Clock
+{
+public:
+       WinPerfClock();
+       /**
+        * Get the clock resolution in nano-seconds.
+        * @return the clock resolution in nano-seconds
+        */
+       virtual double getResolution();
+       /**     
+        * Get the current ticks value.
+        * @return the current ticks value
+        */
+       virtual uint64_t getCurrentTicksValue();        
+       /**
+        * Convert a number of ticks into a double value
+        * representing nanoseconds.
+        * @param[in] ticks the number of tick to convert
+        * @return the nano-seconds value 
+        */
+       virtual double   tick2NanoSecond(const uint64_t ticks);
+       virtual ~WinPerfClock();
+
+private:
+       /**
+        * The WinPerfClock resolution in nano-seconds
+        */
+       double resolution;
+
+};
+}
+#endif /*WinPerfClock_HH_*/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]