// @(#)root/proof:$Id$
// Author: Jan Iwaszkiewicz    08/08/08

/*************************************************************************
 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TProofProgressStatus
#define ROOT_TProofProgressStatus

#ifndef ROOT_TObject
#include "TObject.h"
#endif

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TProofProgressStatus                                                 //
//                                                                      //
// Small class including processing statistics                          //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

class TProofProgressStatus : public TObject {
public:
   enum EStatusBits { kFileNotOpen     = BIT(15),
                      kFileCorrupted   = BIT(16)
   };
private:
   Long64_t fLastEntries; // Last chunck
   Long64_t fEntries;
   Long64_t fBytesRead;
   Long64_t fReadCalls;
   Double_t fLearnTime; // the time spent in learning phase
   Double_t fLastProcTime; // the wallclock time of the last addition
   Double_t fProcTime; // the wallclock time
   Double_t fCPUTime;
   Double_t fLastUpdate; // Timestamp of last change
public:
   TProofProgressStatus(Long64_t fEntries = 0, Long64_t fBytesRead = 0,
                        Long64_t fReadCalls = 0,
                        Double_t fProcTime = 0, Double_t fCPUTime = 0);
   void     Reset() { fEntries = 0,
                      fBytesRead = 0, fProcTime = 0, fCPUTime = 0; SetLastUpdate();}

   inline Long64_t GetEntries() const { return fEntries; }
   inline Long64_t GetBytesRead() const { return fBytesRead; }
   inline Long64_t GetReadCalls() const { return fReadCalls; }
   inline Double_t GetLearnTime() const { return fLearnTime; }
   inline Double_t GetProcTime() const { return fProcTime; }
   inline Double_t GetCPUTime() const { return fCPUTime; }
   inline Double_t GetLastUpdate() const { return fLastUpdate; }
   inline Double_t GetRate() const { return ((fProcTime > 0) ? fEntries/fProcTime : 0); }
   Double_t GetCurrentRate() const;
   inline void     SetLastEntries(Long64_t entries) { fLastEntries = entries; }
   inline void     SetEntries(Long64_t entries) { fEntries = entries; }
   inline void     IncEntries(Long64_t entries = 1) { fLastEntries = entries; fEntries += entries; }
   inline void     IncBytesRead(Long64_t bytesRead) { fBytesRead += bytesRead; }
   inline void     SetBytesRead(Long64_t bytesRead) { fBytesRead = bytesRead; }
   inline void     IncReadCalls(Long64_t readCalls) { fReadCalls += readCalls; }
   inline void     SetReadCalls(Long64_t readCalls) { fReadCalls = readCalls; }
   inline void     SetLearnTime(Double_t learnTime) { fLearnTime = learnTime; }
   inline void     SetLastProcTime(Double_t procTime) { fLastProcTime = procTime; }
   inline void     SetProcTime(Double_t procTime) { fProcTime = procTime; }
   inline void     IncProcTime(Double_t procTime) { fLastProcTime = procTime; fProcTime += procTime; }
   inline void     SetCPUTime(Double_t procTime) { fCPUTime = procTime; }
   inline void     IncCPUTime(Double_t procTime) { fCPUTime += procTime; }
   void     SetLastUpdate(Double_t updtTime = 0);
   void     Print(Option_t* option = "") const;

   TProofProgressStatus operator-(TProofProgressStatus &st);
   TProofProgressStatus &operator+=(const TProofProgressStatus &st);
   TProofProgressStatus &operator-=(const TProofProgressStatus &st);

   ClassDef(TProofProgressStatus,2) // Proof progress status class
};

#endif
 TProofProgressStatus.h:1
 TProofProgressStatus.h:2
 TProofProgressStatus.h:3
 TProofProgressStatus.h:4
 TProofProgressStatus.h:5
 TProofProgressStatus.h:6
 TProofProgressStatus.h:7
 TProofProgressStatus.h:8
 TProofProgressStatus.h:9
 TProofProgressStatus.h:10
 TProofProgressStatus.h:11
 TProofProgressStatus.h:12
 TProofProgressStatus.h:13
 TProofProgressStatus.h:14
 TProofProgressStatus.h:15
 TProofProgressStatus.h:16
 TProofProgressStatus.h:17
 TProofProgressStatus.h:18
 TProofProgressStatus.h:19
 TProofProgressStatus.h:20
 TProofProgressStatus.h:21
 TProofProgressStatus.h:22
 TProofProgressStatus.h:23
 TProofProgressStatus.h:24
 TProofProgressStatus.h:25
 TProofProgressStatus.h:26
 TProofProgressStatus.h:27
 TProofProgressStatus.h:28
 TProofProgressStatus.h:29
 TProofProgressStatus.h:30
 TProofProgressStatus.h:31
 TProofProgressStatus.h:32
 TProofProgressStatus.h:33
 TProofProgressStatus.h:34
 TProofProgressStatus.h:35
 TProofProgressStatus.h:36
 TProofProgressStatus.h:37
 TProofProgressStatus.h:38
 TProofProgressStatus.h:39
 TProofProgressStatus.h:40
 TProofProgressStatus.h:41
 TProofProgressStatus.h:42
 TProofProgressStatus.h:43
 TProofProgressStatus.h:44
 TProofProgressStatus.h:45
 TProofProgressStatus.h:46
 TProofProgressStatus.h:47
 TProofProgressStatus.h:48
 TProofProgressStatus.h:49
 TProofProgressStatus.h:50
 TProofProgressStatus.h:51
 TProofProgressStatus.h:52
 TProofProgressStatus.h:53
 TProofProgressStatus.h:54
 TProofProgressStatus.h:55
 TProofProgressStatus.h:56
 TProofProgressStatus.h:57
 TProofProgressStatus.h:58
 TProofProgressStatus.h:59
 TProofProgressStatus.h:60
 TProofProgressStatus.h:61
 TProofProgressStatus.h:62
 TProofProgressStatus.h:63
 TProofProgressStatus.h:64
 TProofProgressStatus.h:65
 TProofProgressStatus.h:66
 TProofProgressStatus.h:67
 TProofProgressStatus.h:68
 TProofProgressStatus.h:69
 TProofProgressStatus.h:70
 TProofProgressStatus.h:71
 TProofProgressStatus.h:72
 TProofProgressStatus.h:73
 TProofProgressStatus.h:74
 TProofProgressStatus.h:75
 TProofProgressStatus.h:76
 TProofProgressStatus.h:77
 TProofProgressStatus.h:78
 TProofProgressStatus.h:79
 TProofProgressStatus.h:80
 TProofProgressStatus.h:81