ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TProofProgressDialog.cxx
Go to the documentation of this file.
1 // @(#)root/sessionviewer:$Id$
2 // Author: Fons Rademakers 21/03/03
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2003, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TProofProgressDialog //
15 // //
16 // This class provides a query progress bar. //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 
20 #include "TProofProgressDialog.h"
21 #include "TProofProgressLog.h"
23 #include "TEnv.h"
24 #include "TError.h"
25 #include "TGLabel.h"
26 #include "TGButton.h"
27 #include "TGTextBuffer.h"
28 #include "TGTextEntry.h"
29 #include "TGProgressBar.h"
30 #include "TGSpeedo.h"
31 #include "TProof.h"
32 #include "TSlave.h"
33 #include "TSystem.h"
34 #include "TTimer.h"
35 #include "TGraph.h"
36 #include "TNtuple.h"
37 #include "TCanvas.h"
38 #include "TColor.h"
39 #include "TLine.h"
40 #include "TAxis.h"
41 #include "TPaveText.h"
42 #include "TMath.h"
43 #include "TH1F.h"
44 #include "THLimitsFinder.h"
45 
46 #ifdef PPD_SRV_NEWER
47 #undef PPD_SRV_NEWER
48 #endif
49 #define PPD_SRV_NEWER(v) (fProof && fProof->GetRemoteProtocol() > v)
50 
53 TString TProofProgressDialog::fgTextQueryDefault = "last";
54 
55 //static const Int_t gSVNMemPlot = 25090;
56 
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// Create PROOF processing progress dialog.
61 
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)
69 {
70  fProof = proof;
71  fFiles = files;
72  fFirst = first;
73  fEntries = entries;
74  fPrevProcessed = 0;
75  fPrevTotal = 0;
76  fLogWindow = 0;
77  fMemWindow = 0;
78  fStatus = kRunning;
79  fKeep = fgKeepDefault;
80  fLogQuery = fgLogQueryDefault;
81  fRatePoints = 0;
82  fRateGraph = 0;
83  fMBRtGraph = 0;
84  fActWGraph = 0;
85  fTotSGraph = 0;
86  fEffSGraph = 0;
87  fProcTime = 0.;
88  fInitTime = 0.;
89  fAvgRate = 0.;
90  fAvgMBRate = 0.;
91  fRightInfo = 0;
92  fSpeedoEnabled = kFALSE;
93  fSpeedo = 0;
94  fUpdtSpeedo = 0;
95  fSmoothSpeedo = 0;
96 
97  // Make sure we are attached to a good instance
98  if (!proof || !(proof->IsValid())) {
99  Error("TProofProgressDialog", "proof instance is invalid (%p, %s): protocol error?",
100  proof, (proof && !(proof->IsValid())) ? "invalid" : "undef");
101  return;
102  }
103 
104  // Have to save this information here, in case gProof is dead when
105  // the logs are requested
106  fSessionUrl = (proof && proof->GetManager()) ? proof->GetManager()->GetUrl() : "";
107 
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");
112  }
113 
114  fDialog = new TGTransientFrame(0, 0, 10, 10);
115  fDialog->Connect("CloseWindow()", "TProofProgressDialog", this, "DoClose()");
116  fDialog->DontCallClose();
117  fDialog->SetCleanup(kDeepCleanup);
118 
119 //=======================================================================================
120 
121  TGHorizontalFrame *hf4 = new TGHorizontalFrame(fDialog, 100, 100);
122 
123  TGVerticalFrame *vf4 = new TGVerticalFrame(hf4, 100, 100);
124 
125  // Title label
126  TString buf;
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));
142 
143  // Progress bar
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));
150 
151  // Status labels
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:"));
156  hf0->AddFrame(cf0);
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));
161  }
162 
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));
168  hf1->AddFrame(cf1);
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));
173 
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));
179  hf1->AddFrame(cf1);
180  fTotal= new TGLabel(hf1, "- / - events");
181  fTotal->SetTextJustify(kTextTop | kTextLeft);
182  hf1->AddFrame(fTotal, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 0, 0));
183 
184  vf4->AddFrame(hf1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 10, 10, 5, 0));
185 
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:"));
189  hf2->AddFrame(cf2);
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));
194 
195  // Keep toggle button
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));
202 
204 
205  TGVerticalFrame *vf51 = new TGVerticalFrame(hf4, 20, 20);
206 
207  Int_t enablespeedo = gEnv->GetValue("Proof.EnableSpeedo", 0);
208  if (enablespeedo) fSpeedoEnabled = kTRUE;
209 
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()");
214  }
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();
222 
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");
227  } else {
228  fSmoothSpeedo->SetToolTipText("Speedo refreshing is disabled");
229  fSmoothSpeedo->SetState(kButtonDisabled);
230  }
231  vf51->AddFrame(fSmoothSpeedo, new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 0));
232 
233  hf4->AddFrame(vf51, new TGLayoutHints(kLHintsBottom, 5, 5, 5, 5));
234 
235  fDialog->AddFrame(hf4, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
236 
237 //==========================================================================================
238 
239  // Stop, cancel and close buttons
240  TGHorizontalFrame *hf3 = new TGHorizontalFrame(fDialog, 60, 20);
241 
242  UInt_t nb1 = 0, width1 = 0, height1 = 0;
243 
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");
247  } else {
248  fAsyn->SetToolTipText("Switch to asynchronous mode disabled: functionality not supported by the server");
249  fAsyn->SetState(kButtonDisabled);
250  }
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;
255 
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;
262 
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;
269 
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;
277 
278  fDialog->AddFrame(hf3, new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX, 5, 5, 5, 5));
279 
280  TGHorizontalFrame *hf5 = new TGHorizontalFrame(fDialog, 60, 20);
281 
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));
286 
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));
293  }
294 
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));
299 
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");
305  } else {
306  fUpdtSpeedo->ChangeText("&Enable speedometer");
307  fUpdtSpeedo->SetToolTipText("Enable speedometer (may have an impact on performance)");
308  }
309  hf5->AddFrame(fUpdtSpeedo, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 7, 7, 0, 0));
310 
311  fDialog->AddFrame(hf5, new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX, 5, 5, 5, 5));
312 
313  // Only enable if master supports it
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());
319  } else {
320  fMemPlot->SetToolTipText("Show memory consumption");
321  }
322 
323  // Connect slot to proof progress signal
324  if (fProof) {
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()");
340  }
341 
342  // Set dialog title
343  if (fProof) {
344  if (strlen(fProof->GetUser()) > 0)
345  fDialog->SetWindowName(Form("PROOF Query Progress: %s@%s",
346  fProof->GetUser(), fProof->GetMaster()));
347  else
348  fDialog->SetWindowName(Form("PROOF Query Progress: %s", fProof->GetMaster()));
349  } else
350  fDialog->SetWindowName("PROOF Query Progress: <dummy>");
351 
352  // Map all widgets and calculate size of dialog
353  fDialog->MapSubwindows();
354 
355  fDialog->Resize(fDialog->GetDefaultSize());
356 
357  const TGWindow *main = gClient->GetRoot();
358  // Position relative to the parent window (which is the root window)
359  Window_t wdum;
360  int ax, ay;
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();
365 
366  gVirtualX->TranslateCoordinates(main->GetId(), main->GetId(),
367  (mw - width), (mh - height) >> 1, ax, ay, wdum);
368 
369  // Make the message box non-resizable
370  fDialog->SetWMSize(width, height);
371  fDialog->SetWMSizeHints(width, height, width, height, 0, 0);
372 
373  fDialog->SetMWMHints(kMWMDecorAll | kMWMDecorResizeH | kMWMDecorMaximize |
378 
379  fDialog->Move(ax-10, ay - mh/4);
380  fDialog->SetWMPosition(ax-10, ay - mh/4);
381  // Popup dialog and wait till user replies
382  fDialog->MapWindow();
383 
384  fStartTime = gSystem->Now();
385 }
386 
387 ////////////////////////////////////////////////////////////////////////////////
388 /// Toggle information displayed in Analog Meter
389 
391 {
392  if (fRightInfo < 1)
393  fRightInfo++;
394  else
395  fRightInfo = 0;
396  if (fRightInfo == 0) {
397  fSpeedo->SetDisplayText("Init Time", "[ms]");
398  fSpeedo->SetOdoValue((Int_t)(fInitTime * 1000.0));
399  }
400  else if (fRightInfo == 1) {
401  fSpeedo->SetDisplayText("Proc Time", "[ms]");
402  fSpeedo->SetOdoValue((Int_t)(fProcTime * 1000.0));
403  }
404 }
405 
406 ////////////////////////////////////////////////////////////////////////////////
407 
409 {
410  if (fSpeedo->IsThresholdActive()) {
413  }
414  else
416 }
417 
418 ////////////////////////////////////////////////////////////////////////////////
419 /// Reset dialog box preparing for new query
420 
422  Int_t files, Long64_t first,
423  Long64_t entries)
424 {
425  TString buf;
426 
427  // Update title
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);
432 
433  // Reset members
434  fFiles = files;
435  fFirst = first;
436  fEntries = entries;
437  fPrevProcessed = 0;
438  fPrevTotal = 0;
439  fStatus = kRunning;
440 
441  // Update selector name
442  buf.Form("Selector: %s", selec);
443  fSelector->SetText(buf);
444 
445  // Reset 'estim' and 'processed' text
446  fTimeLab->SetText("Estimated time left:");
447  fProcessed->SetText("Processing status:");
448 
449  // Update numbers
450  buf.Form("%d files, number of events %lld, starting event %lld",
452  fFilesEvents->SetText(buf);
453 
454  // Reset progress bar
455  fBar->SetBarColor("green");
456  fBar->Reset();
457 
458  // Reset speedo
459  fSpeedo->SetMinMaxScale(0.0, 1.0);
460  fSpeedo->SetMeanValue(0.0);
462 
463  // Reset buttons
467  if (fProof && fProof->IsSync() && fProof->GetRemoteProtocol() >= 22) {
469  } else {
471  }
472 
473  // Reconnect the slots
474  if (fProof) {
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()");
486  }
487 
488  // Reset start time
489  fStartTime = gSystem->Now();
490 
491  // Clear the list of performances points
492  if (PPD_SRV_NEWER(11))
493  fRatePoints->Reset();
499  fAvgRate = 0.;
500  fAvgMBRate = 0.;
501 }
502 
503 ////////////////////////////////////////////////////////////////////////////////
504 /// Update progress bar and status labels.
505 /// Use "processed == total" or "processed < 0" to indicate end of processing.
506 
508 {
509  Long_t tt;
510  UInt_t hh=0, mm=0, ss=0;
511  TString buf;
512  TString stm;
513  static const char *cproc[] = { "running", "done",
514  "STOPPED", "ABORTED", "***EVENTS SKIPPED***"};
515 
516  // Update title
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);
521 
522  if (total < 0)
523  total = fPrevTotal;
524  else
525  fPrevTotal = total;
526 
527  // Nothing to update
528  if (fPrevProcessed == processed)
529  return;
530 
531  // Number of processed events
532  Long64_t evproc = (processed >= 0) ? processed : fPrevProcessed;
533 
534  if (fEntries != total) {
535  fEntries = total;
536  buf.Form("%d files, number of events %lld, starting event %lld",
538  fFilesEvents->SetText(buf);
539  }
540 
541  // Update position
542  Float_t pos = Float_t(Double_t(evproc * 100)/Double_t(total));
543  fBar->SetPosition(pos);
544 
545  // get current time
546  fEndTime = gSystem->Now();
547  TTime tdiff = fEndTime - fStartTime;
548  Float_t eta = 0;
549  if (evproc > 0)
550  eta = ((Float_t)((Long64_t)tdiff)*total/Float_t(evproc) - Long64_t(tdiff))/1000.;
551 
552  if (processed >= 0 && processed >= total) {
553  tt = (Long_t)Long64_t(tdiff)/1000;
554  if (tt > 0) {
555  hh = (UInt_t)(tt / 3600);
556  mm = (UInt_t)((tt % 3600) / 60);
557  ss = (UInt_t)((tt % 3600) % 60);
558  }
559  if (hh)
560  stm.Form("%d h %d min %d sec", hh, mm, ss);
561  else if (mm)
562  stm.Form("%d min %d sec", mm, ss);
563  else
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);
568 
569  fEstim->SetText("0 sec");
570 
571  if (fProof) {
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()");
577  }
578 
579  // Set button state
584  if (!fKeep) DoClose();
585 
586  // Set the status to done
587  fStatus = kDone;
588 
589  } else {
590  // A negative value for process indicates that we are finished,
591  // no matter whether the processing was complete
592  Bool_t incomplete = (processed < 0 &&
593  (fPrevProcessed < total || fPrevProcessed == 0))
594  ? kTRUE : kFALSE;
595  if (incomplete) {
597  // We use a different color to highlight incompletion
598  fBar->SetBarColor("magenta");
599  }
600  tt = (Long_t)eta;
601  if (tt > 0) {
602  hh = (UInt_t)(tt / 3600);
603  mm = (UInt_t)((tt % 3600) / 60);
604  ss = (UInt_t)((tt % 3600) % 60);
605  }
606  if (hh)
607  stm.Form("%d h %d min %d sec", hh, mm, ss);
608  else if (mm)
609  stm.Form("%d min %d sec", mm, ss);
610  else
611  stm.Form("%d sec", ss);
612 
613  fEstim->SetText(stm.Data());
614  buf.Form("%lld / %lld events", evproc, total);
615  if (fStatus > kDone) {
616  buf += TString::Format(" - %s", cproc[fStatus]);
617  }
618  fTotal->SetText(buf);
619 
620  buf.Form("%.1f events/sec\n", Float_t(evproc)/Long64_t(tdiff)*1000.);
621  fRate->SetText(buf);
622 
623  if (processed < 0) {
624  // And we disable the buttons
629 
630  // Set the status to done
631  fStatus = kDone;
632  }
633  }
634  fPrevProcessed = evproc;
635 }
636 
637 ////////////////////////////////////////////////////////////////////////////////
638 /// Update progress bar and status labels.
639 /// Use "processed == total" or "processed < 0" to indicate end of processing.
640 
642  Long64_t bytesread,
643  Float_t initTime, Float_t procTime,
644  Float_t evtrti, Float_t mbrti,
645  Int_t actw, Int_t tses, Float_t eses)
646 {
647  Double_t BinLow, BinHigh;
648  Int_t nbins;
649  Long_t tt;
650  UInt_t hh=0, mm=0, ss=0;
651  TString buf;
652  TString stm;
653  static const char *cproc[] = { "running", "done",
654  "STOPPED", "ABORTED", "***EVENTS SKIPPED***"};
655 
656  // Update title
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);
661 
662  if (gDebug > 1)
663  Info("Progress","t: %lld, p: %lld, itm: %f, ptm: %f", total, processed, initTime, procTime);
664 
665  if (initTime >= 0.) {
666  // Set init time
667  fInitTime = initTime;
668  buf.Form("%.1f secs", initTime);
669  fInit->SetText(buf);
670  if (fSpeedoEnabled && fRightInfo == 0)
671  fSpeedo->SetOdoValue((Int_t)(fInitTime * 1000.0));
672  }
673 
674  Bool_t over = kFALSE;
675  if (total < 0) {
676  total = fPrevTotal;
677  over = kTRUE;
678  } else {
679  fPrevTotal = total;
680  }
681 
682  // Show proc time by default when switching from init to proc
683  if (processed > 0 && fPrevProcessed <= 0)
684  while (fRightInfo != 1)
686 
687  // Nothing to update
688  if (fPrevProcessed == processed)
689  return;
690 
691  // Number of processed events
692  Long64_t evproc = (processed >= 0) ? processed : fPrevProcessed;
693  Float_t mbsproc = bytesread / TMath::Power(2.,20.);
694 
695  if (fEntries != total) {
696  fEntries = total;
697  buf.Form("%d files, number of events %lld, starting event %lld",
699  fFilesEvents->SetText(buf);
700  }
701 
702  // Update position
703  Float_t pos = Float_t(Double_t(evproc * 100)/Double_t(total));
704  fBar->SetPosition(pos);
705 
706  Float_t eta = 0;
707  if (evproc > 0 && procTime > 0.)
708  eta = (Float_t) (total - evproc) / (Double_t)evproc * procTime;
709 
710  // Update average rates
711  if (procTime > 0.) {
712  fProcTime = procTime;
713  fAvgRate = Float_t(evproc) / procTime;
714  fAvgMBRate = mbsproc / procTime;
715  }
716 
717  if (fSpeedoEnabled) {
718  if (fRightInfo == 0)
719  fSpeedo->SetOdoValue((Int_t)(fInitTime * 1000.0));
720  else if (fRightInfo == 1)
721  fSpeedo->SetOdoValue((Int_t)(fProcTime * 1000.0));
722  }
723 
724  if (over || (processed >= 0 && processed >= total)) {
725 
726  // A negative value for process indicates that we are finished,
727  // no matter whether the processing was complete
728  Bool_t incomplete = (processed < 0 &&
729  (fPrevProcessed < total || fPrevProcessed == 0))
730  ? kTRUE : kFALSE;
731  TString st = "";
732  if (incomplete) {
734  // We use a different color to highlight incompletion
735  fBar->SetBarColor("magenta");
736  st = TString::Format(" %s", cproc[fStatus]);
737  }
738 
739  tt = (Long_t)fProcTime;
740  if (tt > 0) {
741  hh = (UInt_t)(tt / 3600);
742  mm = (UInt_t)((tt % 3600) / 60);
743  ss = (UInt_t)((tt % 3600) % 60);
744  }
745  if (hh)
746  stm.Form("%d h %d min %d sec", hh, mm, ss);
747  else if (mm)
748  stm.Form("%d min %d sec", mm, ss);
749  else
750  stm.Form("%d sec", ss);
751  fProcessed->SetText("Processed:");
752  TString sf("MB");
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);
762  fRate->SetText(buf);
763  // Fill rate graph
764  Bool_t useAvg = gEnv->GetValue("Proof.RatePlotUseAvg", 0);
765  if (useAvg) {
766  if (fAvgRate > 0.) {
767  fRatePoints->Fill(procTime, fAvgRate, fAvgMBRate);
769  }
770  } else {
771  if (evtrti > 0.) {
772  fRatePoints->Fill(procTime, evtrti, mbrti, (Float_t)actw, (Float_t)tses, eses);
774  }
775  }
776 
777  if (fProof) {
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)",
781  this,
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)",
784  this,
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()");
788  }
789 
790  // Set button state
795 
797  fSpeedo->SetScaleValue(0.0, 0);
798  else
799  fSpeedo->SetScaleValue(0.0);
801 
802  if (!fKeep) DoClose();
803 
804  // Set the status to done
805  fStatus = kDone;
806 
807  } else {
808  // A negative value for process indicates that we are finished,
809  // no matter whether the processing was complete
810  Bool_t incomplete = (processed < 0 &&
811  (fPrevProcessed < total || fPrevProcessed == 0))
812  ? kTRUE : kFALSE;
813  if (incomplete) {
815  // We use a different color to highlight incompletion
816  fBar->SetBarColor("magenta");
817  }
818  tt = (Long_t)eta;
819  if (tt > 0) {
820  hh = (UInt_t)(tt / 3600);
821  mm = (UInt_t)((tt % 3600) / 60);
822  ss = (UInt_t)((tt % 3600) % 60);
823  }
824  if (hh)
825  stm.Form("%d h %d min %d sec", hh, mm, ss);
826  else if (mm)
827  stm.Form("%d min %d sec", mm, ss);
828  else
829  stm.Form("%d sec", ss);
830 
831  fEstim->SetText(stm.Data());
832  TString sf("MB");
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]);
837  }
838  fTotal->SetText(buf);
839 
840  // Post
841  if (evtrti > 0.) {
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);
846  if (fSpeedoEnabled) {
847  if (evtrti > fSpeedo->GetScaleMax()) {
848  nbins = 4;
849  BinLow = fSpeedo->GetScaleMin();
850  BinHigh = 1.5 * evtrti;
851  THLimitsFinder::OptimizeLimits(4, nbins, BinLow, BinHigh, kFALSE);
853  }
855  fSpeedo->SetScaleValue(evtrti, 0);
856  else
857  fSpeedo->SetScaleValue(evtrti);
859  }
860  } else {
861  buf.Form("avg: %.1f evts/sec (%.1f MB/sec)", fAvgRate, fAvgMBRate);
862  }
863  fRate->SetText(buf);
864 
865  if (processed < 0) {
866  // And we disable the buttons
871 
872  if (fSpeedoEnabled) {
874  fSpeedo->SetScaleValue(0.0, 0);
875  else
876  fSpeedo->SetScaleValue(0.0);
878  }
879 
880  // Set the status to done
881  fStatus = kDone;
882  }
883  }
884  fPrevProcessed = evproc;
885 }
886 
887 ////////////////////////////////////////////////////////////////////////////////
888 /// Transform MBs to GBs ot TBs and get the correct suffix
889 
891 {
892  Float_t xb = mbs;
893  sf = "MB";
894  if (xb > 1024.) {
895  xb = xb / 1024.;
896  sf = "GB";
897  }
898  if (xb > 1024.) {
899  xb = xb / 1024.;
900  sf = "TB";
901  }
902  // Done
903  return xb;
904 }
905 
906 ////////////////////////////////////////////////////////////////////////////////
907 /// Cleanup dialog.
908 
910 {
911  if (fProof) {
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)",
915  this,
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)",
918  this,
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)",
923  this,
924  "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)");
925  fProof->Disconnect("CloseProgressDialog()", this, "CloseProgressDialog()");
927  // We are called after a TProofDetach: we delete the instance
928  if (!fProof->IsValid())
930  }
931  if (fLogWindow)
932  delete fLogWindow;
933  if (fMemWindow)
934  delete fMemWindow;
935  fDialog->Cleanup();
936  delete fDialog;
937 }
938 
939 ////////////////////////////////////////////////////////////////////////////////
940 /// Called when dialog is closed.
941 
943 {
944  delete this;
945 }
946 
947 ////////////////////////////////////////////////////////////////////////////////
948 /// Disable the asyn switch when an external request for going asynchronous is issued
949 
951 {
952  fProof->Disconnect("DisableGoAsyn()", this, "DisableAsyn()");
954 }
955 
956 ////////////////////////////////////////////////////////////////////////////////
957 /// Indicate that Cancel or Stop was clicked.
958 
960 {
961  if (aborted == kTRUE)
962  fBar->SetBarColor("red");
963  else
964  fBar->SetBarColor("yellow");
965 
966  if (fProof) {
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)",
970  this,
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)",
973  this,
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()");
977  // These buttons are meaningless at this point
981  }
982 
984  if (!fKeep)
985  DoClose();
986 }
987 
988 ////////////////////////////////////////////////////////////////////////////////
989 /// Load/append a log msg in the log frame, if open
990 
992 {
993  if (fLogWindow) {
994  if (all) {
995  // load buffer
996  fLogWindow->LoadBuffer(msg);
997  } else {
998  // append
999  fLogWindow->AddBuffer(msg);
1000  }
1001  }
1002 }
1003 
1004 ////////////////////////////////////////////////////////////////////////////////
1005 /// Close dialog.
1006 
1008 {
1010  TTimer::SingleShot(50, "TProofProgressDialog", this, "CloseWindow()");
1011 }
1012 
1013 ////////////////////////////////////////////////////////////////////////////////
1014 /// Ask proof session for logs
1015 
1017 {
1018  if (fProof) {
1019  if (!fLogWindow) {
1020  fLogWindow = new TProofProgressLog(this);
1022  fLogWindow->DoLog();
1023  } else {
1024  // Clear window
1026  fLogWindow->Clear();
1027  fLogWindow->DoLog();
1028  }
1029  }
1030  }
1031 }
1032 
1033 ////////////////////////////////////////////////////////////////////////////////
1034 /// Handle keep toggle button.
1035 
1037 {
1038  fKeep = !fKeep;
1039 
1040  // Last choice will be the default for the future
1041  fgKeepDefault = fKeep;
1042 }
1043 
1044 ////////////////////////////////////////////////////////////////////////////////
1045 /// Handle log-current-query-only toggle button.
1046 
1048 {
1049  fLogQuery = !fLogQuery;
1051  if (fLogQuery)
1052  fEntry->SetToolTipText("Enter the query number ('last' for the last query)",50);
1053  else
1054  fEntry->SetToolTipText(0);
1055 
1056  // Last choice will be the default for the future
1058 }
1059 
1060 ////////////////////////////////////////////////////////////////////////////////
1061 /// Handle Stop button.
1062 
1064 {
1065  // Do not wait for ever, but al least 10 seconds
1066  Long_t timeout = gEnv->GetValue("Proof.ShutdownTimeout", 60) / 2;
1067  timeout = (timeout > 10) ? timeout : 10;
1068  fProof->StopProcess(kFALSE, timeout);
1069  fStatus = kStopped;
1070 
1071  // Set buttons states
1076 }
1077 
1078 ////////////////////////////////////////////////////////////////////////////////
1079 /// Handle Cancel button.
1080 
1082 {
1084  fStatus = kAborted;
1085 
1086  // Set buttons states
1091 }
1092 
1093 ////////////////////////////////////////////////////////////////////////////////
1094 /// Handle Asyn button.
1095 
1097 {
1099 
1100  // Set buttons states
1102 }
1103 
1104 ////////////////////////////////////////////////////////////////////////////////
1105 /// Handle Plot Rate Graph.
1106 
1108 {
1109  // We must have some point to plot
1110  if (!fRatePoints || fRatePoints->GetEntries() <= 0) {
1111  Info("DoPlotRateGraph","list is empty!");
1112  return;
1113  }
1114 
1115  // Fill the graphs
1117  Double_t eymx = -1., bymx = -1., wymx = -1., tymx=-1., symx = -1.;
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);
1129  }
1130  Float_t *nar = fRatePoints->GetArgs();
1131  Int_t ii = 0;
1132  for ( ; ii < np; ++ii) {
1133  fRatePoints->GetEntry(ii);
1134  if (!(nar[1] > 0.)) continue;
1135  // Evts/s
1136  fRateGraph->SetPoint(ii, (Double_t) nar[0], (Double_t) nar[1]);
1137  eymx = (nar[1] > eymx) ? nar[1] : eymx;
1138  // MBs/s
1139  fMBRtGraph->SetPoint(ii, (Double_t) nar[0], (Double_t) nar[2]);
1140  bymx = (nar[2] > bymx) ? nar[2] : bymx;
1141  // Active workers
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;
1145  }
1146  // Sessions info
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;
1152  }
1153  }
1154 
1155  // Pad numbering
1156  Int_t npads = 4;
1157  Int_t kEvrt = 1;
1158  Int_t kMBrt = 2;
1159  Int_t kActW = 3;
1160  Int_t kSess = 4;
1161  if (bymx <= 0.) {
1163  npads--;
1164  kActW--;
1165  kSess--;
1166  }
1167  if (wymx <= 0.) {
1169  npads--;
1170  kSess--;
1171  }
1172  // Plot only if more than one active session during the query
1173  if (tymx <= 1.) {
1176  npads--;
1177  kSess--;
1178  }
1179  if (tymx <= 0.) SafeDelete(fTotSGraph);
1180  if (symx <= 0.) SafeDelete(fEffSGraph);
1181 
1182  // Create a canvas
1183  Int_t jsz = 200*npads;
1184  TCanvas *c1 = new TCanvas("c1","Rate vs Time",200,10,700,jsz);
1185  c1->SetFillColor(0);
1186  c1->SetGrid();
1187  c1->SetBorderMode(0);
1188  c1->SetFrameBorderMode(0);
1189 
1190  // Padding
1191  c1->Divide(1, npads);
1192 
1193  // Event Rate plot
1194  TPad *cpad = (TPad *) c1->GetPad(kEvrt);
1195  if (cpad) {
1196  cpad->cd();
1197  cpad->SetFillColor(0);
1198  cpad->SetBorderMode(20);
1199  cpad->SetFrameBorderMode(0);
1200  }
1201  fRateGraph->SetMinimum(0.);
1202  fRateGraph->SetMaximum(eymx*1.1);
1203  fRateGraph->SetLineColor(50);
1207  fRateGraph->SetMarkerSize(0.8);
1208  fRateGraph->SetTitle("Processing rate (evts/sec)");
1209  fRateGraph->GetXaxis()->SetTitle("elapsed time (sec)");
1210  fRateGraph->Draw("ALP");
1211 
1212  // Line with average
1215  line->SetLineColor(8);
1216  line->SetLineStyle(2);
1217  line->SetLineWidth(2);
1218  line->Draw();
1219 
1220  // Label
1221  Double_t xax0 = fRateGraph->GetXaxis()->GetXmin();
1222  Double_t xax1 = fRateGraph->GetXaxis()->GetXmax();
1223  Double_t yax0 = 0.;
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));
1232  pt->Draw();
1233 
1234  // MB Rate plot
1235  if (fMBRtGraph) {
1236  cpad = (TPad *) c1->GetPad(kMBrt);
1237  if (cpad) {
1238  cpad->cd();
1239  cpad->SetFillColor(0);
1240  cpad->SetBorderMode(0);
1241  cpad->SetFrameBorderMode(0);
1242  }
1243  fMBRtGraph->SetFillColor(38);
1244  TH1F *graph2 = new TH1F("graph2","Average read chunck size (MBs/request)",100,
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");
1253  }
1254 
1255  // MB Rate plot
1256  if (fActWGraph) {
1257  cpad = (TPad *) c1->GetPad(kActW);
1258  if (cpad) {
1259  cpad->cd();
1260  cpad->SetFillColor(0);
1261  cpad->SetBorderMode(0);
1262  cpad->SetFrameBorderMode(0);
1263  }
1264  fActWGraph->SetMinimum(0.);
1265  fActWGraph->SetMaximum(wymx*1.1);
1266  fActWGraph->SetLineColor(50);
1270  fActWGraph->SetMarkerSize(0.8);
1271  fActWGraph->SetTitle("Active workers");
1272  fActWGraph->GetXaxis()->SetTitle("elapsed time (sec)");
1273  fActWGraph->Draw("ALP");
1274  }
1275 
1276  // MB Rate plot
1277  if (fTotSGraph) {
1278  cpad = (TPad *) c1->GetPad(kSess);
1279  if (cpad) {
1280  cpad->cd();
1281  cpad->SetFillColor(0);
1282  cpad->SetBorderMode(0);
1283  cpad->SetFrameBorderMode(0);
1284  }
1285  fTotSGraph->SetMinimum(0.);
1286  fTotSGraph->SetMaximum(tymx*1.1);
1287  fTotSGraph->SetLineColor(50);
1291  fTotSGraph->SetMarkerSize(0.8);
1292  fTotSGraph->SetTitle("Active, Effective sessions");
1293  fTotSGraph->GetXaxis()->SetTitle("elapsed time (sec)");
1294  fTotSGraph->Draw("ALP");
1295 
1296  // Effective sessions
1297  if (fEffSGraph) {
1298  fEffSGraph->SetMinimum(0.);
1299  fEffSGraph->SetMaximum(tymx*1.1);
1300  fEffSGraph->SetLineColor(38);
1304  fEffSGraph->SetMarkerSize(0.6);
1305  fEffSGraph->Draw("SLP");
1306  }
1307  }
1308 
1309  c1->Modified();
1310 }
1311 
1312 ////////////////////////////////////////////////////////////////////////////////
1313 /// Do a memory plot
1314 
1316 {
1317  if (!fMemWindow) {
1318  fMemWindow = new TProofProgressMemoryPlot(this, 500, 300);
1319  fMemWindow->DoPlot();
1320  } else {
1321  // Clear window
1322  fMemWindow->Clear();
1323  fMemWindow->DoPlot();
1324  }
1325 }
1326 
1327 ////////////////////////////////////////////////////////////////////////////////
1328 /// Enable/Disable speedometer
1329 
1331 {
1332  if (!fSpeedoEnabled) {
1333  // Enable and connect
1335  fSpeedo->Connect("OdoClicked()", "TProofProgressDialog", this, "ToggleOdometerInfos()");
1336  fSpeedo->Connect("LedClicked()", "TProofProgressDialog", this, "ToggleThreshold()");
1337  fUpdtSpeedo->ChangeText("&Disable speedometer");
1338  fUpdtSpeedo->SetToolTipText("Disable speedometer");
1340  fSmoothSpeedo->SetToolTipText("Control smoothness in refreshing the speedo");
1341  } else {
1342  // Disable and disconnect
1344  // Reset speedo
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");
1350  }
1351 }
void ChangeText(const char *title)
Definition: TGButton.h:221
void DoSetLogQuery(Bool_t on)
Handle log-current-query-only toggle button.
virtual void SetLineWidth(Width_t lwidth)
Definition: TAttLine.h:57
void DisableAsyn()
Disable the asyn switch when an external request for going asynchronous is issued.
TServerSocket * ss
Definition: hserv2.C:30
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
Definition: TPaveText.cxx:211
long long Long64_t
Definition: RtypesCore.h:69
virtual void SetMaximum(Double_t maximum=-1111)
Definition: TH1.h:394
void ResetProgressDialog(const char *sel, Int_t sz, Long64_t fst, Long64_t ent)
Reset dialog box preparing for new query.
Bool_t IsValid() const
Definition: TProof.h:973
void DoLog()
Ask proof session for logs.
TLine * line
float Float_t
Definition: RtypesCore.h:53
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Definition: TH1.cxx:8266
Int_t GetRemoteProtocol() const
Definition: TProof.h:949
void CloseWindow()
Called when dialog is closed.
void DoKeep(Bool_t on)
Handle keep toggle button.
TCanvas * c1
Definition: legend1.C:2
void DoMemoryPlot()
Do a memory plot.
void SetFrameBorderMode(Int_t mode=1)
Definition: TAttPad.h:89
void SetDisplayText(const char *text1, const char *text2="")
Set small display text (two lines).
Definition: TGSpeedo.cxx:320
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetMinimum(Double_t minimum=-1111)
Set the minimum of the graph.
Definition: TGraph.cxx:2118
virtual void SetBorderMode(Short_t bordermode)
Definition: TPad.h:316
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
Definition: TPaveText.cxx:160
Bool_t IsThresholdActive()
Definition: TGSpeedo.h:93
virtual void SetMinimum(Double_t minimum=-1111)
Definition: TH1.h:395
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
Definition: TTree.cxx:5144
Basic string class.
Definition: TString.h:137
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:570
#define gClient
Definition: TGClient.h:174
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
Definition: TTimer.cxx:254
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:254
virtual void SetTitle(const char *title="")
Set graph title.
Definition: TGraph.cxx:2153
int nbins[3]
Basic time type with millisecond precision.
Definition: TTime.h:29
Bool_t IsSync() const
Definition: TProof.h:707
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
Definition: TGraph.cxx:740
static void OptimizeLimits(Int_t nbins, Int_t &newbins, Double_t &xmin, Double_t &xmax, Bool_t isInteger)
Optimize axis limits.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:501
virtual void SetBarColor(Pixel_t color)
Set progress bar color.
const char * Data() const
Definition: TString.h:349
void SetMinMaxScale(Float_t min, Float_t max)
Set min and max scale values.
Definition: TGSpeedo.cxx:350
#define SafeDelete(p)
Definition: RConfig.h:436
virtual ~TProofProgressDialog()
Cleanup dialog.
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:514
void StopProcess(Bool_t abort, Int_t timeout=-1)
Send STOPPROCESS message to master and workers.
Definition: TProof.cxx:6222
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2321
TProofProgressLog * fLogWindow
TText * tt
Definition: textangle.C:16
virtual void SetText(TGString *newText)
Set new text in label.
Definition: TGLabel.cxx:177
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
Definition: TPad.h:326
virtual void SetMaximum(Double_t maximum=-1111)
Set the maximum of the graph.
Definition: TGraph.cxx:2109
const char * GetMaster() const
Definition: TProof.h:939
void DoLog(Bool_t grep=kFALSE)
Display logs.
virtual void SetMarkerColor(Color_t mcolor=1)
Definition: TAttMarker.h:51
Float_t * GetArgs() const
Definition: TNtuple.h:58
void Info(const char *location, const char *msgfmt,...)
tuple np
Definition: multifit.py:30
TGCheckButton * fSmoothSpeedo
void Progress(Long64_t total, Long64_t processed)
Update progress bar and status labels.
void DoEnableSpeedo()
Enable/Disable speedometer.
void Clear(Option_t *=0)
Clear log window.
void SetOdoValue(Int_t val)
Set actual value of odo meter.
Definition: TGSpeedo.cxx:307
void DisableThreshold()
Definition: TGSpeedo.h:109
Double_t GetXmin() const
Definition: TAxis.h:137
void Error(const char *location, const char *msgfmt,...)
virtual void SetLineColor(Color_t lcolor)
Definition: TAttLine.h:54
void ResetPeakVal()
Definition: TGSpeedo.h:114
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1135
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition: TSystem.cxx:467
TPaveText * pt
void SetScaleValue(Float_t val)
Set actual scale (needle position) value.
Definition: TGSpeedo.cxx:366
TAxis * GetXaxis() const
Get x axis of the graph.
Definition: TGraph.cxx:1563
A simple TTree restricted to a list of float variables only.
Definition: TNtuple.h:30
R__EXTERN TSystem * gSystem
Definition: TSystem.h:545
virtual EButtonState GetState() const
Definition: TGButton.h:116
tuple main
Definition: hsum.py:20
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
void Glow(EGlowColor col=kGreen)
Make speedo glowing.
Definition: TGSpeedo.cxx:231
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Definition: TEnv.cxx:494
friend class TProofProgressMemoryPlot
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2308
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
The most important graphics class in the ROOT system.
Definition: TPad.h:46
char * Form(const char *fmt,...)
A simple line.
Definition: TLine.h:41
Float_t GetScaleMin() const
Definition: TGSpeedo.h:91
bool first
Definition: line3Dfit.C:48
virtual void SetMarkerStyle(Style_t mstyle=1)
Definition: TAttMarker.h:53
virtual void SetMarkerSize(Size_t msize=1)
Definition: TAttMarker.h:54
void DoPlotRateGraph()
Handle Plot Rate Graph.
void LoadBuffer(const char *buffer)
Load a text buffer in the window.
#define gVirtualX
Definition: TVirtualX.h:362
TH1F * total
Definition: threadsh2.C:15
void GoAsynchronous()
Send GOASYNC message to the master.
Definition: TProof.cxx:6265
long Long_t
Definition: RtypesCore.h:50
The Canvas class.
Definition: TCanvas.h:48
void LogMessage(const char *msg, Bool_t all)
Load/append a log msg in the log frame, if open.
void SetEnabled(Bool_t flag=kTRUE)
Definition: TGTextEntry.h:170
static const double x1[5]
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:35
void DoPlot()
Draw the plot from the logs.
double Double_t
Definition: RtypesCore.h:55
void SetPosition(Float_t pos)
Set progress position between [min,max].
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
This class controls a Parallel ROOT Facility, PROOF, cluster.
Definition: TProof.h:342
Double_t GetXmax() const
Definition: TAxis.h:138
virtual Int_t Fill()
[fNvar] Array of variables
Definition: TNtuple.cxx:168
void DoClose()
Close dialog.
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1293
Float_t AdjustBytes(Float_t mbs, TString &sf)
Transform MBs to GBs ot TBs and get the correct suffix.
void EnableThreshold()
Definition: TGSpeedo.h:108
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
void SetMeanValue(Float_t mean)
Definition: TGSpeedo.h:115
virtual void SetLineStyle(Style_t lstyle)
Definition: TAttLine.h:56
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Definition: vector.h:440
void DoStop()
Handle Stop button.
#define PPD_SRV_NEWER(v)
virtual void Reset()
Reset progress bar (i.e. set pos to 0).
const char Int_t const char TProof * proof
Definition: TXSlave.cxx:46
virtual TVirtualPad * GetPad(Int_t subpadnumber) const
Get a pointer to subpadnumber of this pad.
Definition: TPad.cxx:2770
void ResetProgressDialogStatus()
Definition: TProof.h:1057
Handle_t Window_t
Definition: GuiTypes.h:30
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition: TGraph.cxx:2127
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
Definition: TPad.cxx:1073
TProofProgressMemoryPlot * fMemWindow
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:202
TGTransientFrame * fDialog
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:53
void AddBuffer(const char *buffer)
Add text to the window.
R__EXTERN Int_t gDebug
Definition: Rtypes.h:128
virtual void Reset(Option_t *option="")
Reset baskets, buffers and entries count in all branches and leaves.
Definition: TTree.cxx:7194
virtual void SetHistogram(TH1F *h)
Definition: TGraph.h:177
virtual Long64_t GetEntries() const
Definition: TTree.h:386
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
ClassImp(TProofProgressDialog) TProofProgressDialog
Create PROOF processing progress dialog.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
Handle_t GetId() const
Definition: TGObject.h:52
tuple all
Definition: na49view.py:13
Int_t GetParallel() const
Returns number of slaves active in parallel mode.
Definition: TProof.cxx:2311
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition: TH1.cxx:8320
Float_t GetScaleMax() const
Definition: TGSpeedo.h:92
void Modified(Bool_t flag=1)
Definition: TPad.h:407
void ToggleOdometerInfos()
Toggle information displayed in Analog Meter.
void DoAsyn()
Handle Asyn button.
TAxis * GetXaxis()
Definition: TH1.h:319
void DoAbort()
Handle Cancel button.
void Clear(Option_t *=0)
Clear the canvases.
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185
void IndicateStop(Bool_t aborted)
Indicate that Cancel or Stop was clicked.
T1 fFirst
Definition: X11Events.mm:85
int ii
Definition: hprod.C:34