ROOT  6.06/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 #include "TProofProgressStatus.h"
13 #include "TObject.h"
14 #include "TString.h"
15 #include "TSystem.h"
16 #include "TTime.h"
17 
18 //////////////////////////////////////////////////////////////////////////
19 // //
20 // TProofProgressStatus //
21 // //
22 // Small class including processing statistics //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
27 
28 ////////////////////////////////////////////////////////////////////////////////
29 /// Main and default constructor
30 
32  Long64_t bytesRead,
33  Long64_t readCalls,
34  Double_t procTime,
36 {
37  fLastEntries = 0;
38  fEntries = entries;
39  fBytesRead = bytesRead;
40  fReadCalls = readCalls;
41  fLearnTime = 0.;
42  fLastProcTime = 0;
43  fProcTime = procTime;
44  fCPUTime = cpuTime;
45  SetLastUpdate();
46 }
47 
48 ////////////////////////////////////////////////////////////////////////////////
49 /// '+=' operator
50 
52 {
53  fLastEntries += st.fEntries;
54  fEntries += st.fEntries;
55  fBytesRead += st.fBytesRead;
56  fReadCalls += st.fReadCalls;
57  if (st.fLearnTime > fLearnTime)
60  fProcTime += st.fProcTime;
61  fCPUTime += st.fCPUTime;
62  SetLastUpdate();
63  return *this;
64 }
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 /// '-=' operator
68 
70 {
71  fEntries -= st.fEntries;
72  fBytesRead -= st.fBytesRead;
73  fReadCalls -= st.fReadCalls;
74  if (st.fLearnTime < fLearnTime)
76  fProcTime -= st.fProcTime;
77  fCPUTime -= st.fCPUTime;
78  SetLastUpdate();
79  return *this;
80 }
81 
82 ////////////////////////////////////////////////////////////////////////////////
83 /// '-' operator
84 
86 {
87  return TProofProgressStatus(*this) -= st;
88 }
89 
90 ////////////////////////////////////////////////////////////////////////////////
91 /// Dump the content
92 
94 {
95  Printf("TProofProgressStatus:%s: Ents:(%lld,%lld), Bytes:%lld, Calls:%lld,"
96  " Learn:%.3g s, Proc:(%.3g,%.3g) s, CPU:%.3g s",
99 }
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 /// Update time stamp either with the passed value (if > 0) or with
103 /// the current time
104 
106 {
107  if (updtTime > 0) {
108  fLastUpdate = updtTime;
109  } else {
110  TTime tnow = gSystem->Now();
111  fLastUpdate = (Double_t) (Long64_t(tnow)) / (Double_t)1000.;
112  }
113 }
114 
115 ////////////////////////////////////////////////////////////////////////////////
116 /// Get current rate. Rteunr the average rate if the current is not defined
117 
119 {
120  if (fLastProcTime > 0) {
121  return fLastEntries / fLastProcTime;
122  }
123  return GetRate();
124 }
Double_t GetCurrentRate() const
Get current rate. Rteunr the average rate if the current is not defined.
void Print(Option_t *option="") const
Dump the content.
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:29
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition: TSystem.cxx:467
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
TProofProgressStatus(Long64_t fEntries=0, Long64_t fBytesRead=0, Long64_t fReadCalls=0, Double_t fProcTime=0, Double_t fCPUTime=0)
#define Printf
Definition: TGeoToOCC.h:18
double Double_t
Definition: RtypesCore.h:55
ClassImp(TProofProgressStatus) TProofProgressStatus
Main and default constructor.
Mother of all ROOT objects.
Definition: TObject.h:58
double cpuTime()
Definition: testKalman.cxx:44
TProofProgressStatus operator-(TProofProgressStatus &st)
'-' operator
TProofProgressStatus & operator+=(const TProofProgressStatus &st)
'+=' operator
Double_t GetRate() const
TProofProgressStatus & operator-=(const TProofProgressStatus &st)
'-=' operator