TPerfStats.h

Go to the documentation of this file.
00001 // @(#)root/proofplayer:$Id: TPerfStats.h 38185 2011-02-21 14:55:16Z ganis $
00002 // Author: Kristjan Gulbrandsen   11/05/04
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, 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 #ifndef ROOT_TPerfStats
00013 #define ROOT_TPerfStats
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TPerfStats                                                           //
00018 //                                                                      //
00019 // Provides the interface for the PROOF internal performance measurment //
00020 // and event tracing.                                                   //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 
00025 #ifndef ROOT_TObject
00026 #include "TObject.h"
00027 #endif
00028 #ifndef ROOT_TTimeStamp
00029 #include "TTimeStamp.h"
00030 #endif
00031 #ifndef ROOT_TString
00032 #include "TString.h"
00033 #endif
00034 #ifndef ROOT_TVirtualPerfStats
00035 #include "TVirtualPerfStats.h"
00036 #endif
00037 
00038 
00039 class TTree;
00040 class TH1D;
00041 class TH2D;
00042 class TList;
00043 class TVirtualMonitoringWriter;
00044 
00045 
00046 class TPerfEvent : public TObject {
00047 
00048 public:
00049    TString                       fEvtNode;   // node on which the event was generated
00050    TTimeStamp                    fTimeStamp; // time offset from start of run
00051    TVirtualPerfStats::EEventType fType;
00052    TString                       fSlaveName;
00053    TString                       fNodeName;
00054    TString                       fFileName;
00055    TString                       fFileClass;
00056    TString                       fSlave;
00057    Long64_t                      fEventsProcessed;
00058    Long64_t                      fBytesRead;
00059    Long64_t                      fLen;
00060    Double_t                      fLatency;
00061    Double_t                      fProcTime;
00062    Double_t                      fCpuTime;
00063    Bool_t                        fIsStart;
00064    Bool_t                        fIsOk;
00065 
00066    TPerfEvent(TTimeStamp *offset = 0);
00067    virtual ~TPerfEvent() {}
00068 
00069    Bool_t   IsSortable() const { return kTRUE; }
00070    Int_t    Compare(const TObject *obj) const;
00071    void     Print(Option_t *option="") const;
00072 
00073    ClassDef(TPerfEvent,3) // Class holding TProof Event Info
00074 };
00075 
00076 
00077 class TPerfStats : public TVirtualPerfStats {
00078 
00079 private:
00080    TTree         *fTrace;        //!TTree with trace events
00081    TTimeStamp     fTzero;        //!start time of this run
00082    TPerfEvent    *fPerfEvent;    //!TPerfEvent used to fill tree
00083    TH1D          *fPacketsHist;  //!histogram of packets processed per slave
00084    TH1D          *fEventsHist;   //!histogram of events processed per slave
00085    TH1D          *fNodeHist;     //!histogram of slaves per file serving node
00086    TH2D          *fLatencyHist;  //!histogram of latency due to packet requests
00087    TH2D          *fProcTimeHist; //!histogram of real time spent processing packets
00088    TH2D          *fCpuTimeHist;  //!histogram of cpu time spent processing packets
00089    Long64_t       fBytesRead;    //!track bytes read of main file
00090    Double_t       fTotCpuTime;   //!total cpu time of all slaves
00091    Long64_t       fTotBytesRead; //!total bytes read on all slaves
00092    Long64_t       fTotEvents;    //!total number of events processed
00093    Long64_t       fNumEvents;    //!total number of events to be processed
00094    Int_t          fSlaves;       //!number of active slaves
00095 
00096    Bool_t         fDoHist;       //!Fill histos
00097    Bool_t         fDoTrace;      //!Trace details in master
00098    Bool_t         fDoTraceRate;  //!Trace processing rate in master
00099    Bool_t         fDoSlaveTrace; //!Full tracing in workers
00100    Bool_t         fDoQuota;      //!Save stats on SQL server for quota management
00101    
00102    Bool_t         fMonitorPerPacket; //!Whether to send the full entry per each packet 
00103 
00104    TVirtualMonitoringWriter *fMonitoringWriter; //!Monitoring engine
00105 
00106    TPerfStats(TList *input, TList *output);
00107    void WriteQueryLog();
00108 
00109 public:
00110    virtual ~TPerfStats() {}
00111 
00112    void SimpleEvent(EEventType type);
00113    void PacketEvent(const char *slave, const char *slavename, const char *filename,
00114                     Long64_t eventsprocessed, Double_t latency,
00115                     Double_t proctime, Double_t cputime, Long64_t bytesRead);
00116    void FileEvent(const char *slave, const char *slavename, const char *nodename, const char *filename,
00117                   Bool_t isStart);
00118 
00119    void FileOpenEvent(TFile *file, const char *filename, Double_t start);
00120    void FileReadEvent(TFile *file, Int_t len, Double_t start);
00121    void RateEvent(Double_t proctime, Double_t deltatime,
00122                   Long64_t eventsprocessed, Long64_t bytesRead);
00123    void SetBytesRead(Long64_t num);
00124    Long64_t GetBytesRead() const;
00125    void SetNumEvents(Long64_t num) { fNumEvents = num; }
00126    Long64_t GetNumEvents() const { return fNumEvents; }
00127 
00128    static void Start(TList *input, TList *output);
00129    static void Stop();
00130    static void Setup(TList *input);
00131 
00132    ClassDef(TPerfStats,0)  // Class for collecting PROOF statistics
00133 };
00134 
00135 
00136 #endif

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