Changeset 895 in Sophya for trunk/SophyaLib/SysTools
- Timestamp:
- Apr 12, 2000, 7:49:54 PM (25 years ago)
- Location:
- trunk/SophyaLib/SysTools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/ctimer.cc
r241 r895 1 1 // 2 // $Id: ctimer.cc,v 1. 2 1999-04-21 13:11:59ansari Exp $2 // $Id: ctimer.cc,v 1.3 2000-04-12 17:49:40 ansari Exp $ 3 3 // 4 4 … … 8 8 //++ 9 9 // Class Timer 10 // Lib Outils++10 // Lib SysTools 11 11 // include ctimer.h 12 12 // … … 37 37 //-- 38 38 39 /*! 40 \class SOPHYA::Timer 41 This class implements a simple chronometer which can be used for 42 measuring the CPU and elapsed time in functions. The constructor 43 keeps the start time (and CPU time) and an optional message. 44 The \b Split method displays the partial time, and destructor 45 displays the total CPU and elapsed time since timer creation. 46 The macro \b TIMEF create a timer object with the function name. 47 The macro \b SPLITTIME calls the split methode for the timer created 48 by TIMEF. A named timer can be created using the macro \b TIMEN(nom) 49 */ 50 51 /*! Constructor with the specification of a optional name or message */ 39 52 Timer::Timer(const char* name) 40 53 : timerName(name) … … 53 66 //-- 54 67 55 68 /*! Method which displays the partial CPU and elapsed time 69 An optional message can be passed to be used instead of the 70 timer name 71 */ 56 72 void Timer::Split(const char* comm) 57 73 { … … 65 81 int etmt = elapse - elapse0; 66 82 67 cout << "***Timing " << (comm ? comm : timerName ) << endl;83 cout << "***Timing " << (comm ? comm : timerName.c_str()) << endl; 68 84 69 85 // Pour des formats comme ca, la syntaxe printf est plus agreable. -
trunk/SophyaLib/SysTools/ctimer.h
r241 r895 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: ctimer.h,v 1. 2 1999-04-21 13:12:00ansari Exp $3 // $Id: ctimer.h,v 1.3 2000-04-12 17:49:41 ansari Exp $ 4 4 // 5 5 … … 8 8 #define CTIMER_SEEN 9 9 10 #include "machdefs.h" 10 11 #include <sys/types.h> 11 12 #include <time.h> 12 13 #include <iostream.h> 13 14 #include <stdio.h> 14 #include "machdefs.h"15 #include <string> 15 16 16 17 // <summary> Permet de chronometrer des fonctions. </summary> … … 22 23 23 24 // La macro SPLITTIME lui permet d'afficher des temps partiels. 25 namespace SOPHYA { 26 27 //! Simple chronometer class 24 28 class Timer { 25 29 public: … … 35 39 36 40 // Sert a eviter que GNU ne pretende qu'on utilise pas l'objet... 41 /*! To avoid not used object compiler warnings */ 37 42 void Nop() {} 38 43 … … 40 45 clock_t cpu0, cpuSplit; 41 46 time_t elapse0, elapseSplit; 42 const char*timerName;47 string timerName; 43 48 }; 49 50 } // namespace SOPHYA 44 51 45 52 #define TIMEN(x) Timer timer(x); timer.Nop(); -
trunk/SophyaLib/SysTools/pdlmgr.cc
r480 r895 18 18 string* PDynLinkMgr::tmpDir = NULL; 19 19 20 /*! 21 \class SOPHYA::PDynLinkMgr 22 This classes handles the run-time operations related to using shared 23 libraries. The present version has been adapted for different Unix 24 flavours (Linux, Compaq/Digital Unix, SGI IRIX, IBM AIX, Sun Solaris). 25 */ 26 20 27 /* --Methode-Static-- */ 28 /*! Sets the path for a temporary space where shared libraries are copied. 29 The path is appended to \b LD_LIBRARY_PATH 30 */ 21 31 void PDynLinkMgr::SetTmpDir(string const & path) 22 32 { … … 63 73 64 74 /* --Methode-Static-- */ 75 /*! Returns the temporary space path */ 65 76 string& PDynLinkMgr::GetTmpDir() 66 77 { … … 68 79 tmpDir = new string(""); 69 80 char* varenv; 70 if ( (varenv=getenv(" PEIDA_TMP")) != NULL ) *tmpDir = varenv;81 if ( (varenv=getenv("SOPHYA_TMP")) != NULL ) *tmpDir = varenv; 71 82 else if ( (varenv=getenv("TMPDIR")) != NULL ) *tmpDir = varenv; 72 83 } … … 75 86 76 87 /* --Methode-Static-- */ 88 /*! Compiles the C source file named \b fname and creates the 89 corresponding shared library linking against the standard 90 C library (-lc) and the math library (-lm). 91 Returns a pointer to the created PDynLinkMgr object (by new). 92 Returns the NULL pointer in case of errors. 93 */ 77 94 PDynLinkMgr* PDynLinkMgr::BuildFromCFile(string const & fname) 78 95 { … … 131 148 132 149 /* --Methode-- */ 150 /*! The constructor. 151 \param soname : Name of the shared library. ".so" is appended 152 to the name if no dot "." is found in the name. 153 \param cp : if true, copies the shared library in the temporary space. 154 */ 133 155 PDynLinkMgr::PDynLinkMgr(string& soname, bool cp) 134 156 { … … 181 203 182 204 /* --Methode-- */ 205 /*! Destructor. Closes the shared library. Removes the file if it had been 206 copied in the temporary space, or generated by \b BuildFromCFile */ 183 207 PDynLinkMgr::~PDynLinkMgr() 184 208 { … … 196 220 197 221 /* --Methode-- */ 222 /*! Returns a handle to the function named \b funcname. 223 Returns the NULL pointer in case of error */ 198 224 DlFunction PDynLinkMgr::GetFunction(string const & funcname) 199 225 { -
trunk/SophyaLib/SysTools/pdlmgr.h
r480 r895 16 16 #endif 17 17 18 namespace SOPHYA { 19 18 20 typedef void (* DlFunction) (void); 19 21 22 //! Dynamic Link Manager. 20 23 class PDynLinkMgr { 21 24 public: … … 45 48 }; 46 49 50 } // namespace SOPHYA 51 47 52 #endif -
trunk/SophyaLib/SysTools/periodic.h
r480 r895 7 7 #include <list> 8 8 9 namespace SOPHYA { 10 9 11 class Periodic; 10 12 typedef list<Periodic*> PeriodicList; … … 12 14 typedef void (* UsPeriodicAction) (void *); 13 15 16 //! Class for the execution of a periodic action 14 17 class Periodic 15 18 { … … 23 26 virtual void SetIntervalms(int dtms); 24 27 28 /*! Returns the time interval in seconds >= 1 sec */ 25 29 inline int Interval() { return(mDt); } 30 /*! Returns the time interval in milli-second */ 26 31 inline int Intervalms() { return(mDtms); } 27 32 … … 41 46 }; 42 47 48 } // namespace SOPHYA 43 49 44 50 #endif
Note:
See TracChangeset
for help on using the changeset viewer.