Changeset 3579 in Sophya for trunk/SophyaLib/SysTools/ctimer.h
- Timestamp:
- Feb 20, 2009, 12:07:02 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/ctimer.h
r3274 r3579 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: ctimer.h,v 1. 5 2007-07-06 12:54:12 ansari Exp $3 // $Id: ctimer.h,v 1.6 2009-02-20 11:07:02 ansari Exp $ 4 4 // 5 5 … … 11 11 #include <sys/types.h> 12 12 #include <time.h> 13 #include <iostream> 14 #include <stdio.h> 13 #include <sys/time.h> 15 14 #include <string> 15 16 using namespace std; 16 17 17 18 // <summary> Permet de chronometrer des fonctions. </summary> … … 42 43 between the object creation and the last call to Split(). 43 44 */ 44 inline int_8 TotalElapsedTime() { return elapSecT ; }45 inline int_8 TotalElapsedTime() { return elapSecT/1000 ; } 45 46 /*! \brief Return the partial elapsed time (number of seconds). 46 47 between the last two calls to Split(). 47 48 */ 48 inline int_8 PartialElapsedTime() { return elapSecP ; } 49 inline int_8 PartialElapsedTime() { return elapSecP/1000 ; } 50 51 /*! \brief Return the total elapsed time (in milli-seconds), 52 between the object creation and the last call to Split(). 53 */ 54 inline int_8 TotalElapsedTimems() { return elapSecT ; } 55 /*! \brief Return the partial elapsed time (in milli-seconds). 56 between the last two calls to Split(). 57 */ 58 inline int_8 PartialElapsedTimems() { return elapSecP ; } 49 59 50 60 /*! \brief Return the total CPU time in seconds, 51 61 between the object creation and the last call to Split(). 52 62 */ 53 inline floatTotalCPUTime() { return cpuSecT; }63 inline double TotalCPUTime() { return cpuSecT; } 54 64 /*! \brief Return the partial CPU time in seconds, 55 65 between the last two calls to Split(). 56 66 */ 57 inline floatPartialCPUTime() { return cpuSecP; }67 inline double PartialCPUTime() { return cpuSecP; } 58 68 59 69 private: 60 70 clock_t cpu0, cpuSplit; 61 time_telapse0, elapseSplit;62 floatcpuSecT, cpuSecP; // Total and partial CPU time63 int_8 elapSecT, elapSecP; // Total and partial elapsed time 71 struct timeval elapse0, elapseSplit; 72 double cpuSecT, cpuSecP; // Total and partial CPU time 73 int_8 elapSecT, elapSecP; // Total and partial elapsed time in ms 64 74 string timerName; 65 75 bool defprtflg;
Note:
See TracChangeset
for help on using the changeset viewer.