ROOT » TREE » TREEPLAYER » TTreePerfStats

class TTreePerfStats: public TVirtualPerfStats


                       TTreePerfStats

        TTree I/O performance measurement. see example of use below.

 The function FileReadEvent is called from TFile::ReadBuffer.
 For each call the following information is stored in fGraphIO
     - x[i]  = Tree entry number
     - y[i]  = 1e-6*(file position)
     - ey[i] = 1e-9*number of bytes read
 For each call the following information is stored in fGraphTime
     - x[i]  = Tree entry number
     - y[i]  = Time now
     - ey[i] = readtime, eg timenow - start
 The TTreePerfStats object can be saved in a ROOT file in such a way that
 its inspection can be done outside the job that generated it.

       Example of use
 {
   TFile *f = TFile::Open("RelValMinBias-GEN-SIM-RECO.root");
   T = (TTree*)f->Get("Events");
   Long64_t nentries = T->GetEntries();
   T->SetCacheSize(10000000);
   T->SetCacheEntryRange(0,nentries);
   T->AddBranchToCache("*");

   TTreePerfStats *ps= new TTreePerfStats("ioperf",T);

   for (Int_t i=0;i<nentries;i++) {
      T->GetEntry(i);
   }
   ps->SaveAs("cmsperf.root");
 }

 then, in a root interactive session, one can do:
    root > TFile f("cmsperf.root");
    root > ioperf->Draw();
    root > ioperf->Print();

 The Draw or Print functions print the following information:
   TreeCache = TTree cache size in MBytes
   N leaves  = Number of leaves in the TTree
   ReadTotal = Total number of zipped bytes read
   ReadUnZip = Total number of unzipped bytes read
   ReadCalls = Total number of disk reads
   ReadSize  = Average read size in KBytes
   Readahead = Readahead size in KBytes
   Readextra = Readahead overhead in percent
   Real Time = Real Time in seconds
   CPU  Time = CPU Time in seconds
   Disk Time = Real Time spent in pure raw disk IO
   Disk IO   = Raw disk IO speed in MBytes/second
   ReadUZRT  = Unzipped MBytes per RT second
   ReadUZCP  = Unipped MBytes per CP second
   ReadRT    = Zipped MBytes per RT second
   ReadCP    = Zipped MBytes per CP second

   NOTE1 : The ReadTotal value indicates the effective number of zipped bytes
           returned to the application. The physical number of bytes read
           from the device (as measured for example with strace) is
           ReadTotal +ReadTotal*Readextra/100. Same for ReadSize.

   NOTE2 : A consequence of NOTE1, the Disk I/O speed corresponds to the effective
           number of bytes returned to the application per second.
           The Physical disk speed is DiskIO + DiskIO*ReadExtra/100.


Function Members (Methods)

public:
virtual~TTreePerfStats()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBrowse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
static TVirtualPerfStats*&TVirtualPerfStats::CurrentPerfStats()
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
static const char*TVirtualPerfStats::EventType(TVirtualPerfStats::EEventType type)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidFileEvent(const char*, const char*, const char*, const char*, Bool_t)
virtual voidFileOpenEvent(TFile*, const char*, Double_t)
virtual voidFileReadEvent(TFile* file, Int_t len, Double_t start)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual voidFinish()
virtual Long64_tGetBytesRead() const
virtual Long64_tGetBytesReadExtra() const
virtual Double_tGetCpuTime() const
virtual Double_tGetDiskTime() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
TGraphErrors*GetGraphIO()
TGraphErrors*GetGraphTime()
const char*GetHostInfo() const
virtual const char*TObject::GetIconName() const
virtual const char*GetName() const
virtual Int_tGetNleaves() const
virtual Long64_tGetNumEvents() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
TPaveText*GetPave()
virtual Int_tGetReadaheadSize() const
virtual Int_tGetReadCalls() const
virtual Double_tGetRealTime() const
TStopwatch*GetStopwatch() const
virtual const char*TObject::GetTitle() const
virtual Int_tGetTreeCacheSize() const
virtual UInt_tTObject::GetUniqueID() const
virtual Double_tGetUnzipTime() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TTreePerfStats&operator=(const TTreePerfStats&)
virtual voidPacketEvent(const char*, const char*, const char*, Long64_t, Double_t, Double_t, Double_t, Long64_t)
virtual voidPaint(Option_t* chopt = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") const
virtual voidRateEvent(Double_t, Double_t, Long64_t, Long64_t)
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidSaveAs(const char* filename = "", Option_t* option = "") const
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidSetBytesRead(Long64_t nbytes)
virtual voidSetBytesReadExtra(Long64_t nbytes)
virtual voidSetCompress(Double_t cx)
virtual voidSetCpuTime(Double_t cptime)
virtual voidSetDiskTime(Double_t t)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetGraphIO(TGraphErrors* gr)
virtual voidSetGraphTime(TGraphErrors* gr)
virtual voidSetHostInfo(const char* info)
virtual voidSetName(const char* name)
virtual voidSetNleaves(Int_t nleaves)
virtual voidSetNumEvents(Long64_t)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetReadaheadSize(Int_t nbytes)
virtual voidSetReadCalls(Int_t ncalls)
virtual voidSetRealNorm(Double_t rnorm)
virtual voidSetRealTime(Double_t rtime)
virtual voidSetTreeCacheSize(Int_t nbytes)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidSetUnzipTime(Double_t uztime)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidSimpleEvent(TVirtualPerfStats::EEventType)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TTreePerfStats()
TTreePerfStats(const TTreePerfStats&)
TTreePerfStats(const char* name, TTree* T)
virtual voidUnzipEvent(TObject* tree, Long64_t pos, Double_t start, Int_t complen, Int_t objlen)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

protected:
Long64_tfBytesReadNumber of bytes read
Long64_tfBytesReadExtraNumber of bytes (overhead) of the readahead cache
Double_tfCompressTree compression factor
Double_tfCpuTimeCpu time
Double_tfDiskTimeTime spent in pure raw disk IO
TFile*fFile!pointer to the file containing the Tree
TGraphErrors*fGraphIOpointer to the graph with IO data
TGraphErrors*fGraphTimepointer to the graph with timestamp info
TStringfHostInfoname of the host system, ROOT version and date
TText*fHostInfoTextGraphics Text object with the fHostInfo data
TStringfNamename of this TTreePerfStats
Int_tfNleavesNumber of leaves in the tree
TPaveText*fPavepointer to annotation pavetext
Int_tfReadCallsNumber of read calls
Int_tfReadaheadSizeReadahead cache size
Double_tfRealNormReal time scale factor for fGraphTime
Double_tfRealTimeReal time
TGaxis*fRealTimeAxispointer to TGaxis object showing real-time
TTree*fTree!pointer to the Tree being monitored
Int_tfTreeCacheSizeTTreeCache buffer size
Double_tfUnzipTimeTime spent uncompressing the data.
TStopwatch*fWatchTStopwatch pointer

Class Charts

Inheritance Chart:
TObject
TVirtualPerfStats
TTreePerfStats

Function documentation

TTreePerfStats()
 default constructor (used when reading an object only)
TTreePerfStats(const char* name, TTree* T)
 Create a TTree I/O perf stats object.
~TTreePerfStats()
 Destructor
void Browse(TBrowser* b)
Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Return distance to one of the objects in the TTreePerfStats
void Draw(Option_t* option = "")
 Draw the TTree I/O perf graph.
 by default the graph is drawn with option "al"
 Specify option ="ap" to show only the read blocks and not the line
 connecting the blocks
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Return distance to one of the objects in the TTreePerfStats
void FileReadEvent(TFile* file, Int_t len, Double_t start)
 Record TTree file read event.
 start is the TimeStamp before reading
 len is the number of bytes read
void UnzipEvent(TObject* tree, Long64_t pos, Double_t start, Int_t complen, Int_t objlen)
 Record TTree unzip event.
 start is the TimeStamp before unzip
 pos is where in the file the compressed buffer came from
 complen is the length of the compressed buffer
 objlen is the length of the de-compressed buffer
void Finish()
 When the run is finished this function must be called
 to save the current parameters in the file and Tree in this object
 the function is automatically called by Draw and Print
void Paint(Option_t* chopt = "")
 Draw the TTree I/O perf graph.
void Print(Option_t* option = "") const
 Print the TTree I/O perf stats.
void SaveAs(const char* filename = "", Option_t* option = "") const
 Save this object to filename
void SavePrimitive(ostream& out, Option_t* option = "")
 Save primitive as a C++ statement(s) on output stream out
TTreePerfStats()
Long64_t GetBytesRead() const
{return fBytesRead;}
Long64_t GetBytesReadExtra() const
{return fBytesReadExtra;}
Double_t GetCpuTime() const
{return fCpuTime;}
Double_t GetDiskTime() const
{return fDiskTime;}
TGraphErrors * GetGraphIO()
{return fGraphIO;}
TGraphErrors * GetGraphTime()
{return fGraphTime;}
const char * GetHostInfo() const
{return fHostInfo.Data();}
const char * GetName() const
{return fName.Data();}
Int_t GetNleaves() const
{return fNleaves;}
Long64_t GetNumEvents() const
{return 0;}
TPaveText * GetPave()
{return fPave;}
Int_t GetReadaheadSize() const
{return fReadaheadSize;}
Int_t GetReadCalls() const
{return fReadCalls;}
Double_t GetRealTime() const
{return fRealTime;}
TStopwatch * GetStopwatch() const
{return fWatch;}
Int_t GetTreeCacheSize() const
{return fTreeCacheSize;}
Double_t GetUnzipTime() const
{return fUnzipTime; }
void SimpleEvent(TVirtualPerfStats::EEventType )
{}
void PacketEvent(const char* , const char* , const char* , Long64_t , Double_t , Double_t , Double_t , Long64_t )
{}
void FileOpenEvent(TFile* , const char* , Double_t )
{}
void RateEvent(Double_t , Double_t , Long64_t , Long64_t )
{}
void SetBytesRead(Long64_t nbytes)
{fBytesRead = nbytes;}
void SetBytesReadExtra(Long64_t nbytes)
{fBytesReadExtra = nbytes;}
void SetCompress(Double_t cx)
{fCompress = cx;}
void SetDiskTime(Double_t t)
{fDiskTime = t;}
void SetNumEvents(Long64_t )
{}
void SetCpuTime(Double_t cptime)
{fCpuTime = cptime;}
void SetGraphIO(TGraphErrors* gr)
{fGraphIO = gr;}
void SetGraphTime(TGraphErrors* gr)
{fGraphTime = gr;}
void SetHostInfo(const char* info)
{fHostInfo = info;}
void SetName(const char* name)
{fName = name;}
void SetNleaves(Int_t nleaves)
{fNleaves = nleaves;}
void SetReadaheadSize(Int_t nbytes)
{fReadaheadSize = nbytes;}
void SetReadCalls(Int_t ncalls)
{fReadCalls = ncalls;}
void SetRealNorm(Double_t rnorm)
{fRealNorm = rnorm;}
void SetRealTime(Double_t rtime)
{fRealTime = rtime;}
void SetTreeCacheSize(Int_t nbytes)
{fTreeCacheSize = nbytes;}
void SetUnzipTime(Double_t uztime)
{fUnzipTime = uztime;}