TProofProgressStatus.cxx

Go to the documentation of this file.
00001 // @(#)root/proof:$Id: TProofProgressStatus.cxx 34557 2010-07-22 15:12:01Z rdm $
00002 // Author: Jan Iwaszkiewicz    08/08/08
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
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 // TProofProgressStatus                                                 //
00021 //                                                                      //
00022 // Small class including processing statistics                          //
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    // Main and default constructor
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    // '+=' operator
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    // '-=' operator
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    // '-' operator
00086 
00087    return TProofProgressStatus(*this) -= st;
00088 }
00089 
00090 //______________________________________________________________________________
00091 void TProofProgressStatus::Print(Option_t*option) const
00092 {
00093    // Dump the content
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    // Update time stamp either with the passed value (if > 0) or with
00105    // the current time
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    // Get current rate. Rteunr the average rate if the current is not defined
00119 
00120    if (fLastProcTime > 0) {
00121       return fLastEntries / fLastProcTime;
00122    }
00123    return GetRate();
00124 }

Generated on Tue Jul 5 14:51:40 2011 for ROOT_528-00b_version by  doxygen 1.5.1