49 #define PPD_SRV_NEWER(v) (fProof && fProof->GetRemoteProtocol() > v)
51 Bool_t TProofProgressDialog::fgKeepDefault = kTRUE;
52 Bool_t TProofProgressDialog::fgLogQueryDefault = kFALSE;
53 TString TProofProgressDialog::fgTextQueryDefault =
"last";
57 ClassImp(TProofProgressDialog);
62 TProofProgressDialog::TProofProgressDialog(TProof *proof,
const char *selector,
63 Int_t files, Long64_t first,
64 Long64_t entries) : fDialog(0),
65 fBar(0), fClose(0), fStop(0), fAbort(0), fAsyn(0), fLog(0), fRatePlot(0),
66 fMemPlot(0), fKeepToggle(0), fLogQueryToggle(0), fTextQuery(0), fEntry(0),
67 fTitleLab(0), fFilesEvents(0), fTimeLab(0), fProcessed(0), fEstim(0),
68 fTotal(0), fRate(0), fInit(0), fSelector(0), fSpeedo(0), fSmoothSpeedo(0)
79 fKeep = fgKeepDefault;
80 fLogQuery = fgLogQueryDefault;
92 fSpeedoEnabled = kFALSE;
98 if (!proof || !(proof->IsValid())) {
99 Error(
"TProofProgressDialog",
"proof instance is invalid (%p, %s): protocol error?",
100 proof, (proof && !(proof->IsValid())) ?
"invalid" :
"undef");
106 fSessionUrl = (proof && proof->GetManager()) ? proof->GetManager()->GetUrl() :
"";
108 if (PPD_SRV_NEWER(25)) {
109 fRatePoints =
new TNtuple(
"RateNtuple",
"Rate progress info",
"tm:evr:mbr:act:tos:efs");
110 }
else if (PPD_SRV_NEWER(11)) {
111 fRatePoints =
new TNtuple(
"RateNtuple",
"Rate progress info",
"tm:evr:mbr");
114 fDialog =
new TGTransientFrame(0, 0, 10, 10);
115 fDialog->Connect(
"CloseWindow()",
"TProofProgressDialog",
this,
"DoClose()");
116 fDialog->DontCallClose();
117 fDialog->SetCleanup(kDeepCleanup);
121 TGHorizontalFrame *hf4 =
new TGHorizontalFrame(fDialog, 100, 100);
123 TGVerticalFrame *vf4 =
new TGVerticalFrame(hf4, 100, 100);
127 buf.Form(
"Executing on PROOF cluster \"%s\" with %d parallel workers:",
128 fProof ? fProof->GetMaster() :
"<dummy>",
129 fProof ? fProof->GetParallel() : 0);
130 fTitleLab =
new TGLabel(vf4, buf);
131 fTitleLab->SetTextJustify(kTextTop | kTextLeft);
132 vf4->AddFrame(fTitleLab,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 5, 0));
133 buf.Form(
"Selector: %s", selector);
134 fSelector =
new TGLabel(vf4, buf);
135 fSelector->SetTextJustify(kTextTop | kTextLeft);
136 vf4->AddFrame(fSelector,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 5, 0));
137 buf.Form(
"%d files, number of events %lld, starting event %lld",
138 fFiles, fEntries, fFirst);
139 fFilesEvents =
new TGLabel(vf4, buf);
140 fFilesEvents->SetTextJustify(kTextTop | kTextLeft);
141 vf4->AddFrame(fFilesEvents,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 5, 0));
144 fBar =
new TGHProgressBar(vf4, TGProgressBar::kFancy, 200);
145 fBar->SetBarColor(
"green");
146 fBar->Percent(kTRUE);
147 fBar->ShowPos(kTRUE);
148 vf4->AddFrame(fBar,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
149 kLHintsExpandX, 10, 10, 5, 5));
152 if (PPD_SRV_NEWER(11)) {
153 TGHorizontalFrame *hf0 =
new TGHorizontalFrame(vf4, 0, 0);
154 TGCompositeFrame *cf0 =
new TGCompositeFrame(hf0, 110, 0, kFixedWidth);
155 cf0->AddFrame(
new TGLabel(cf0,
"Initialization time:"));
157 fInit =
new TGLabel(hf0,
"- secs");
158 fInit->SetTextJustify(kTextTop | kTextLeft);
159 hf0->AddFrame(fInit,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 0, 0));
160 vf4->AddFrame(hf0,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 5, 0));
163 TGHorizontalFrame *hf1 =
new TGHorizontalFrame(vf4, 0, 0);
164 TGCompositeFrame *cf1 =
new TGCompositeFrame(hf1, 110, 0, kFixedWidth);
165 fTimeLab =
new TGLabel(cf1,
"Estimated time left:");
166 fTimeLab->SetTextJustify(kTextTop | kTextLeft);
167 cf1->AddFrame(fTimeLab,
new TGLayoutHints(kLHintsLeft));
169 fEstim =
new TGLabel(hf1,
"- sec");
170 fEstim->SetTextJustify(kTextTop | kTextLeft);
171 hf1->AddFrame(fEstim,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 0, 0));
172 vf4->AddFrame(hf1,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 5, 0));
174 hf1 =
new TGHorizontalFrame(vf4, 0, 0);
175 cf1 =
new TGCompositeFrame(hf1, 110, 0, kFixedWidth);
176 fProcessed =
new TGLabel(cf1,
"Processing status:");
177 fProcessed->SetTextJustify(kTextTop | kTextLeft);
178 cf1->AddFrame(fProcessed,
new TGLayoutHints(kLHintsLeft));
180 fTotal=
new TGLabel(hf1,
"- / - events");
181 fTotal->SetTextJustify(kTextTop | kTextLeft);
182 hf1->AddFrame(fTotal,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 0, 0));
184 vf4->AddFrame(hf1,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 5, 0));
186 TGHorizontalFrame *hf2 =
new TGHorizontalFrame(vf4, 0, 0);
187 TGCompositeFrame *cf2 =
new TGCompositeFrame(hf2, 110, 0, kFixedWidth);
188 cf2->AddFrame(
new TGLabel(cf2,
"Processing rate:"));
190 fRate =
new TGLabel(hf2,
"- events/sec \n");
191 fRate->SetTextJustify(kTextTop | kTextLeft);
192 hf2->AddFrame(fRate,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 0, 0));
193 vf4->AddFrame(hf2,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 5, 0));
196 fKeepToggle =
new TGCheckButton(vf4,
197 new TGHotString(
"Close dialog when processing is complete"));
198 if (!fKeep) fKeepToggle->SetState(kButtonDown);
199 fKeepToggle->Connect(
"Toggled(Bool_t)",
200 "TProofProgressDialog",
this,
"DoKeep(Bool_t)");
201 vf4->AddFrame(fKeepToggle,
new TGLayoutHints(kLHintsBottom, 10, 10, 10, 5));
203 hf4->AddFrame(vf4,
new TGLayoutHints(kLHintsExpandY | kLHintsExpandX));
205 TGVerticalFrame *vf51 =
new TGVerticalFrame(hf4, 20, 20);
207 Int_t enablespeedo = gEnv->GetValue(
"Proof.EnableSpeedo", 0);
208 if (enablespeedo) fSpeedoEnabled = kTRUE;
210 fSpeedo =
new TGSpeedo(vf51, 0.0, 1.0,
"",
" Ev/s");
211 if (fSpeedoEnabled) {
212 fSpeedo->Connect(
"OdoClicked()",
"TProofProgressDialog",
this,
"ToggleOdometerInfos()");
213 fSpeedo->Connect(
"LedClicked()",
"TProofProgressDialog",
this,
"ToggleThreshold()");
215 vf51->AddFrame(fSpeedo);
216 fSpeedo->SetDisplayText(
"Init Time",
"[ms]");
217 fSpeedo->EnablePeakMark();
218 fSpeedo->SetThresholds(0.0, 25.0, 50.0);
219 fSpeedo->SetThresholdColors(TGSpeedo::kRed, TGSpeedo::kOrange, TGSpeedo::kGreen);
220 fSpeedo->SetOdoValue(0);
221 fSpeedo->EnableMeanMark();
223 fSmoothSpeedo =
new TGCheckButton(vf51,
new TGHotString(
"Smooth speedometer update"));
224 if (fSpeedoEnabled) {
225 fSmoothSpeedo->SetState(kButtonDown);
226 fSmoothSpeedo->SetToolTipText(
"Control smoothness in refreshing the speedo");
228 fSmoothSpeedo->SetToolTipText(
"Speedo refreshing is disabled");
229 fSmoothSpeedo->SetState(kButtonDisabled);
231 vf51->AddFrame(fSmoothSpeedo,
new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 0));
233 hf4->AddFrame(vf51,
new TGLayoutHints(kLHintsBottom, 5, 5, 5, 5));
235 fDialog->AddFrame(hf4,
new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
240 TGHorizontalFrame *hf3 =
new TGHorizontalFrame(fDialog, 60, 20);
242 UInt_t nb1 = 0, width1 = 0, height1 = 0;
244 fAsyn =
new TGTextButton(hf3,
"&Run in background");
245 if (fProof->GetRemoteProtocol() >= 22 && fProof->IsSync()) {
246 fAsyn->SetToolTipText(
"Continue running in the background (asynchronous mode), releasing the ROOT prompt");
248 fAsyn->SetToolTipText(
"Switch to asynchronous mode disabled: functionality not supported by the server");
249 fAsyn->SetState(kButtonDisabled);
251 fAsyn->Connect(
"Clicked()",
"TProofProgressDialog",
this,
"DoAsyn()");
252 hf3->AddFrame(fAsyn,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 7, 7, 0, 0));
253 height1 = TMath::Max(height1, fAsyn->GetDefaultHeight());
254 width1 = TMath::Max(width1, fAsyn->GetDefaultWidth()); ++nb1;
256 fStop =
new TGTextButton(hf3,
"&Stop");
257 fStop->SetToolTipText(
"Stop processing, Terminate() will be executed");
258 fStop->Connect(
"Clicked()",
"TProofProgressDialog",
this,
"DoStop()");
259 hf3->AddFrame(fStop,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 7, 7, 0, 0));
260 height1 = TMath::Max(height1, fStop->GetDefaultHeight());
261 width1 = TMath::Max(width1, fStop->GetDefaultWidth()); ++nb1;
263 fAbort =
new TGTextButton(hf3,
"&Cancel");
264 fAbort->SetToolTipText(
"Cancel processing, Terminate() will NOT be executed");
265 fAbort->Connect(
"Clicked()",
"TProofProgressDialog",
this,
"DoAbort()");
266 hf3->AddFrame(fAbort,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 7, 7, 0, 0));
267 height1 = TMath::Max(height1, fAbort->GetDefaultHeight());
268 width1 = TMath::Max(width1, fAbort->GetDefaultWidth()); ++nb1;
270 fClose =
new TGTextButton(hf3,
"&Close");
271 fClose->SetToolTipText(
"Close this dialog");
272 fClose->SetState(kButtonDisabled);
273 fClose->Connect(
"Clicked()",
"TProofProgressDialog",
this,
"DoClose()");
274 hf3->AddFrame(fClose,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 7, 7, 0, 0));
275 height1 = TMath::Max(height1, fClose->GetDefaultHeight());
276 width1 = TMath::Max(width1, fClose->GetDefaultWidth()); ++nb1;
278 fDialog->AddFrame(hf3,
new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX, 5, 5, 5, 5));
280 TGHorizontalFrame *hf5 =
new TGHorizontalFrame(fDialog, 60, 20);
282 fLog =
new TGTextButton(hf5,
"&Show Logs");
283 fLog->SetToolTipText(
"Show query log messages");
284 fLog->Connect(
"Clicked()",
"TProofProgressDialog",
this,
"DoLog()");
285 hf5->AddFrame(fLog,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 7, 7, 0, 0));
287 if (PPD_SRV_NEWER(11)) {
288 fRatePlot =
new TGTextButton(hf5,
"&Performance plot");
289 fRatePlot->SetToolTipText(
"Show rates, chunck sizes, cluster activities ... vs time");
290 fRatePlot->SetState(kButtonDisabled);
291 fRatePlot->Connect(
"Clicked()",
"TProofProgressDialog",
this,
"DoPlotRateGraph()");
292 hf5->AddFrame(fRatePlot,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 7, 7, 0, 0));
295 fMemPlot =
new TGTextButton(hf5,
"&Memory Plot");
296 fMemPlot->Connect(
"Clicked()",
"TProofProgressDialog",
this,
"DoMemoryPlot()");
297 fMemPlot->SetToolTipText(
"Show memory consumption vs entry / merging phase");
298 hf5->AddFrame(fMemPlot,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 7, 7, 0, 0));
300 fUpdtSpeedo =
new TGTextButton(hf5,
"&Enable speedometer");
301 fUpdtSpeedo->Connect(
"Clicked()",
"TProofProgressDialog",
this,
"DoEnableSpeedo()");
302 if (fSpeedoEnabled) {
303 fUpdtSpeedo->ChangeText(
"&Disable speedometer");
304 fUpdtSpeedo->SetToolTipText(
"Disable speedometer");
306 fUpdtSpeedo->ChangeText(
"&Enable speedometer");
307 fUpdtSpeedo->SetToolTipText(
"Enable speedometer (may have an impact on performance)");
309 hf5->AddFrame(fUpdtSpeedo,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 7, 7, 0, 0));
311 fDialog->AddFrame(hf5,
new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX, 5, 5, 5, 5));
314 if (!PPD_SRV_NEWER(18)) {
315 fMemPlot->SetState(kButtonDisabled);
316 TString tip = TString::Format(
"Not supported by the master: required protocol 19 > %d",
317 (fProof ? fProof->GetRemoteProtocol() : -1));
318 fMemPlot->SetToolTipText(tip.Data());
320 fMemPlot->SetToolTipText(
"Show memory consumption");
325 fProof->Connect(
"Progress(Long64_t,Long64_t)",
"TProofProgressDialog",
326 this,
"Progress(Long64_t,Long64_t)");
327 fProof->Connect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
328 "TProofProgressDialog",
this,
329 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
330 fProof->Connect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)",
331 "TProofProgressDialog",
this,
332 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)");
333 fProof->Connect(
"StopProcess(Bool_t)",
"TProofProgressDialog",
this,
334 "IndicateStop(Bool_t)");
335 fProof->Connect(
"ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)",
336 "TProofProgressDialog",
this,
337 "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)");
338 fProof->Connect(
"CloseProgressDialog()",
"TProofProgressDialog",
this,
"DoClose()");
339 fProof->Connect(
"DisableGoAsyn()",
"TProofProgressDialog",
this,
"DisableAsyn()");
344 if (strlen(fProof->GetUser()) > 0)
345 fDialog->SetWindowName(Form(
"PROOF Query Progress: %s@%s",
346 fProof->GetUser(), fProof->GetMaster()));
348 fDialog->SetWindowName(Form(
"PROOF Query Progress: %s", fProof->GetMaster()));
350 fDialog->SetWindowName(
"PROOF Query Progress: <dummy>");
353 fDialog->MapSubwindows();
355 fDialog->Resize(fDialog->GetDefaultSize());
357 const TGWindow *main = gClient->GetRoot();
361 Int_t mw = ((TGFrame *) main)->GetWidth();
362 Int_t mh = ((TGFrame *) main)->GetHeight();
363 Int_t width = fDialog->GetDefaultWidth();
364 Int_t height = fDialog->GetDefaultHeight();
366 gVirtualX->TranslateCoordinates(main->GetId(), main->GetId(),
367 (mw - width), (mh - height) >> 1, ax, ay, wdum);
370 fDialog->SetWMSize(width, height);
371 fDialog->SetWMSizeHints(width, height, width, height, 0, 0);
373 fDialog->SetMWMHints(kMWMDecorAll | kMWMDecorResizeH | kMWMDecorMaximize |
374 kMWMDecorMinimize | kMWMDecorMenu,
375 kMWMFuncAll | kMWMFuncResize | kMWMFuncMaximize |
379 fDialog->Move(ax-10, ay - mh/4);
380 fDialog->SetWMPosition(ax-10, ay - mh/4);
382 fDialog->MapWindow();
384 fStartTime = gSystem->Now();
390 void TProofProgressDialog::ToggleOdometerInfos()
396 if (fRightInfo == 0) {
397 fSpeedo->SetDisplayText(
"Init Time",
"[ms]");
398 fSpeedo->SetOdoValue((Int_t)(fInitTime * 1000.0));
400 else if (fRightInfo == 1) {
401 fSpeedo->SetDisplayText(
"Proc Time",
"[ms]");
402 fSpeedo->SetOdoValue((Int_t)(fProcTime * 1000.0));
408 void TProofProgressDialog::ToggleThreshold()
410 if (fSpeedo->IsThresholdActive()) {
411 fSpeedo->DisableThreshold();
412 fSpeedo->Glow(TGSpeedo::kNoglow);
415 fSpeedo->EnableThreshold();
421 void TProofProgressDialog::ResetProgressDialog(
const char *selec,
422 Int_t files, Long64_t first,
428 buf.Form(
"Executing on PROOF cluster \"%s\" with %d parallel workers:",
429 fProof ? fProof->GetMaster() :
"<dummy>",
430 fProof ? fProof->GetParallel() : 0);
431 fTitleLab->SetText(buf);
442 buf.Form(
"Selector: %s", selec);
443 fSelector->SetText(buf);
446 fTimeLab->SetText(
"Estimated time left:");
447 fProcessed->SetText(
"Processing status:");
450 buf.Form(
"%d files, number of events %lld, starting event %lld",
451 fFiles, fEntries, fFirst);
452 fFilesEvents->SetText(buf);
455 fBar->SetBarColor(
"green");
459 fSpeedo->SetMinMaxScale(0.0, 1.0);
460 fSpeedo->SetMeanValue(0.0);
461 fSpeedo->ResetPeakVal();
464 fStop->SetState(kButtonUp);
465 fAbort->SetState(kButtonUp);
466 fClose->SetState(kButtonDisabled);
467 if (fProof && fProof->IsSync() && fProof->GetRemoteProtocol() >= 22) {
468 fAsyn->SetState(kButtonUp);
470 fAsyn->SetState(kButtonDisabled);
475 fProof->Connect(
"Progress(Long64_t,Long64_t)",
"TProofProgressDialog",
476 this,
"Progress(Long64_t,Long64_t)");
477 fProof->Connect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
478 "TProofProgressDialog",
this,
479 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
480 fProof->Connect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)",
481 "TProofProgressDialog",
this,
482 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)");
483 fProof->Connect(
"StopProcess(Bool_t)",
"TProofProgressDialog",
this,
484 "IndicateStop(Bool_t)");
485 fProof->Connect(
"DisableGoAsyn()",
"TProofProgressDialog",
this,
"DisableAsyn()");
489 fStartTime = gSystem->Now();
492 if (PPD_SRV_NEWER(11))
493 fRatePoints->Reset();
494 SafeDelete(fRateGraph);
495 SafeDelete(fMBRtGraph);
496 SafeDelete(fActWGraph);
497 SafeDelete(fTotSGraph);
498 SafeDelete(fEffSGraph);
507 void TProofProgressDialog::Progress(Long64_t total, Long64_t processed)
510 UInt_t hh=0, mm=0, ss=0;
513 static const char *cproc[] = {
"running",
"done",
514 "STOPPED",
"ABORTED",
"***EVENTS SKIPPED***"};
517 buf.Form(
"Executing on PROOF cluster \"%s\" with %d parallel workers:",
518 fProof ? fProof->GetMaster() :
"<dummy>",
519 fProof ? fProof->GetParallel() : 0);
520 fTitleLab->SetText(buf);
528 if (fPrevProcessed == processed)
532 Long64_t evproc = (processed >= 0) ? processed : fPrevProcessed;
534 if (fEntries != total) {
536 buf.Form(
"%d files, number of events %lld, starting event %lld",
537 fFiles, fEntries, fFirst);
538 fFilesEvents->SetText(buf);
542 Float_t pos = Float_t(Double_t(evproc * 100)/Double_t(total));
543 fBar->SetPosition(pos);
546 fEndTime = gSystem->Now();
547 TTime tdiff = fEndTime - fStartTime;
550 eta = ((Float_t)((Long64_t)tdiff)*total/Float_t(evproc) - Long64_t(tdiff))/1000.;
552 if (processed >= 0 && processed >= total) {
553 tt = (Long_t)Long64_t(tdiff)/1000;
555 hh = (UInt_t)(tt / 3600);
556 mm = (UInt_t)((tt % 3600) / 60);
557 ss = (UInt_t)((tt % 3600) % 60);
560 stm.Form(
"%d h %d min %d sec", hh, mm, ss);
562 stm.Form(
"%d min %d sec", mm, ss);
564 stm.Form(
"%d sec", ss);
565 fProcessed->SetText(
"Processed:");
566 buf.Form(
"%lld events in %s\n", total, stm.Data());
567 fTotal->SetText(buf);
569 fEstim->SetText(
"0 sec");
572 fProof->Disconnect(
"Progress(Long64_t,Long64_t)",
this,
573 "Progress(Long64_t,Long64_t)");
574 fProof->Disconnect(
"StopProcess(Bool_t)",
this,
575 "IndicateStop(Bool_t)");
576 fProof->Disconnect(
"DisableGoAsyn()",
this,
"DisableAsyn()");
580 fAsyn->SetState(kButtonDisabled);
581 fStop->SetState(kButtonDisabled);
582 fAbort->SetState(kButtonDisabled);
583 fClose->SetState(kButtonUp);
584 if (!fKeep) DoClose();
592 Bool_t incomplete = (processed < 0 &&
593 (fPrevProcessed < total || fPrevProcessed == 0))
596 fStatus = kIncomplete;
598 fBar->SetBarColor(
"magenta");
602 hh = (UInt_t)(tt / 3600);
603 mm = (UInt_t)((tt % 3600) / 60);
604 ss = (UInt_t)((tt % 3600) % 60);
607 stm.Form(
"%d h %d min %d sec", hh, mm, ss);
609 stm.Form(
"%d min %d sec", mm, ss);
611 stm.Form(
"%d sec", ss);
613 fEstim->SetText(stm.Data());
614 buf.Form(
"%lld / %lld events", evproc, total);
615 if (fStatus > kDone) {
616 buf += TString::Format(
" - %s", cproc[fStatus]);
618 fTotal->SetText(buf);
620 buf.Form(
"%.1f events/sec\n", Float_t(evproc)/Long64_t(tdiff)*1000.);
625 fAsyn->SetState(kButtonDisabled);
626 fStop->SetState(kButtonDisabled);
627 fAbort->SetState(kButtonDisabled);
628 fClose->SetState(kButtonUp);
634 fPrevProcessed = evproc;
641 void TProofProgressDialog::Progress(Long64_t total, Long64_t processed,
643 Float_t initTime, Float_t procTime,
644 Float_t evtrti, Float_t mbrti,
645 Int_t actw, Int_t tses, Float_t eses)
647 Double_t BinLow, BinHigh;
650 UInt_t hh=0, mm=0, ss=0;
653 static const char *cproc[] = {
"running",
"done",
654 "STOPPED",
"ABORTED",
"***EVENTS SKIPPED***"};
657 buf.Form(
"Executing on PROOF cluster \"%s\" with %d parallel workers:",
658 fProof ? fProof->GetMaster() :
"<dummy>",
659 fProof ? fProof->GetParallel() : 0);
660 fTitleLab->SetText(buf);
663 Info(
"Progress",
"t: %lld, p: %lld, itm: %f, ptm: %f", total, processed, initTime, procTime);
665 if (initTime >= 0.) {
667 fInitTime = initTime;
668 buf.Form(
"%.1f secs", initTime);
670 if (fSpeedoEnabled && fRightInfo == 0)
671 fSpeedo->SetOdoValue((Int_t)(fInitTime * 1000.0));
674 Bool_t over = kFALSE;
683 if (processed > 0 && fPrevProcessed <= 0)
684 while (fRightInfo != 1)
685 ToggleOdometerInfos();
688 if (fPrevProcessed == processed)
692 Long64_t evproc = (processed >= 0) ? processed : fPrevProcessed;
693 Float_t mbsproc = bytesread / TMath::Power(2.,20.);
695 if (fEntries != total) {
697 buf.Form(
"%d files, number of events %lld, starting event %lld",
698 fFiles, fEntries, fFirst);
699 fFilesEvents->SetText(buf);
703 Float_t pos = Float_t(Double_t(evproc * 100)/Double_t(total));
704 fBar->SetPosition(pos);
707 if (evproc > 0 && procTime > 0.)
708 eta = (Float_t) (total - evproc) / (Double_t)evproc * procTime;
712 fProcTime = procTime;
713 fAvgRate = Float_t(evproc) / procTime;
714 fAvgMBRate = mbsproc / procTime;
717 if (fSpeedoEnabled) {
719 fSpeedo->SetOdoValue((Int_t)(fInitTime * 1000.0));
720 else if (fRightInfo == 1)
721 fSpeedo->SetOdoValue((Int_t)(fProcTime * 1000.0));
724 if (over || (processed >= 0 && processed >= total)) {
728 Bool_t incomplete = (processed < 0 &&
729 (fPrevProcessed < total || fPrevProcessed == 0))
733 fStatus = kIncomplete;
735 fBar->SetBarColor(
"magenta");
736 st = TString::Format(
" %s", cproc[fStatus]);
739 tt = (Long_t)fProcTime;
741 hh = (UInt_t)(tt / 3600);
742 mm = (UInt_t)((tt % 3600) / 60);
743 ss = (UInt_t)((tt % 3600) % 60);
746 stm.Form(
"%d h %d min %d sec", hh, mm, ss);
748 stm.Form(
"%d min %d sec", mm, ss);
750 stm.Form(
"%d sec", ss);
751 fProcessed->SetText(
"Processed:");
753 Float_t xb = fAvgMBRate*fProcTime;
754 xb = AdjustBytes(xb, sf);
755 buf.Form(
"%lld events (%.2f %s)\n",
756 std::max(fPrevProcessed, processed), xb, sf.Data());
757 fTotal->SetText(buf);
758 buf.Form(
"%s %s\n", stm.Data(), st.Data());
759 fTimeLab->SetText(
"Processing time:");
760 fEstim->SetText(buf);
761 buf.Form(
"%.1f evts/sec (%.1f MB/sec)\n", fAvgRate, fAvgMBRate);
764 Bool_t useAvg = gEnv->GetValue(
"Proof.RatePlotUseAvg", 0);
767 fRatePoints->Fill(procTime, fAvgRate, fAvgMBRate);
768 fRatePlot->SetState(kButtonUp);
772 fRatePoints->Fill(procTime, evtrti, mbrti, (Float_t)actw, (Float_t)tses, eses);
773 fRatePlot->SetState(kButtonUp);
778 fProof->Disconnect(
"Progress(Long64_t,Long64_t)",
this,
779 "Progress(Long64_t,Long64_t)");
780 fProof->Disconnect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
782 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
783 fProof->Disconnect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)",
785 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)");
786 fProof->Disconnect(
"StopProcess(Bool_t)",
this,
"IndicateStop(Bool_t)");
787 fProof->Disconnect(
"DisableGoAsyn()",
this,
"DisableAsyn()");
791 fAsyn->SetState(kButtonDisabled);
792 fStop->SetState(kButtonDisabled);
793 fAbort->SetState(kButtonDisabled);
794 fClose->SetState(kButtonUp);
796 if (fSmoothSpeedo->GetState() == kButtonDown)
797 fSpeedo->SetScaleValue(0.0, 0);
799 fSpeedo->SetScaleValue(0.0);
800 fSpeedo->Glow(TGSpeedo::kNoglow);
802 if (!fKeep) DoClose();
810 Bool_t incomplete = (processed < 0 &&
811 (fPrevProcessed < total || fPrevProcessed == 0))
814 fStatus = kIncomplete;
816 fBar->SetBarColor(
"magenta");
820 hh = (UInt_t)(tt / 3600);
821 mm = (UInt_t)((tt % 3600) / 60);
822 ss = (UInt_t)((tt % 3600) % 60);
825 stm.Form(
"%d h %d min %d sec", hh, mm, ss);
827 stm.Form(
"%d min %d sec", mm, ss);
829 stm.Form(
"%d sec", ss);
831 fEstim->SetText(stm.Data());
833 Float_t xb = AdjustBytes(mbsproc, sf);
834 buf.Form(
"%lld / %lld events - %.2f %s", evproc, total, xb, sf.Data());
835 if (fStatus > kDone) {
836 buf += TString::Format(
" - %s", cproc[fStatus]);
838 fTotal->SetText(buf);
842 buf.Form(
"%.1f evts/sec \navg: %.1f evts/sec (%.1f MB/sec)",
843 evtrti, fAvgRate, fAvgMBRate);
844 fRatePoints->Fill(procTime, evtrti, mbrti, (Float_t)actw, (Float_t)tses, eses);
845 fRatePlot->SetState(kButtonUp);
846 if (fSpeedoEnabled) {
847 if (evtrti > fSpeedo->GetScaleMax()) {
849 BinLow = fSpeedo->GetScaleMin();
850 BinHigh = 1.5 * evtrti;
851 THLimitsFinder::OptimizeLimits(4, nbins, BinLow, BinHigh, kFALSE);
852 fSpeedo->SetMinMaxScale(fSpeedo->GetScaleMin(), BinHigh);
854 if (fSmoothSpeedo->GetState() == kButtonDown)
855 fSpeedo->SetScaleValue(evtrti, 0);
857 fSpeedo->SetScaleValue(evtrti);
858 fSpeedo->SetMeanValue(fAvgRate);
861 buf.Form(
"avg: %.1f evts/sec (%.1f MB/sec)", fAvgRate, fAvgMBRate);
867 fAsyn->SetState(kButtonDisabled);
868 fStop->SetState(kButtonDisabled);
869 fAbort->SetState(kButtonDisabled);
870 fClose->SetState(kButtonUp);
872 if (fSpeedoEnabled) {
873 if (fSmoothSpeedo->GetState() == kButtonDown)
874 fSpeedo->SetScaleValue(0.0, 0);
876 fSpeedo->SetScaleValue(0.0);
877 fSpeedo->Glow(TGSpeedo::kNoglow);
884 fPrevProcessed = evproc;
890 Float_t TProofProgressDialog::AdjustBytes(Float_t mbs, TString &sf)
909 TProofProgressDialog::~TProofProgressDialog()
912 fProof->Disconnect(
"Progress(Long64_t,Long64_t)",
this,
913 "Progress(Long64_t,Long64_t)");
914 fProof->Disconnect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
916 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
917 fProof->Disconnect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)",
919 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)");
920 fProof->Disconnect(
"StopProcess(Bool_t)",
this,
"IndicateStop(Bool_t)");
921 fProof->Disconnect(
"DisableGoAsyn()",
this,
"DisableAsyn()");
922 fProof->Disconnect(
"ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)",
924 "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)");
925 fProof->Disconnect(
"CloseProgressDialog()",
this,
"CloseProgressDialog()");
926 fProof->ResetProgressDialogStatus();
928 if (!fProof->IsValid())
942 void TProofProgressDialog::CloseWindow()
950 void TProofProgressDialog::DisableAsyn()
952 fProof->Disconnect(
"DisableGoAsyn()",
this,
"DisableAsyn()");
953 fAsyn->SetState(kButtonDisabled);
959 void TProofProgressDialog::IndicateStop(Bool_t aborted)
961 if (aborted == kTRUE)
962 fBar->SetBarColor(
"red");
964 fBar->SetBarColor(
"yellow");
967 fProof->Disconnect(
"Progress(Long64_t,Long64_t)",
this,
968 "Progress(Long64_t,Long64_t)");
969 fProof->Disconnect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
971 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
972 fProof->Disconnect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)",
974 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)");
975 fProof->Disconnect(
"StopProcess(Bool_t)",
this,
"IndicateStop(Bool_t)");
976 fProof->Disconnect(
"DisableGoAsyn()",
this,
"DisableAsyn()");
978 fAsyn->SetState(kButtonDisabled);
979 fStop->SetState(kButtonDisabled);
980 fAbort->SetState(kButtonDisabled);
983 fClose->SetState(kButtonUp);
991 void TProofProgressDialog::LogMessage(
const char *msg, Bool_t all)
996 fLogWindow->LoadBuffer(msg);
999 fLogWindow->AddBuffer(msg);
1007 void TProofProgressDialog::DoClose()
1009 fClose->SetState(kButtonDisabled);
1010 TTimer::SingleShot(50,
"TProofProgressDialog",
this,
"CloseWindow()");
1016 void TProofProgressDialog::DoLog()
1020 fLogWindow =
new TProofProgressLog(
this);
1021 if (!fLogWindow->TestBit(TObject::kInvalidObject))
1022 fLogWindow->DoLog();
1025 if (!fLogWindow->TestBit(TObject::kInvalidObject)) {
1026 fLogWindow->Clear();
1027 fLogWindow->DoLog();
1036 void TProofProgressDialog::DoKeep(Bool_t)
1041 fgKeepDefault = fKeep;
1047 void TProofProgressDialog::DoSetLogQuery(Bool_t)
1049 fLogQuery = !fLogQuery;
1050 fEntry->SetEnabled(fLogQuery);
1052 fEntry->SetToolTipText(
"Enter the query number ('last' for the last query)",50);
1054 fEntry->SetToolTipText(0);
1057 fgLogQueryDefault = fLogQuery;
1063 void TProofProgressDialog::DoStop()
1066 Long_t timeout = gEnv->GetValue(
"Proof.ShutdownTimeout", 60) / 2;
1067 timeout = (timeout > 10) ? timeout : 10;
1068 fProof->StopProcess(kFALSE, timeout);
1072 fAsyn->SetState(kButtonDisabled);
1073 fStop->SetState(kButtonDisabled);
1074 fAbort->SetState(kButtonDisabled);
1075 fClose->SetState(kButtonUp);
1081 void TProofProgressDialog::DoAbort()
1083 fProof->StopProcess(kTRUE);
1087 fAsyn->SetState(kButtonDisabled);
1088 fStop->SetState(kButtonDisabled);
1089 fAbort->SetState(kButtonDisabled);
1090 fClose->SetState(kButtonUp);
1096 void TProofProgressDialog::DoAsyn()
1098 fProof->GoAsynchronous();
1101 fAsyn->SetState(kButtonDisabled);
1107 void TProofProgressDialog::DoPlotRateGraph()
1110 if (!fRatePoints || fRatePoints->GetEntries() <= 0) {
1111 Info(
"DoPlotRateGraph",
"list is empty!");
1116 Int_t np = (Int_t)fRatePoints->GetEntries();
1117 Double_t eymx = -1., bymx = -1., wymx = -1., tymx=-1., symx = -1.;
1118 SafeDelete(fRateGraph);
1119 SafeDelete(fMBRtGraph);
1120 SafeDelete(fActWGraph);
1121 SafeDelete(fTotSGraph);
1122 SafeDelete(fEffSGraph);
1123 fRateGraph =
new TGraph(np);
1124 fMBRtGraph =
new TGraph(np);
1125 if (PPD_SRV_NEWER(25)) {
1126 fActWGraph =
new TGraph(np);
1127 fTotSGraph =
new TGraph(np);
1128 fEffSGraph =
new TGraph(np);
1130 Float_t *nar = fRatePoints->GetArgs();
1132 for ( ; ii < np; ++ii) {
1133 fRatePoints->GetEntry(ii);
1134 if (!(nar[1] > 0.))
continue;
1136 fRateGraph->SetPoint(ii, (Double_t) nar[0], (Double_t) nar[1]);
1137 eymx = (nar[1] > eymx) ? nar[1] : eymx;
1139 fMBRtGraph->SetPoint(ii, (Double_t) nar[0], (Double_t) nar[2]);
1140 bymx = (nar[2] > bymx) ? nar[2] : bymx;
1142 if (PPD_SRV_NEWER(25)) {
1143 fActWGraph->SetPoint(ii, (Double_t) nar[0], (Double_t) nar[3]);
1144 wymx = (nar[3] > wymx) ? nar[3] : wymx;
1147 if (PPD_SRV_NEWER(25)) {
1148 fTotSGraph->SetPoint(ii, (Double_t) nar[0], (Double_t) nar[4]);
1149 tymx = (nar[4] > tymx) ? nar[4] : tymx;
1150 fEffSGraph->SetPoint(ii, (Double_t) nar[0], (Double_t) nar[5]);
1151 symx = (nar[5] > symx) ? nar[5] : symx;
1162 SafeDelete(fMBRtGraph);
1168 SafeDelete(fActWGraph);
1174 SafeDelete(fTotSGraph);
1175 SafeDelete(fEffSGraph);
1179 if (tymx <= 0.) SafeDelete(fTotSGraph);
1180 if (symx <= 0.) SafeDelete(fEffSGraph);
1183 Int_t jsz = 200*npads;
1184 TCanvas *c1 =
new TCanvas(
"c1",
"Rate vs Time",200,10,700,jsz);
1185 c1->SetFillColor(0);
1187 c1->SetBorderMode(0);
1188 c1->SetFrameBorderMode(0);
1191 c1->Divide(1, npads);
1194 TPad *cpad = (TPad *) c1->GetPad(kEvrt);
1197 cpad->SetFillColor(0);
1198 cpad->SetBorderMode(20);
1199 cpad->SetFrameBorderMode(0);
1201 fRateGraph->SetMinimum(0.);
1202 fRateGraph->SetMaximum(eymx*1.1);
1203 fRateGraph->SetLineColor(50);
1204 fRateGraph->SetLineWidth(2);
1205 fRateGraph->SetMarkerColor(38);
1206 fRateGraph->SetMarkerStyle(25);
1207 fRateGraph->SetMarkerSize(0.8);
1208 fRateGraph->SetTitle(
"Processing rate (evts/sec)");
1209 fRateGraph->GetXaxis()->SetTitle(
"elapsed time (sec)");
1210 fRateGraph->Draw(
"ALP");
1213 TLine *line =
new TLine(fRateGraph->GetXaxis()->GetXmin(),fAvgRate,
1214 fRateGraph->GetXaxis()->GetXmax(),fAvgRate);
1215 line->SetLineColor(8);
1216 line->SetLineStyle(2);
1217 line->SetLineWidth(2);
1221 Double_t xax0 = fRateGraph->GetXaxis()->GetXmin();
1222 Double_t xax1 = fRateGraph->GetXaxis()->GetXmax();
1224 Double_t yax1 = eymx*1.1;
1225 Double_t x0 = xax0 + 0.05 * (xax1 - xax0);
1226 Double_t x1 = xax0 + 0.60 * (xax1 - xax0);
1227 Double_t y0 = yax0 + 0.10 * (yax1 - yax0);
1228 Double_t y1 = yax0 + 0.20 * (yax1 - yax0);
1229 TPaveText *pt =
new TPaveText(x0, y0, x1, y1,
"br");
1230 pt->SetFillColor(0);
1231 pt->AddText(Form(
"Global average: %.2f evts/sec", fAvgRate));
1236 cpad = (TPad *) c1->GetPad(kMBrt);
1239 cpad->SetFillColor(0);
1240 cpad->SetBorderMode(0);
1241 cpad->SetFrameBorderMode(0);
1243 fMBRtGraph->SetFillColor(38);
1244 TH1F *graph2 =
new TH1F(
"graph2",
"Average read chunck size (MBs/request)",100,
1245 fRateGraph->GetXaxis()->GetXmin(),fRateGraph->GetXaxis()->GetXmax());
1246 graph2->SetMinimum(0);
1247 graph2->SetMaximum(1.1*bymx);
1248 graph2->SetDirectory(0);
1249 graph2->SetStats(0);
1250 graph2->GetXaxis()->SetTitle(
"elapsed time (sec)");
1251 fMBRtGraph->SetHistogram(graph2);
1252 fMBRtGraph->Draw(
"AB");
1257 cpad = (TPad *) c1->GetPad(kActW);
1260 cpad->SetFillColor(0);
1261 cpad->SetBorderMode(0);
1262 cpad->SetFrameBorderMode(0);
1264 fActWGraph->SetMinimum(0.);
1265 fActWGraph->SetMaximum(wymx*1.1);
1266 fActWGraph->SetLineColor(50);
1267 fActWGraph->SetLineWidth(2);
1268 fActWGraph->SetMarkerColor(38);
1269 fActWGraph->SetMarkerStyle(25);
1270 fActWGraph->SetMarkerSize(0.8);
1271 fActWGraph->SetTitle(
"Active workers");
1272 fActWGraph->GetXaxis()->SetTitle(
"elapsed time (sec)");
1273 fActWGraph->Draw(
"ALP");
1278 cpad = (TPad *) c1->GetPad(kSess);
1281 cpad->SetFillColor(0);
1282 cpad->SetBorderMode(0);
1283 cpad->SetFrameBorderMode(0);
1285 fTotSGraph->SetMinimum(0.);
1286 fTotSGraph->SetMaximum(tymx*1.1);
1287 fTotSGraph->SetLineColor(50);
1288 fTotSGraph->SetLineWidth(2);
1289 fTotSGraph->SetMarkerColor(38);
1290 fTotSGraph->SetMarkerStyle(25);
1291 fTotSGraph->SetMarkerSize(0.8);
1292 fTotSGraph->SetTitle(
"Active, Effective sessions");
1293 fTotSGraph->GetXaxis()->SetTitle(
"elapsed time (sec)");
1294 fTotSGraph->Draw(
"ALP");
1298 fEffSGraph->SetMinimum(0.);
1299 fEffSGraph->SetMaximum(tymx*1.1);
1300 fEffSGraph->SetLineColor(38);
1301 fEffSGraph->SetLineWidth(2);
1302 fEffSGraph->SetMarkerColor(50);
1303 fEffSGraph->SetMarkerStyle(21);
1304 fEffSGraph->SetMarkerSize(0.6);
1305 fEffSGraph->Draw(
"SLP");
1315 void TProofProgressDialog::DoMemoryPlot()
1318 fMemWindow =
new TProofProgressMemoryPlot(
this, 500, 300);
1319 fMemWindow->DoPlot();
1322 fMemWindow->Clear();
1323 fMemWindow->DoPlot();
1330 void TProofProgressDialog::DoEnableSpeedo()
1332 if (!fSpeedoEnabled) {
1334 fSpeedoEnabled = kTRUE;
1335 fSpeedo->Connect(
"OdoClicked()",
"TProofProgressDialog",
this,
"ToggleOdometerInfos()");
1336 fSpeedo->Connect(
"LedClicked()",
"TProofProgressDialog",
this,
"ToggleThreshold()");
1337 fUpdtSpeedo->ChangeText(
"&Disable speedometer");
1338 fUpdtSpeedo->SetToolTipText(
"Disable speedometer");
1339 fSmoothSpeedo->SetState(kButtonDown);
1340 fSmoothSpeedo->SetToolTipText(
"Control smoothness in refreshing the speedo");
1343 fSpeedoEnabled = kFALSE;
1345 fSpeedo->SetScaleValue(0);
1346 fUpdtSpeedo->ChangeText(
"&Enable speedometer");
1347 fUpdtSpeedo->SetToolTipText(
"Enable speedometer (may have an impact on performance)");
1348 fSmoothSpeedo->SetToolTipText(
"Speedo refreshing is disabled");
1349 fSmoothSpeedo->SetState(kButtonDisabled);