Changeset 2106 in Sophya for trunk/SophyaPI/PIext/pistdimgapp.cc
- Timestamp:
- Jul 17, 2002, 7:30:48 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pistdimgapp.cc
r1971 r2106 42 42 static void showInfoWindow(PIStdImgApp* app); 43 43 static void hideInfoWindow(PIStdImgApp* app); 44 45 46 /* ........................................................... */ 47 /* Classe SIA_RU__Periodic : mise a jour periodique de */ 48 /* la fenetre Stat/Ressource info */ 49 /* ........................................................... */ 50 51 class SIA_RU__Periodic : public PIPeriodic 52 { 53 public: 54 SIA_RU__Periodic(PIStdImgApp* app); 55 virtual ~SIA_RU__Periodic(); 56 virtual void DoPeriodic(); 57 private: 58 PIStdImgApp* _app; 59 }; 60 61 SIA_RU__Periodic::SIA_RU__Periodic(PIStdImgApp* app) 62 : PIPeriodX(1) 63 { 64 _app = app; 65 } 66 67 SIA_RU__Periodic::~SIA_RU__Periodic() 68 { 69 } 70 71 void SIA_RU__Periodic::DoPeriodic() 72 { 73 if (_app) _app->UpdateStatResourceInfo(); 74 } 75 76 /* ............................................................. */ 77 44 78 45 79 /* ........................................................... */ … … 156 190 cmapv = new PICMapView(statcont, "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10); 157 191 cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 158 labstat = new PILabel(statcont, "statlabel", msx-2*(bss+20), 20, 2*bss+20, 10); 159 labstat->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 160 labstat->SetLabel("Stat-Zoom-ColMap Window"); 161 labstat->SetForegroundColor(PI_Red); 162 labstat->SetBorderWidth(1); 192 193 // Widget pour affichage des stats / ressources 194 lab_mem = new PILabel(statcont, "memlab", msx-2*(bss+20), 20, 2*bss+20, 10); 195 lab_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 196 lab_mem->SetLabel("MemoryUsage"); 197 lab_mem->SetForegroundColor(PI_Red); 198 lab_mem->SetBorderWidth(1); 199 therm_mem = new PIThermometer(statcont, "memtherm", msx-2*(bss+20), 20, 2*bss+20, 35); 200 therm_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 201 therm_mem->SetThreshold(0.5, 0.75); 202 203 lab_cpu = new PILabel(statcont, "cpulab", msx-2*(bss+20), 20, 2*bss+20, 60); 204 lab_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 205 lab_cpu->SetLabel("CPUUsage"); 206 lab_cpu->SetForegroundColor(PI_Black); 207 lab_cpu->SetBorderWidth(1); 208 therm_cpu = new PIThermometer(statcont, "cputherm", msx-2*(bss+20), 20, 2*bss+20, 85); 209 therm_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 210 therm_cpu->SetThreshold(0.75, 0.90); 211 212 UpdateStatResourceInfo(); 213 resupd_periodic = new SIA_RU__Periodic(this); 214 //resupd_periodic->SetIntervalms(500); 215 resupd_periodic->Start(); 216 163 217 statcont->Show(); 164 218 // StatZoomWindowSetVisible(true); … … 276 330 delete gimv; 277 331 delete cmapv; 278 delete labstat; 332 333 delete lab_mem; 334 delete therm_mem; 335 delete lab_cpu; 336 delete therm_cpu; 279 337 280 338 delete statcont; … … 285 343 286 344 delete mCons; 287 345 delete consolecont; 288 346 289 347 delete mObjmgrw; … … 296 354 if (mPpfout) delete mPpfout; 297 355 356 if (resupd_periodic) delete resupd_periodic; 357 298 358 if (glst_piai) delete glst_piai; glst_piai = NULL; 359 299 360 } 300 361 … … 1068 1129 1069 1130 /* --Methode-- */ 1131 void PIStdImgApp::UpdateStatResourceInfo() 1132 { 1133 resusg.Update(); 1134 char buff[256]; 1135 string lab; 1136 double frac; 1137 sprintf(buff, "Mem: %ld/Max= %ld kb" , resusg.getMemorySize(), 1138 resusg.getMaxMemorySize()); 1139 lab = buff; 1140 lab_mem->SetLabel(lab); 1141 frac = (double)resusg.getMemorySize()/(double)resusg.getMaxMemorySize(); 1142 therm_mem->SetValue(frac); 1143 1144 sprintf(buff, "CPU: %ld/elap= %ld ms" , resusg.getCPUTime(), 1145 resusg.getElapsedTime()); 1146 lab = buff; 1147 lab_cpu->SetLabel(lab); 1148 therm_cpu->SetValue(resusg.getAverageCPULoad()); 1149 1150 } 1151 1152 /* --Methode-- */ 1070 1153 void PIStdImgApp::RedirectStdOutErr(bool fg) 1071 1154 { … … 1669 1752 } 1670 1753 1754
Note:
See TracChangeset
for help on using the changeset viewer.