Changeset 2438 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 10/28/03 14:54:20 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r2416 r2438 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de>18 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 120 ! Copyright: MAGIC Software Development, 2000-2003 21 21 ! 22 22 ! … … 78 78 #include <TSystem.h> // gSystem 79 79 #include <TStopwatch.h> 80 #include <TGProgressBar.h> 80 #include <TGProgressBar.h> 81 81 82 82 #include "MLog.h" … … 191 191 fProgress=NULL; 192 192 else 193 { 193 194 d->SetBit(kMustCleanup); 195 196 // Get pointer to update Progress bar 197 fProgress = fDisplay->GetBar(); 198 } 194 199 195 200 if (fParList) … … 237 242 // Lock display to prevent user from deleting it 238 243 fDisplay->Lock(); 239 // Get pointer to update Progress bar240 fProgress = fDisplay->GetBar();241 244 // Don't display context menus 242 245 fDisplay->SetNoContextMenu(); … … 267 270 } 268 271 269 Bool_t MEvtLoop::ProcessGuiEvents(Int_t num , Int_t entries)272 Bool_t MEvtLoop::ProcessGuiEvents(Int_t num) 270 273 { 271 274 if (gROOT->IsBatch()) … … 347 350 txt += " ("; 348 351 txt += speed; 349 txt += "Evts/s, est: "; 350 txt += (int)((long int)(t0-t2)*entries/(60000.*(num-start))); 351 txt += "m"; 352 txt += "Evts/s"; 353 if (fNumEvents>0) 354 { 355 txt += ", est: "; 356 txt += (int)((long int)(t0-t2)*fNumEvents/(60000.*(num-start))); 357 txt += "m"; 358 } 352 359 //txt += (int)fmod(entries/(1000.*(num-start)/(long int)(t0-t2)), 60); 353 360 //txt += "s"; … … 362 369 // Set new progress bar position 363 370 // 364 if (fProgress )365 fProgress->SetPosition(num );371 if (fProgress && fNumEvents>0) 372 fProgress->SetPosition(num/fNumEvents); 366 373 367 374 // … … 409 416 410 417 Int_t entries = INT_MAX; 418 fNumEvents = 0; 411 419 412 420 if (fProgress && !gROOT->IsBatch()) 413 421 { 414 422 fProgress->Reset(); 423 fProgress->SetRange(0, 1); 424 415 425 #ifdef __MARS__ 416 426 // limits.h … … 421 431 422 432 if (maxcnt>0) 423 f Progress->SetRange(0, TMath::Min(maxcnt, entries));433 fNumEvents = TMath::Min(maxcnt, entries); 424 434 else 425 435 if (entries!=INT_MAX) 426 f Progress->SetRange(0, entries);436 fNumEvents = entries; 427 437 } 428 438 … … 454 464 { 455 465 numcnts++; 456 if (!ProcessGuiEvents(++dummy , entries))466 if (!ProcessGuiEvents(++dummy)) 457 467 break; 458 468 } … … 462 472 { 463 473 numcnts++; 464 if (!ProcessGuiEvents(maxcnt - dummy , entries))474 if (!ProcessGuiEvents(maxcnt - dummy)) 465 475 break; 466 476 } … … 473 483 if (fProgress && !gROOT->IsBatch()) 474 484 { 475 fProgress->SetPosition(maxcnt>0 ? TMath::Min(maxcnt, entries) : entries); 485 //fProgress->SetPosition(maxcnt>0 ? TMath::Min(maxcnt, entries) : entries); 486 fProgress->SetPosition(1); 476 487 // FIXME: This is a workaround, because TApplication::Run is not thread safe against ProcessEvents 477 488 if (gApplication->InheritsFrom(TRint::Class())) -
trunk/MagicSoft/Mars/mbase/MEvtLoop.h
r2299 r2438 30 30 TGProgressBar *fProgress; //! 31 31 32 ULong_t fNumEvents; //! 33 32 34 enum { kIsOwner = BIT(14) }; 33 35 … … 37 39 void StreamPrimitive(ofstream &out) const; 38 40 39 Bool_t ProcessGuiEvents(Int_t num , Int_t entries);41 Bool_t ProcessGuiEvents(Int_t num); 40 42 41 43 public: -
trunk/MagicSoft/Mars/mbase/MReadSocket.cc
r2386 r2438 30 30 ////////////////////////////////////////////////////////////////////////////// 31 31 #include "MReadSocket.h" 32 33 /*34 #ifdef _REENTRANT35 #include <pthread.h>36 #endif37 */38 32 39 33 #include <unistd.h> // usleep … … 155 149 int MReadSocket::underflow() 156 150 { 151 if (fail()) 152 { 153 setg(fBuffer, fBuffer, fBuffer+fMtu); 154 return 0; 155 } 156 157 157 // 158 158 // This simple trick should do its job, because the … … 161 161 const TTime timeout = fTimeout+gSystem->Now(); 162 162 163 Int_t l , len=-1;163 Int_t len=-1; 164 164 while (len<0 && gSystem->Now()<timeout) 165 165 { 166 Int_t l; 166 167 fRxSocket->GetOption(kBytesToRead, l); 167 168 if (l==0) 168 169 { 169 usleep(1);170 gSystem->Sleep(1); 170 171 continue; 171 172 } … … 177 178 cout << "MReadSocket: TSocket::RecvRaw - Connection timed out." << endl; 178 179 setstate(ios::failbit); 180 memset(fBuffer, 0, fMtu); 181 len = fMtu; 179 182 } 180 183 -
trunk/MagicSoft/Mars/mbase/MTime.h
r2386 r2438 76 76 } 77 77 78 void SetTime(ULong_t t) 79 { 80 // t [millisec] 81 fNanoSec = (t*1000000)%1000; 82 t /= 1000; 83 fSec = t%60; 84 t /= 60; 85 fMin = t%60; 86 t /= 60; 87 fHour = t%24; 88 } 89 90 void SetTime(Double_t t) 91 { 92 // t [s] 93 fNanoSec = (UInt_t)(fmod(t, 1)*1e9); 94 fSec = (Byte_t)fmod(t, 60); 95 t /= 60; 96 fMin = (Byte_t)fmod(t, 60); 97 t /= 60; 98 fHour = (Byte_t)fmod(t, 24); 99 } 100 78 101 void SetTime(Byte_t h, Byte_t m, Byte_t s, UShort_t ns) 79 102 { … … 112 135 return fNanoSec/1e9+(fHour*24*60*60+fMin*60+fSec); 113 136 } 137 double operator()() const //[s] 138 { 139 return operator double(); 140 } 114 141 115 142 ClassDef(MTime, 1) //A generalized MARS time stamp … … 118 145 inline Double_t operator-(MTime &t1, MTime &t2) 119 146 { 120 return (Double_t)t1.GetTimeLo()-(Double_t)t2.GetTimeLo();147 return t1()-t2(); 121 148 } 122 149 123 150 inline Bool_t operator<(MTime &t1, MTime &t2) 124 151 { 125 return (t1.GetTimeHi()<=t2.GetTimeHi()) && (t1.GetTimeLo()<t2.GetTimeLo());152 return t1()<t2(); 126 153 } 127 154 128 155 inline Bool_t operator>(MTime &t1, MTime &t2) 129 156 { 130 return (t1.GetTimeHi()>=t2.GetTimeHi()) && (t1.GetTimeLo()>t2.GetTimeLo());157 return t1()>t2(); 131 158 } 132 159 133 160 inline Bool_t operator<=(MTime &t1, MTime &t2) 134 161 { 135 return (t1.GetTimeHi()<=t2.GetTimeHi()) && (t1.GetTimeLo()<=t2.GetTimeLo());162 return t1<=t2(); 136 163 } 137 164 138 165 inline Bool_t operator>=(MTime &t1, MTime &t2) 139 166 { 140 return (t1.GetTimeHi()>=t2.GetTimeHi()) && (t1.GetTimeLo()>=t2.GetTimeLo());167 return t1()>=t2(); 141 168 } 142 169 143 170 inline Bool_t operator==(MTime &t1, MTime &t2) 144 171 { 145 return (t1.GetTimeLo()==t2.GetTimeLo()) && (t1.GetTimeHi()==t2.GetTimeHi());172 return t1()==t2(); 146 173 } 147 174
Note:
See TracChangeset
for help on using the changeset viewer.