Changeset 6890 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 03/29/05 09:56:16 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r6513 r6890 263 263 264 264 return kTRUE; 265 } 266 267 // -------------------------------------------------------------------------- 268 // 269 // Return the memory currently used by this process (VmSize) 270 // which contains shared memory, data memory and private memory. 271 // 272 UInt_t MEvtLoop::GetMemoryUsage() 273 { 274 const TString path = Form("/proc/%d/status", gSystem->GetPid()); 275 if (gSystem->AccessPathName(path, kFileExists)) 276 return 0; 277 278 return TEnv(path).GetValue("VmSize", 0); 265 279 } 266 280 … … 400 414 return kFALSE; 401 415 416 const UInt_t mem0 = GetMemoryUsage(); 417 402 418 // 403 419 // loop over all events and process all tasks for … … 514 530 if (numcnts>0) 515 531 *fLog << " --> " << numcnts/clock.RealTime() << " Events/s"; 532 533 534 const UInt_t mem1 = GetMemoryUsage(); 535 if (mem1>mem0) 536 *fLog << endl << "Mem - Loss: " << mem1-mem0 << "kB" << endl; 516 537 517 538 *fLog << endl << endl; -
trunk/MagicSoft/Mars/mbase/MEvtLoop.h
r5911 r6890 40 40 41 41 Bool_t ProcessGuiEvents(Int_t num); 42 static UInt_t GetMemoryUsage(); 42 43 43 44 public: -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r6591 r6890 64 64 65 65 #include <TH1.h> // TH1::AddDirectory 66 #include <TEnv.h> // TEnv 66 67 #include <TLine.h> // TLine 67 68 #include <TText.h> // TText … … 239 240 MGPopupMenu *sizemenu = new MGPopupMenu(gClient->GetRoot()); 240 241 sizemenu->AddEntry("Fit to 640x&480", kSize640); 242 sizemenu->AddEntry("Fit to 768x&576", kSize768); 241 243 sizemenu->AddEntry("Fit to 800x&600", kSize800); 242 244 sizemenu->AddEntry("Fit to 960x7&20", kSize960); 243 245 sizemenu->AddEntry("Fit to 1024x&768", kSize1024); 246 sizemenu->AddEntry("Fit to 1152x&864", kSize1152); 244 247 sizemenu->AddEntry("Fit to 1280x&1024", kSize1280); 248 sizemenu->AddEntry("Fit to 1400x1050", kSize1400); 249 sizemenu->AddEntry("Fit to 1600x1200", kSize1600); 245 250 sizemenu->Associate(this); 246 251 … … 524 529 // a = (-1+-sqrt(1+4))/2 = sqrt(5)/2-1/2 = 0.618 525 530 // 526 Int_t p[ 2] = {38, 62};527 528 fStatusBar->SetParts(p, 2);531 Int_t p[] = {38-2, 62-8, 10}; 532 533 fStatusBar->SetParts(p, 3); 529 534 530 535 TGLayoutHints *layb = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 5, 4, 0, 3); … … 539 544 // Change the text in the status line 1 540 545 // 541 void MStatusDisplay::SetStatusLine 1(const char *txt)546 void MStatusDisplay::SetStatusLine(const char *txt, Int_t i) 542 547 { 543 548 if (gROOT->IsBatch()) 544 549 return; 545 fStatusBar->SetText(txt, 0);550 fStatusBar->SetText(txt, i); 546 551 547 552 // FIXME: This is a workaround, because TApplication::Run is not … … 555 560 // -------------------------------------------------------------------------- 556 561 // 557 // Change the text in the status line 2558 //559 void MStatusDisplay::SetStatusLine2(const char *txt)560 {561 if (gROOT->IsBatch())562 return;563 564 fStatusBar->SetText(txt, 1);565 566 // FIXME: This is a workaround, because TApplication::Run is not567 // thread safe against ProcessEvents. We assume, that if568 // we are not in the Main-Thread ProcessEvents() is569 // called by the TApplication Event Loop...570 if (!TThread::Self()/*gApplication->InheritsFrom(TRint::Class())*/)571 gClient->ProcessEventsFor(fStatusBar);572 }573 574 // --------------------------------------------------------------------------575 //576 562 // Display information about the name of a container 577 563 // … … 643 629 // set the smallest and biggest size of the Main frame 644 630 // and move it to its appearance position 645 SetWMSizeHints(570, 480, 1280, 980, 1, 1);631 SetWMSizeHints(570, 480, 2048, 1536, 1, 1); 646 632 MoveResize(rand()%100+570, rand()%100+480, 570, 480); 647 633 … … 1264 1250 return kTRUE; 1265 1251 1266 case kSize640: 1252 case kSize640: 1267 1253 Resize(570, 480); 1268 1254 return kTRUE; 1269 case kSize800: 1255 case kSize768: 1256 Resize(700, 576); 1257 return kTRUE; 1258 case kSize800: 1270 1259 Resize(740, 600); 1271 1260 return kTRUE; 1272 case kSize960: 1261 case kSize960: 1273 1262 Resize(880, 700); 1274 1263 return kTRUE; 1275 case kSize1024: 1264 case kSize1024: 1276 1265 Resize(980, 768); 1277 1266 return kTRUE; 1278 case kSize1280: 1267 case kSize1152: 1268 Resize(1080, 864); 1269 case kSize1280: 1279 1270 Resize(1280, 980); 1271 return kTRUE; 1272 case kSize1400: 1273 Resize(1350, 1050); 1274 return kTRUE; 1275 case kSize1600: 1276 Resize(1550, 1400); 1280 1277 return kTRUE; 1281 1278 … … 1527 1524 void MStatusDisplay::CloseWindow() 1528 1525 { 1529 Close(); 1526 if (Close()) 1527 delete this; 1530 1528 } 1531 1529 … … 1552 1550 // -------------------------------------------------------------------------- 1553 1551 // 1552 // Update the memory display in the status bar 1553 // 1554 void MStatusDisplay::UpdateMemory() const 1555 { 1556 const TString path = MString::Form("/proc/%d/status", gSystem->GetPid()); 1557 if (gSystem->AccessPathName(path, kFileExists)) 1558 return; 1559 1560 TEnv env(path); 1561 const UInt_t kb = env.GetValue("VmSize", 0); 1562 if (kb==0) 1563 return; 1564 1565 char type = 'k'; 1566 Float_t val = kb; 1567 1568 if (val>999) 1569 { 1570 type = 'M'; 1571 val /= 1024; 1572 } 1573 if (val>999) 1574 { 1575 type = 'G'; 1576 val /= 1024; 1577 } 1578 const TString txt = MString::Form("%.1f%c", val, type); 1579 fStatusBar->SetText(txt, 2); 1580 } 1581 1582 // -------------------------------------------------------------------------- 1583 // 1554 1584 // Updates the canvas (if existing) in the currenly displayed Tab. 1555 1585 // The update intervall is controlled by StartUpdate and StopUpdate … … 1559 1589 if (gROOT->IsBatch()) 1560 1590 return kTRUE; 1591 1592 UpdateMemory(); 1561 1593 1562 1594 const Int_t c = fTab->GetCurrent(); … … 2480 2512 { 2481 2513 if (Close()) 2482 delete this;2514 delete this; 2483 2515 // Close(); 2484 2516 return kTRUE; -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
r5912 r6890 46 46 kTabSaveAsC, kTabPrint, kTabNext, kTabPrevious, kTabRemove, 47 47 // kSize 48 kSize640, kSize800, kSize960, kSize1024, kSize1280, 48 kSize640, kSize768, kSize800, kSize960, kSize1024, kSize1152, 49 kSize1280, kSize1400, kSize1600, 49 50 // kLog 50 51 kLogCopy, kLogClear, kLogSelect, kLogFind, kLogSave, kLogAppend, … … 117 118 Bool_t HandleTimer(TTimer *timer=NULL); 118 119 void UpdateTab(TGCompositeFrame *f); 120 void UpdateMemory() const; 119 121 120 122 void DrawClonePad(TCanvas &newc, TCanvas &oldc) const; … … 127 129 128 130 void RemoveTab(int i); 131 void SetStatusLine(const char *txt, Int_t idx); 129 132 130 133 TRootEmbeddedCanvas *GetEmbeddedCanvas(TGCompositeFrame *cf) const; … … 143 146 TGProgressBar *GetBar() const { return (TGProgressBar*)fBar; } 144 147 145 void SetStatusLine1(const char *txt) ;146 void SetStatusLine2(const char *txt) ;148 void SetStatusLine1(const char *txt) { SetStatusLine(txt, 0); } 149 void SetStatusLine2(const char *txt) { SetStatusLine(txt, 1); } 147 150 void SetStatusLine2(const MParContainer &cont); 148 151
Note:
See TracChangeset
for help on using the changeset viewer.