Logo ROOT   6.10/09
Reference Guide
TProofProgressStatus.cxx
Go to the documentation of this file.
1 // @(#)root/proof:$Id$
2 // Author: Jan Iwaszkiewicz 08/08/08
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2008, 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 /** \class TProofProgressStatus
13 \ingroup proofkernel
14 
15 Container class for processing statistics
16 
17 */
18 
19 #include "TProofProgressStatus.h"
20 #include "TObject.h"
21 #include "TString.h"
22 #include "TSystem.h"
23 #include "TTime.h"
24 
26 
27 ////////////////////////////////////////////////////////////////////////////////
28 /// Main and default constructor
29 
31  Long64_t bytesRead,
32  Long64_t readCalls,
33  Double_t procTime,
34  Double_t cpuTime): TObject()
35 {
36  fLastEntries = 0;
37  fEntries = entries;
38  fBytesRead = bytesRead;
39  fReadCalls = readCalls;
40  fLearnTime = 0.;
41  fLastProcTime = 0;
42  fProcTime = procTime;
43  fCPUTime = cpuTime;
44  SetLastUpdate();
45 }
46 
47 ////////////////////////////////////////////////////////////////////////////////
48 /// '+=' operator
49 
51 {
52  fLastEntries += st.fEntries;
53  fEntries += st.fEntries;
54  fBytesRead += st.fBytesRead;
55  fReadCalls += st.fReadCalls;
56  if (st.fLearnTime > fLearnTime)
59  fProcTime += st.fProcTime;
60  fCPUTime += st.fCPUTime;
61  SetLastUpdate();
62  return *this;
63 }
64 
65 ////////////////////////////////////////////////////////////////////////////////
66 /// '-=' operator
67 
69 {
70  fEntries -= st.fEntries;
71  fBytesRead -= st.fBytesRead;
72  fReadCalls -= st.fReadCalls;
73  if (st.fLearnTime < fLearnTime)
75  fProcTime -= st.fProcTime;
76  fCPUTime -= st.fCPUTime;
77  SetLastUpdate();
78  return *this;
79 }
80 
81 ////////////////////////////////////////////////////////////////////////////////
82 /// '-' operator
83 
85 {
86  return TProofProgressStatus(*this) -= st;
87 }
88 
89 ////////////////////////////////////////////////////////////////////////////////
90 /// Dump the content
91 
93 {
94  Printf("TProofProgressStatus:%s: Ents:(%lld,%lld), Bytes:%lld, Calls:%lld,"
95  " Learn:%.3g s, Proc:(%.3g,%.3g) s, CPU:%.3g s",
98 }
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 /// Update time stamp either with the passed value (if > 0) or with
102 /// the current time
103 
105 {
106  if (updtTime > 0) {
107  fLastUpdate = updtTime;
108  } else {
109  TTime tnow = gSystem->Now();
110  fLastUpdate = (Double_t) (Long64_t(tnow)) / (Double_t)1000.;
111  }
112 }
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 /// Get current rate. Rteunr the average rate if the current is not defined
116 
118 {
119  if (fLastProcTime > 0) {
120  return fLastEntries / fLastProcTime;
121  }
122  return GetRate();
123 }
long long Long64_t
Definition: RtypesCore.h:69
const char Option_t
Definition: RtypesCore.h:62
void SetLastUpdate(Double_t updtTime=0)
Update time stamp either with the passed value (if > 0) or with the current time. ...
Basic time type with millisecond precision.
Definition: TTime.h:27
void Print(Option_t *option="") const
Dump the content.
Double_t GetRate() const
Double_t GetCurrentRate() const
Get current rate. Rteunr the average rate if the current is not defined.
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition: TSystem.cxx:470
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
TProofProgressStatus(Long64_t fEntries=0, Long64_t fBytesRead=0, Long64_t fReadCalls=0, Double_t fProcTime=0, Double_t fCPUTime=0)
Main and default constructor.
#define Printf
Definition: TGeoToOCC.h:18
#define ClassImp(name)
Definition: Rtypes.h:336
double Double_t
Definition: RtypesCore.h:55
Mother of all ROOT objects.
Definition: TObject.h:37
TProofProgressStatus operator-(TProofProgressStatus &st)
&#39;-&#39; operator
TProofProgressStatus & operator+=(const TProofProgressStatus &st)
&#39;+=&#39; operator
Container class for processing statistics.
TProofProgressStatus & operator-=(const TProofProgressStatus &st)
&#39;-=&#39; operator