Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv4884
Modified Files:
System.cpp System.h
Log Message:
Time measured up to microseconds.
Index: System.cpp
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System/System.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** System.cpp 16 Apr 2007 18:23:42 -0000 1.12
--- System.cpp 7 May 2007 20:06:54 -0000 1.13
***************
*** 34,37 ****
--- 34,39 ----
System *CBM::cbmSystem =0;
+ struct timeval tv;
+
System::System(std::string _filename)
{
***************
*** 557,565 ****
}
! time_t System::Time(void)
{
! return(time(NULL));
}
int System::done(void)
{
--- 559,585 ----
}
! void System::startTimer(void)
{
! timerclear(&tv);
! gettimeofday(&tv, NULL);
! }
!
! double System::endTimer(void)
! {
! struct timeval tv2;
! double sec;
! double usec;
!
! timerclear(&tv2);
! gettimeofday(&tv2, NULL);
!
! sec=(tv2.tv_sec-tv.tv_sec);
! usec=(tv2.tv_usec-tv.tv_usec);
!
! return(sec+usec/1000000.0);
!
}
+
int System::done(void)
{
Index: System.h
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System/System.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** System.h 15 Feb 2007 19:02:38 -0000 1.7
--- System.h 7 May 2007 20:06:54 -0000 1.8
***************
*** 26,29 ****
--- 26,30 ----
#include <string>
+ #include <sys/time.h>
#include <time.h>
***************
*** 273,280 ****
std::string data);
! /** Returns current time in seconds, since EPOC.
! * \return Current time.
*/
! virtual time_t Time(void);
/** Release the object. Frees internal pointers, and removes lockfiles.
--- 274,292 ----
std::string data);
!
! /** Initialize current object's timer.
! *
! * \sa endTimer();
*/
! virtual void startTimer(void);
!
! /** Returns elapsed time in seconds.
! *
! * Elapsed time is computed since last startTimer() call with
! * a precision up to microseconds.
! *
! * \return Time measurement.
! */
! virtual double endTimer(void);
/** Release the object. Frees internal pointers, and removes lockfiles.
|