[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi CMakeLists.txt config.h.cmake libCERTI/CM...
From: |
certi-cvs |
Subject: |
[certi-cvs] certi CMakeLists.txt config.h.cmake libCERTI/CM... |
Date: |
Fri, 10 Oct 2008 07:34:55 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Mathé <jmm> 08/10/10 07:34:55
Modified files:
. : CMakeLists.txt config.h.cmake
libCERTI : CMakeLists.txt Clock.hh
test/utility : CertiUtilTests.cc
Added files:
libCERTI : WinClock.cc WinClock.hh
Log message:
Add WinClock class for windows timer
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/CMakeLists.txt?cvsroot=certi&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/certi/config.h.cmake?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/CMakeLists.txt?cvsroot=certi&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Clock.hh?cvsroot=certi&r1=4.6&r2=4.7
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/WinClock.cc?cvsroot=certi&rev=4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/WinClock.hh?cvsroot=certi&rev=4.1
http://cvs.savannah.gnu.org/viewcvs/certi/test/utility/CertiUtilTests.cc?cvsroot=certi&r1=1.10&r2=1.11
Patches:
Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/CMakeLists.txt,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- CMakeLists.txt 9 Oct 2008 23:39:55 -0000 1.59
+++ CMakeLists.txt 10 Oct 2008 07:34:53 -0000 1.60
@@ -207,6 +207,7 @@
# NAMES Ws2_32
# DOC "The Winsock2 library")
SET(SOCKET_LIBRARY Ws2_32)
+ SET(HAVE_WIN_CLOCK 1)
ENDIF (WIN32)
################ LIBXML2 install Check ####################
Index: config.h.cmake
===================================================================
RCS file: /sources/certi/certi/config.h.cmake,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- config.h.cmake 25 Jul 2007 14:35:06 -0000 1.2
+++ config.h.cmake 10 Oct 2008 07:34:53 -0000 1.3
@@ -109,4 +109,7 @@
/* Define to 1 if the processor have TSC support */
#cmakedefine HAVE_TSC_CLOCK 1
+/* Define to 1 if the processor have WIN support */
+#cmakedefine HAVE_WIN_CLOCK 1
+
Index: libCERTI/CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libCERTI/CMakeLists.txt,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- libCERTI/CMakeLists.txt 16 Jun 2008 14:02:36 -0000 1.14
+++ libCERTI/CMakeLists.txt 10 Oct 2008 07:34:54 -0000 1.15
@@ -90,6 +90,12 @@
TSCClock.cc TSCClock.hh)
ENDIF(HAVE_TSC_CLOCK)
+IF (HAVE_WIN_CLOCK)
+ SET(CERTI_SUPPORT_SRCS
+ ${CERTI_SUPPORT_SRCS}
+ WinClock.cc WinClock.hh)
+ENDIF(HAVE_WIN_CLOCK)
+
SET(CERTI_SOCKET_SRCS
SocketServer.cc
SocketTCP.cc
@@ -104,7 +110,6 @@
Socket.hh
)
-
SET(CERTI_SOCKET_SRCS ${CERTI_SOCKET_SRCS} SocketUDP.cc SocketMC.cc
SocketUN.cc SocketUDP.hh SocketMC.hh SocketUN.hh)
SOURCE_GROUP("Source Files\\Socket" FILES ${CERTI_SOCKET_SRCS})
Index: libCERTI/Clock.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/Clock.hh,v
retrieving revision 4.6
retrieving revision 4.7
diff -u -b -r4.6 -r4.7
--- libCERTI/Clock.hh 9 Oct 2008 20:22:38 -0000 4.6
+++ libCERTI/Clock.hh 10 Oct 2008 07:34:54 -0000 4.7
@@ -30,11 +30,6 @@
* or other hardware assisted clock like Pentium TSC.
*/
-#if defined(_WIN32) && defined(_MSC_VER)
-#define uint64_t unsigned __int64
-#else
-#include <stdint.h>
-#endif
#include <string>
#include "certi.hh"
Index: test/utility/CertiUtilTests.cc
===================================================================
RCS file: /sources/certi/certi/test/utility/CertiUtilTests.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- test/utility/CertiUtilTests.cc 12 Jun 2008 07:39:51 -0000 1.10
+++ test/utility/CertiUtilTests.cc 10 Oct 2008 07:34:54 -0000 1.11
@@ -51,6 +51,12 @@
#include "PosixClock.hh"
#endif
+#define HAVE_WIN_CLOCK 1
+#ifdef HAVE_WIN_CLOCK
+#include "WinClock.hh"
+#endif
+
+
void messageBufferTests(certi::MessageBuffer& MsgBuf) {
certi::MessageBuffer MsgBuf2;
std::string stdstr = "a std:string";
@@ -63,7 +69,7 @@
int32_t i32 = -9999;
uint64_t u64 = 0xFFEEDDCC;
int64_t i64 = -1000000000;
- float f32 = 3.1415927;
+ float f32 = 3.1415927f;
double d64 = 2.7182818;
bool trueBool = true;
bool falseBool = false;
@@ -243,6 +249,10 @@
#ifdef HAVE_TSC_CLOCK
certi::TSCClock tscClk;
#endif
+#ifdef HAVE_WIN_CLOCK
+ certi::WinClock WinClk;
+#endif
+
certi::MessageBuffer MsgBuf;
cout << "CERTI Utility Tests->BEGIN..."<< endl ;
@@ -256,13 +266,18 @@
}
cout << endl;
messageBufferTests(MsgBuf);
+
#ifdef HAVE_TSC_CLOCK
clockTests(tscClk);
#endif
#ifdef HAVE_POSIX_CLOCK
clockTests(posixClk);
#endif
- cout << "CERTI Utility Test->END." <<endl;
+#ifdef HAVE_WIN_CLOCK
+ clockTests(WinClk);
+#endif
+ cout << "CERTI Utility Test->END." <<endl;
+getchar();
return 0;
}
Index: libCERTI/WinClock.cc
===================================================================
RCS file: libCERTI/WinClock.cc
diff -N libCERTI/WinClock.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libCERTI/WinClock.cc 10 Oct 2008 07:34:54 -0000 4.1
@@ -0,0 +1,33 @@
+#include "WinClock.hh"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+namespace certi {
+
+WinClock::WinClock() : Clock("WinClock")
+{
+resolution = 1.0e9 / CLOCKS_PER_SEC ;
+}
+
+double WinClock::getResolution()
+{
+return resolution;
+}
+
+uint64_t WinClock::getCurrentTicksValue()
+{
+return static_cast<uint64_t>(clock());
+}
+
+double WinClock::tick2NanoSecond(const uint64_t ticks)
+{
+return resolution*ticks;
+}
+
+WinClock::~WinClock()
+{
+}
+
+}
Index: libCERTI/WinClock.hh
===================================================================
RCS file: libCERTI/WinClock.hh
diff -N libCERTI/WinClock.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libCERTI/WinClock.hh 10 Oct 2008 07:34:54 -0000 4.1
@@ -0,0 +1,40 @@
+#ifndef WinClock_HH_
+#define WinClock_HH_
+
+#include "Clock.hh"
+
+namespace certi {
+/**
+ */
+class CERTI_EXPORT WinClock : public Clock
+{
+public:
+ WinClock();
+ /**
+ * 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 ~WinClock();
+
+private:
+ /**
+ * The WinClock resolution in nano-seconds
+ */
+ double resolution;
+
+};
+}
+#endif /*WinClock_HH_*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi CMakeLists.txt config.h.cmake libCERTI/CM...,
certi-cvs <=