Changeset 2487 in Sophya for trunk/SophyaLib/SysTools
- Timestamp:
- Dec 26, 2003, 12:19:21 PM (22 years ago)
- Location:
- trunk/SophyaLib/SysTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/resusage.cc
r2322 r2487 36 36 /*! 37 37 Constructor. the \b Update() method is called. 38 */ 39 ResourceUsage::ResourceUsage() 40 { 38 \param pg: Process group RU_Self or RU_Children or RU_All 39 */ 40 ResourceUsage::ResourceUsage(RU_ProcGrp pg) 41 { 42 procgrp = pg; 41 43 struct rlimit rl; 42 44 getrlimit(RLIMIT_DATA, &rl); … … 92 94 { 93 95 struct rusage rsu; 94 int rc = getrusage(RUSAGE_SELF, &rsu); 96 int rc; 97 if ((procgrp == RU_Self) || (procgrp == RU_All)) 98 rc = getrusage(RUSAGE_SELF, &rsu); 99 else 100 rc = getrusage(RUSAGE_CHILDREN, &rsu); 101 95 102 delta_tottm = cur_tottm; 96 103 delta_rss = cur_rss; 97 104 cur_usrtm = s_timeval2msec(rsu.ru_utime); 98 105 cur_systm = s_timeval2msec(rsu.ru_stime); 106 if (procgrp == RU_All) { 107 struct rusage rsuch; 108 rc = getrusage(RUSAGE_CHILDREN, &rsuch); 109 cur_usrtm += s_timeval2msec(rsuch.ru_utime); 110 cur_systm += s_timeval2msec(rsuch.ru_stime); 111 } 99 112 cur_tottm = cur_usrtm+cur_systm; 100 113 delta_tottm = cur_tottm-delta_tottm; … … 130 143 os << " --------------- ResourceUsage::Print(lp=" << lp 131 144 <<" ) --------------- " << endl; 132 int load = getAverageCPULoad()*100.;145 int load = (int)(getAverageCPULoad()*100.); 133 146 os << " CPU-Usage= " << getCPUTime() << " Elapsed= " << getElapsedTime() 134 147 << " msec - Load= " << load << " %" << endl; -
trunk/SophyaLib/SysTools/resusage.h
r2322 r2487 17 17 { 18 18 public: 19 ResourceUsage(); 19 enum RU_ProcGrp {RU_Self=0, RU_Children=1, RU_All=2}; 20 // RU_Self: Resource usage for the process itself 21 // RU_Children: Resource usage for the child processes 22 // RU_All: Process itself and child processes 23 ResourceUsage(RU_ProcGrp pg=RU_Self); 20 24 ~ResourceUsage(); 21 25 … … 85 89 86 90 protected: 91 RU_ProcGrp procgrp; // Process group: self, child, all 87 92 uint_8 max_datasz; // Max data segment size (KBytes) 88 93 uint_8 max_rss; // Max resident size -
trunk/SophyaLib/SysTools/zthread.cc
r2212 r2487 17 17 \sa SOPHYA::ZMutex 18 18 The following sample code shows the usage of ZThread object 19 to run simultaneously t o functions to perform computation.19 to run simultaneously two functions to perform computation. 20 20 21 21 \code
Note:
See TracChangeset
for help on using the changeset viewer.