00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TProofProgressStatus.h"
00013 #include "TObject.h"
00014 #include "TString.h"
00015 #include "TSystem.h"
00016 #include "TTime.h"
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 ClassImp(TProofProgressStatus)
00027
00028
00029 TProofProgressStatus::TProofProgressStatus(Long64_t entries,
00030 Long64_t bytesRead,
00031 Long64_t readCalls,
00032 Double_t procTime,
00033 Double_t cpuTime): TObject()
00034 {
00035
00036
00037 fLastEntries = 0;
00038 fEntries = entries;
00039 fBytesRead = bytesRead;
00040 fReadCalls = readCalls;
00041 fLearnTime = 0.;
00042 fLastProcTime = 0;
00043 fProcTime = procTime;
00044 fCPUTime = cpuTime;
00045 SetLastUpdate();
00046 }
00047
00048
00049 TProofProgressStatus& TProofProgressStatus::operator+=(const TProofProgressStatus &st)
00050 {
00051
00052
00053 fLastEntries += st.fEntries;
00054 fEntries += st.fEntries;
00055 fBytesRead += st.fBytesRead;
00056 fReadCalls += st.fReadCalls;
00057 if (st.fLearnTime > fLearnTime)
00058 fLearnTime = st.fLearnTime;
00059 fLastProcTime = st.fProcTime;
00060 fProcTime += st.fProcTime;
00061 fCPUTime += st.fCPUTime;
00062 SetLastUpdate();
00063 return *this;
00064 }
00065
00066
00067 TProofProgressStatus& TProofProgressStatus::operator-=(const TProofProgressStatus &st)
00068 {
00069
00070
00071 fEntries -= st.fEntries;
00072 fBytesRead -= st.fBytesRead;
00073 fReadCalls -= st.fReadCalls;
00074 if (st.fLearnTime < fLearnTime)
00075 fLearnTime = st.fLearnTime;
00076 fProcTime -= st.fProcTime;
00077 fCPUTime -= st.fCPUTime;
00078 SetLastUpdate();
00079 return *this;
00080 }
00081
00082
00083 TProofProgressStatus TProofProgressStatus::operator-(TProofProgressStatus &st)
00084 {
00085
00086
00087 return TProofProgressStatus(*this) -= st;
00088 }
00089
00090
00091 void TProofProgressStatus::Print(Option_t*option) const
00092 {
00093
00094
00095 Printf("TProofProgressStatus:%s: Ents:(%lld,%lld), Bytes:%lld, Calls:%lld,"
00096 " Learn:%.3g s, Proc:(%.3g,%.3g) s, CPU:%.3g s",
00097 option, fEntries, fLastEntries, fBytesRead, fReadCalls,
00098 fLearnTime, fProcTime, fLastProcTime, fCPUTime);
00099 }
00100
00101
00102 void TProofProgressStatus::SetLastUpdate(Double_t updtTime)
00103 {
00104
00105
00106
00107 if (updtTime > 0) {
00108 fLastUpdate = updtTime;
00109 } else {
00110 TTime tnow = gSystem->Now();
00111 fLastUpdate = (Double_t) (Long64_t(tnow)) / (Double_t)1000.;
00112 }
00113 }
00114
00115
00116 Double_t TProofProgressStatus::GetCurrentRate() const
00117 {
00118
00119
00120 if (fLastProcTime > 0) {
00121 return fLastEntries / fLastProcTime;
00122 }
00123 return GetRate();
00124 }