Changeset 2212 in Sophya for trunk/SophyaLib/SysTools/resusage.h
- Timestamp:
- Oct 15, 2002, 5:48:53 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/resusage.h
r2159 r2212 24 24 // Memory usage in kilo-bytes 25 25 // NOTE: getDataSize() getStackSize() retournent des valeurs bizarres 26 //! Returns the current memory (Resident) size (in kilo-bytes) 26 27 inline uint_8 getMemorySize() { return cur_rss; } 28 //! Returns the maximum allowed memory size: Min( \c MaxResidentSize , \c MaxDataSize )) 27 29 inline uint_8 getMaxMemorySize() 28 30 { return((getMaxResidentSize()<getMaxDataSize()) ? 29 31 getMaxResidentSize() :getMaxDataSize() ); } 32 //! Returns the increase in memory usage since the previous call to \b Update() 30 33 inline uint_8 getDeltaMemorySize() { return delta_rss; } 31 34 35 //! Returns the maximum allowd data segment size (in kilo-bytes) 32 36 inline uint_8 getMaxDataSize() { return((max_datasz>0)?max_datasz:1024); } 37 //! Returns the current data segment size (in kilo-bytes) 33 38 inline uint_8 getDataSize() { return cur_datasz; } 39 //! Returns the maximum allowed resident size (in kilo-bytes) 34 40 inline uint_8 getMaxResidentSize() { return((max_rss>0)?max_rss:1024); } 41 //! Returns the current resident memory size (in kilo-bytes) 35 42 inline uint_8 getResidentSize() { return cur_rss; } 43 //! Returns the maximum allowed stack size (in kilo-bytes) 36 44 inline uint_8 getMaxStackSize() { return max_stack; } 45 //! Returns the current stack size (in kilo-bytes) 37 46 inline uint_8 getStackSize() { return cur_stack; } 38 47 39 48 40 49 // Time in milli-second 50 //! Returns the total CPU time used (in milli-second) 41 51 inline uint_8 getCPUTime() { return cur_tottm; } 52 //! Returns the total elapsed time (in milli-second) 42 53 inline uint_8 getElapsedTime() { return elapsed_time; } 54 //! Returns the average load ( CPU time / elapsed time) 43 55 inline double getAverageCPULoad() 44 56 { return ((elapsed_time>1) ? (double)cur_tottm/(double)elapsed_time: 1.);} 45 57 58 //! Returns the CPU time used since the previous call to \b Update() (in milli-second) 46 59 inline uint_8 getDeltaCPUTime() { return delta_tottm; } 60 //! Returns the elapsed time since the previous call to \b Update() (in milli-second) 47 61 inline uint_8 getDeltaElapsedTime() { return delta_elapsed_time; } 62 //! Returns the CPU load since the previous call to \b Update() 48 63 inline double getCPULoad() 49 64 { return ((delta_elapsed_time>1) ? (double)delta_tottm/(double)delta_elapsed_time: 1.);} 50 65 51 66 67 //! Returns the total CPU time (in milli-second) 52 68 inline uint_8 getTotalCPUTime() { return cur_tottm; } 69 //! Returns the CPU time in user mode (in milli-second) 53 70 inline uint_8 getUserCPUTime() { return cur_usrtm; } 71 //! Returns the CPU time in system mode (in milli-second) 54 72 inline uint_8 getSysCPUTime() { return cur_systm; } 55 73 56 74 57 75 void Print(ostream& os, int lp=0, bool upd=true); 76 //! Alias for the \b Print() method. 58 77 inline void print(ostream& os, int lp=0, bool upd=true){ Print(os,lp,upd); } 59 78 … … 81 100 }; 82 101 102 //! Prints the resource usage information on the output stream 83 103 inline ostream& operator << (ostream& os, ResourceUsage& ru) 84 104 { ru.Print(os,0,true); return(os); }
Note:
See TracChangeset
for help on using the changeset viewer.