Changeset 3636 in Sophya for trunk/SophyaLib/SysTools/ctimer.h
- Timestamp:
- May 26, 2009, 10:24:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/ctimer.h
r3579 r3636 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: ctimer.h,v 1. 6 2009-02-20 11:07:02ansari Exp $3 // $Id: ctimer.h,v 1.7 2009-05-26 20:24:24 ansari Exp $ 4 4 // 5 5 … … 13 13 #include <sys/time.h> 14 14 #include <string> 15 #include <iostream> 15 16 16 17 using namespace std; … … 35 36 // Si pas de parametre affiche le nom donne a la creation. 36 37 void Split(const char* comm=0, bool prfg=false); 38 39 //! store partial CPU and elapsed time (no print) 40 void SplitQ(); 37 41 38 42 // Sert a eviter que GNU ne pretende qu'on utilise pas l'objet... … … 67 71 inline double PartialCPUTime() { return cpuSecP; } 68 72 73 //! Print the CPU and elapsed time on os (partial time corresponding to the last call to Split()) 74 ostream& Print(ostream& os) const ; 75 //! Print the CPU and elapsed time on cout 76 inline ostream& Print() const { return Print(cout); } 77 69 78 private: 70 79 clock_t cpu0, cpuSplit; … … 76 85 }; 77 86 87 /*! operator << overloading - Calls SplitQ() and Print() */ 88 inline ostream& operator << (ostream& s, Timer& tm) 89 { tm.SplitQ(); tm.Print(s); return(s); } 90 78 91 } // namespace SOPHYA 79 92
Note:
See TracChangeset
for help on using the changeset viewer.