Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTreePerfStats.cxx
Go to the documentation of this file.
1// @(#)root/treeplayer:$Id$
2// Author: Rene Brun 29/10/09
3
4/*************************************************************************
5 * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TTreePerfStats
13
14TTree I/O performance measurement. see example of use below.
15
16The function FileReadEvent is called from TFile::ReadBuffer.
17For each call the following information is stored in fGraphIO
18 - x[i] = Tree entry number
19 - y[i] = 1e-6*(file position)
20 - ey[i] = 1e-9*number of bytes read
21For each call the following information is stored in fGraphTime
22 - x[i] = Tree entry number
23 - y[i] = Time now
24 - ey[i] = readtime, eg timenow - start
25The TTreePerfStats object can be saved in a ROOT file in such a way that
26its inspection can be done outside the job that generated it.
27
28Example of use:
29~~~{.cpp}
30{
31 TFile *f = TFile::Open("RelValMinBias-GEN-SIM-RECO.root");
32 T = (TTree*)f->Get("Events");
33 Long64_t nentries = T->GetEntries();
34 T->SetCacheSize(10000000);
35 T->SetCacheEntryRange(0,nentries);
36 T->AddBranchToCache("*");
37//
38 TTreePerfStats *ps= new TTreePerfStats("ioperf",T);
39//
40 for (Int_t i=0;i<nentries;i++) {
41 T->GetEntry(i);
42 }
43 ps->SaveAs("cmsperf.root");
44}
45~~~
46then, in a root interactive session, one can do:
47~~~{.cpp}
48 root > TFile f("cmsperf.root");
49 root > ioperf->Draw();
50 root > ioperf->Print();
51~~~
52The Draw or Print functions print the following information:
53 - TreeCache = TTree cache size in MBytes
54 - N leaves = Number of leaves in the TTree
55 - ReadTotal = Total number of zipped bytes read
56 - ReadUnZip = Total number of unzipped bytes read
57 - ReadCalls = Total number of disk reads
58 - ReadSize = Average read size in KBytes
59 - Readahead = Readahead size in KBytes
60 - Readextra = Readahead overhead in percent
61 - Real Time = Real Time in seconds
62 - CPU Time = CPU Time in seconds
63 - Disk Time = Real Time spent in pure raw disk IO
64 - Disk IO = Raw disk IO speed in MBytes/second
65 - ReadUZRT = Unzipped MBytes per RT second
66 - ReadUZCP = Unipped MBytes per CP second
67 - ReadRT = Zipped MBytes per RT second
68 - ReadCP = Zipped MBytes per CP second
69
70 ### NOTE 1 :
71The ReadTotal value indicates the effective number of zipped bytes
72returned to the application. The physical number of bytes read
73from the device (as measured for example with strace) is
74ReadTotal +ReadTotal*Readextra/100. Same for ReadSize.
75
76 ### NOTE 2 :
77A consequence of NOTE1, the Disk I/O speed corresponds to the effective
78number of bytes returned to the application per second.
79The Physical disk speed is DiskIO + DiskIO*ReadExtra/100.
80*/
81
82#include "TTreePerfStats.h"
83#include "TROOT.h"
84#include "TSystem.h"
85#include "TFile.h"
86#include "TTree.h"
87#include "TTreeCache.h"
88#include "TAxis.h"
89#include "TBranch.h"
90#include "TBrowser.h"
91#include "TVirtualPad.h"
92#include "TPaveText.h"
93#include "TGraphErrors.h"
94#include "TStopwatch.h"
95#include "TGaxis.h"
96#include "TTimeStamp.h"
97#include "TDatime.h"
98#include "TMath.h"
99
100#include <iostream>
101
102
103////////////////////////////////////////////////////////////////////////////////
104/// default constructor (used when reading an object only)
105
107{
108 fName = "";
109 fHostInfo = "";
110 fTree = nullptr;
111 fNleaves = 0;
112 fFile = nullptr;
113 fGraphIO = nullptr;
114 fGraphTime = nullptr;
115 fWatch = nullptr;
116 fPave = nullptr;
117 fTreeCacheSize = 0;
118 fReadCalls = 0;
119 fReadaheadSize = 0;
120 fBytesRead = 0;
122 fRealNorm = 0;
123 fRealTime = 0;
124 fCpuTime = 0;
125 fDiskTime = 0;
126 fUnzipTime = 0;
128 fUnzipObjSize = 0;
129 fCompress = 0;
130 fRealTimeAxis = nullptr;
131 fHostInfoText = nullptr;
132}
133
134////////////////////////////////////////////////////////////////////////////////
135/// Create a TTree I/O perf stats object.
136
138{
139 fName = name;
140 fTree = T;
141 T->SetPerfStats(this);
142 fNleaves= T->GetListOfLeaves()->GetEntries();
143 fFile = T->GetCurrentFile();
144 fGraphIO = new TGraphErrors(0);
145 fGraphIO->SetName("ioperf");
146 fGraphIO->SetTitle(Form("%s/%s",fFile->GetName(),T->GetName()));
147 fGraphIO->SetUniqueID(999999999);
148 fGraphTime = new TGraphErrors(0);
150 fGraphTime->SetName("iotime");
151 fGraphTime->SetTitle("Real time vs entries");
152 fWatch = new TStopwatch();
153 fWatch->Start();
154 fPave = nullptr;
155 fTreeCacheSize = 0;
156 fReadCalls = 0;
157 fReadaheadSize = 0;
158 fBytesRead = 0;
160 fRealNorm = 0;
161 fRealTime = 0;
162 fCpuTime = 0;
163 fDiskTime = 0;
164 fUnzipTime = 0;
166 fUnzipObjSize = 0;
167 fRealTimeAxis = nullptr;
168 fCompress = (T->GetTotBytes()+0.00001)/T->GetZipBytes();
169
170 bool isUNIX = strcmp(gSystem->GetName(), "Unix") == 0;
171 if (isUNIX)
172 fHostInfo = gSystem->GetFromPipe("uname -a");
173 else
174 fHostInfo = "Windows ";
175 fHostInfo.Resize(20);
176 fHostInfo += TString::Format("ROOT %s, Git: %s", gROOT->GetVersion(), gROOT->GetGitCommit());
177 TDatime dt;
178 fHostInfo += TString::Format(" %s",dt.AsString());
179 fHostInfoText = nullptr;
180
181 gPerfStats = this;
182}
183
184////////////////////////////////////////////////////////////////////////////////
185/// Destructor
186
188{
189 fTree = nullptr;
190 fFile = nullptr;
191 delete fGraphIO;
192 delete fGraphTime;
193 delete fPave;
194 delete fWatch;
195 delete fRealTimeAxis;
196 delete fHostInfoText;
197
198 if (gPerfStats == this) {
199 gPerfStats = nullptr;
200 }
201}
202
203
204////////////////////////////////////////////////////////////////////////////////
205/// Browse
206
208{
209 Draw();
210 gPad->Update();
211}
212
213////////////////////////////////////////////////////////////////////////////////
214/// Return distance to one of the objects in the TTreePerfStats
215
217{
218 const Int_t kMaxDiff = 7;
219 Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
220 Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
221 Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
222 Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
223 if (py < puymax) return 9999;
224 //on the fGraphIO ?
226 if (distance <kMaxDiff) {if (px > puxmin && py < puymin) gPad->SetSelected(fGraphIO); return distance;}
227 // on the fGraphTime ?
229 if (distance <kMaxDiff) {if (px > puxmin && py < puymin) gPad->SetSelected(fGraphTime); return distance;}
230 // on the pave ?
232 if (distance <kMaxDiff) {gPad->SetSelected(fPave); return distance;}
233 // on the real time axis ?
235 if (distance <kMaxDiff) {gPad->SetSelected(fRealTimeAxis); return distance;}
236 // on the host info label ?
238 if (distance <kMaxDiff) {gPad->SetSelected(fHostInfoText); return distance;}
239 if (px > puxmax-300) return 2;
240 return 999;
241}
242
243////////////////////////////////////////////////////////////////////////////////
244/// Draw the TTree I/O perf graph.
245/// by default the graph is drawn with option "al"
246/// Specify option ="ap" to show only the read blocks and not the line
247/// connecting the blocks
248
250{
251 Finish();
252
253 TString opt = option;
254 if (strlen(option)==0) opt = "al";
255 opt.ToLower();
256 if (gPad) {
257 if (!gPad->IsEditable()) gROOT->MakeDefCanvas();
258 //the following statement is necessary in case one attempts to draw
259 //a temporary histogram already in the current pad
260 if (TestBit(kCanDelete)) gPad->Remove(this);
261 } else {
262 gROOT->MakeDefCanvas();
263 }
264 if (opt.Contains("a")) {
265 gPad->SetLeftMargin(0.35);
266 gPad->Clear();
267 gPad->SetGridx();
268 gPad->SetGridy();
269 }
270 AppendPad(opt.Data());
271}
272
273////////////////////////////////////////////////////////////////////////////////
274/// Return distance to one of the objects in the TTreePerfStats
275
276void TTreePerfStats::ExecuteEvent(Int_t /*event*/, Int_t /*px*/, Int_t /*py*/)
277{
278}
279
280////////////////////////////////////////////////////////////////////////////////
281/// Record TTree file read event.
282/// - start is the TimeStamp before reading
283/// - len is the number of bytes read
284
286{
287 if (file == this->fFile) {
288 Long64_t offset = file->GetRelOffset();
289 Int_t np = fGraphIO->GetN();
292 fGraphIO->SetPointError(np,0.001,1e-9*len);
294 Double_t dtime = tnow-start;
295 fDiskTime += dtime;
298 fReadCalls++;
299 fBytesRead += len;
300 }
301}
302
303
304////////////////////////////////////////////////////////////////////////////////
305/// Record TTree unzip event.
306/// - start is the TimeStamp before unzip
307/// - pos is where in the file the compressed buffer came from
308/// - complen is the length of the compressed buffer
309/// - objlen is the length of the de-compressed buffer
310
312{
313 if (tree == this->fTree || tree == this->fTree->GetTree()){
315 Double_t dtime = tnow-start;
316 fUnzipTime += dtime;
319 }
320}
321
322////////////////////////////////////////////////////////////////////////////////
323/// When the run is finished this function must be called
324/// to save the current parameters in the file and Tree in this object
325/// the function is automatically called by Draw and Print
326
328{
329 if (fRealNorm) return; //has already been called
330 if (!fFile) return;
331 if (!fTree) return;
332
335 if (fTree->IsA()->InheritsFrom("TChain"))
336 fBytesReadExtra = fTree->GetDirectory()->GetFile()->GetBytesReadExtra();
337 else if (fFile)
341 if (fUnzipInputSize)
344 if (!npoints) return;
348 // we normalize the fGraphTime such that it can be drawn on top of fGraphIO
349 for (Int_t i=1;i<npoints;i++) {
350 fGraphTime->GetY()[i] = fGraphTime->GetY()[i-1] +fRealNorm*fGraphTime->GetEY()[i];
351 fGraphTime->GetEY()[i] = 0;
352 }
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Update the fBranchIndexCache collection to match the current TTree given
357/// the ordered list of branch names.
358
360{
361 fBranchIndexCache.clear();
362
363 for (int i = 0; i < branches->GetEntries(); ++i) {
364 fBranchIndexCache.emplace((TBranch*)(branches->UncheckedAt(i)), i);
365 }
366}
367
368////////////////////////////////////////////////////////////////////////////////
369/// Return the BasketInfo corresponding to the given branch and basket.
370
372{
373 static BasketInfo fallback;
374
375 // First find the branch index.
376 TFile *file = fTree->GetCurrentFile();
377 if (!file)
378 return fallback;
379
380 TTreeCache *cache = dynamic_cast<TTreeCache *>(file->GetCacheRead(fTree));
381 if (!cache)
382 return fallback;
383
384 Int_t index = -1;
385 auto iter = fBranchIndexCache.find(br);
386 if (iter == fBranchIndexCache.end()) {
387 auto branches = cache->GetCachedBranches();
388 for (Int_t i = 0; i < branches->GetEntries(); ++i) {
389 if (br == branches->UncheckedAt(i)) {
390 index = i;
391 break;
392 }
393 }
394 if (index < 0)
395 return fallback;
396 fBranchIndexCache.emplace(br, index);
397 } else {
398 index = iter->second;
399 }
400
402}
403
404////////////////////////////////////////////////////////////////////////////////
405/// Return the BasketInfo corresponding to the given branch and basket.
406
408{
409 if (fBasketsInfo.size() <= (size_t)index)
410 fBasketsInfo.resize(index + 1);
411
412 auto &brvec(fBasketsInfo[index]);
413 if (brvec.size() <= basketNumber)
414 brvec.resize(basketNumber + 1);
415
416 return brvec[basketNumber];
417}
418
419////////////////////////////////////////////////////////////////////////////////
420/// Return the collection of baskets which have been read by the TTreeCache more
421/// than once
422
424{
426
427 TFile *file = fTree->GetCurrentFile();
428 if (!file)
429 return result;
430
431 TTreeCache *cache = dynamic_cast<TTreeCache *>(file->GetCacheRead(fTree));
432 if (!cache)
433 return result;
434
435 auto branches = cache->GetCachedBranches();
436 for (size_t i = 0; i < fBasketsInfo.size(); ++i) {
437 bool first = true;
438 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
439 auto &info(fBasketsInfo[i][j]);
440 if ((info.fLoaded + info.fLoadedMiss) > 1) {
441 if (first) {
442 result.emplace_back(BasketList_t::value_type((TBranch*)branches->At(i), std::vector<size_t>(1)));
443 first = false;
444 }
445 auto &ref( result.back() );
446 ref.second.push_back(j);
447 }
448 }
449 }
450
451 return result;
452}
453
454////////////////////////////////////////////////////////////////////////////////
455/// Draw the TTree I/O perf graph.
456
458{
460 if (!npoints) return;
463 if (iomax >= 1e9) toffset = 1.2;
464 fGraphIO->GetXaxis()->SetTitle("Tree entry number");
465 fGraphIO->GetYaxis()->SetTitle("file position (MBytes) ");
470
472 opts.ToLower();
473 bool unzip = opts.Contains("unzip");
474
475 //superimpose the time info (max 10 points)
476 if (fGraphTime) {
477 fGraphTime->Paint("l");
478 TText tdisk(fGraphTime->GetX()[npoints-1],1.1*fGraphTime->GetY()[npoints-1],"RAW IO");
479 tdisk.SetTextAlign(31);
480 tdisk.SetTextSize(0.03);
481 tdisk.SetTextColor(kRed);
482 tdisk.Paint();
483 if (!fRealTimeAxis) {
484 Double_t uxmax = gPad->GetUxmax();
485 Double_t uymax = gPad->GetUymax();
487 fRealTimeAxis = new TGaxis(uxmax,0,uxmax,uymax,0.,rtmax,510,"+L");
488 fRealTimeAxis->SetName("RealTimeAxis");
490 fRealTimeAxis->SetTitle("RealTime (s) ");
492 toffset = 1;
493 if (fRealTime >= 100) toffset = 1.2;
494 if (fRealTime >= 1000) toffset = 1.4;
498 }
500 }
501
503 if (!fPave) {
504 fPave = new TPaveText(.01,.10,.24,.90,"brNDC");
505 fPave->SetTextAlign(12);
506 fPave->AddText(Form("TreeCache = %d MB",fTreeCacheSize/1000000));
507 fPave->AddText(Form("N leaves = %d",fNleaves));
508 fPave->AddText(Form("ReadTotal = %g MB",1e-6*fBytesRead));
509 fPave->AddText(Form("ReadUnZip = %g MB",1e-6*fBytesRead*fCompress));
510 fPave->AddText(Form("ReadCalls = %d",fReadCalls));
511 fPave->AddText(Form("ReadSize = %7.3f KB",0.001*fBytesRead/fReadCalls));
512 fPave->AddText(Form("Readahead = %d KB",fReadaheadSize/1000));
513 fPave->AddText(Form("Readextra = %5.2f per cent",extra));
514 fPave->AddText(Form("Real Time = %7.3f s",fRealTime));
515 fPave->AddText(Form("CPU Time = %7.3f s",fCpuTime));
516 fPave->AddText(Form("Disk Time = %7.3f s",fDiskTime));
517 if (unzip) {
518 fPave->AddText(Form("UnzipTime = %7.3f s",fUnzipTime));
519 }
520 fPave->AddText(Form("Disk IO = %7.3f MB/s",1e-6*fBytesRead/fDiskTime));
521 fPave->AddText(Form("ReadUZRT = %7.3f MB/s",1e-6*fCompress*fBytesRead/fRealTime));
522 fPave->AddText(Form("ReadUZCP = %7.3f MB/s",1e-6*fCompress*fBytesRead/fCpuTime));
523 fPave->AddText(Form("ReadRT = %7.3f MB/s",1e-6*fBytesRead/fRealTime));
524 fPave->AddText(Form("ReadCP = %7.3f MB/s",1e-6*fBytesRead/fCpuTime));
525 }
526 fPave->Paint();
527
528 if (!fHostInfoText) {
529 fHostInfoText = new TText(0.01,0.01,fHostInfo.Data());
532 }
534}
535
536////////////////////////////////////////////////////////////////////////////////
537/// Print the TTree I/O perf stats.
538
540{
542 opts.ToLower();
543 bool unzip = opts.Contains("unzip");
544 bool basket = opts.Contains("basket");
545 TTreePerfStats *ps = (TTreePerfStats*)this;
546 ps->Finish();
547
549 printf("TreeCache = %d MBytes\n",Int_t(fTreeCacheSize/1000000));
550 printf("N leaves = %d\n",fNleaves);
551 printf("ReadTotal = %g MBytes\n",1e-6*fBytesRead);
552 printf("ReadUnZip = %g MBytes\n",1e-6*fBytesRead*fCompress);
553 printf("ReadCalls = %d\n",fReadCalls);
554 printf("ReadSize = %7.3f KBytes/read\n",0.001*fBytesRead/fReadCalls);
555 printf("Readahead = %d KBytes\n",fReadaheadSize/1000);
556 printf("Readextra = %5.2f per cent\n",extra);
557 printf("Real Time = %7.3f seconds\n",fRealTime);
558 printf("CPU Time = %7.3f seconds\n",fCpuTime);
559 printf("Disk Time = %7.3f seconds\n",fDiskTime);
560 if (unzip) {
561 printf("Strm Time = %7.3f seconds\n",fCpuTime-fUnzipTime);
562 printf("UnzipTime = %7.3f seconds\n",fUnzipTime);
563 }
564 printf("Disk IO = %7.3f MBytes/s\n",1e-6*fBytesRead/fDiskTime);
565 printf("ReadUZRT = %7.3f MBytes/s\n",1e-6*fCompress*fBytesRead/fRealTime);
566 printf("ReadUZCP = %7.3f MBytes/s\n",1e-6*fCompress*fBytesRead/fCpuTime);
567 printf("ReadRT = %7.3f MBytes/s\n",1e-6*fBytesRead/fRealTime);
568 printf("ReadCP = %7.3f MBytes/s\n",1e-6*fBytesRead/fCpuTime);
569 if (unzip) {
570 printf("ReadStrCP = %7.3f MBytes/s\n",1e-6*fCompress*fBytesRead/(fCpuTime-fUnzipTime));
571 printf("ReadZipCP = %7.3f MBytes/s\n",1e-6*fCompress*fBytesRead/fUnzipTime);
572 }
573 if (basket)
575}
576
577////////////////////////////////////////////////////////////////////////////////
578/// Print the TTree basket information
579
581{
582
584 opts.ToLower();
585 bool all = opts.Contains("allbasketinfo");
586
587 TFile *file = fTree->GetCurrentFile();
588 if (!file)
589 return;
590
591 TTreeCache *cache = dynamic_cast<TTreeCache *>(file->GetCacheRead(fTree));
592 if (!cache)
593 return;
594
595 auto branches = cache->GetCachedBranches();
596 for (size_t i = 0; i < fBasketsInfo.size(); ++i) {
597 const char *branchname = branches->At(i)->GetName();
598
599 printf(" br=%zu %s read not cached: ", i, branchname);
600 if (fBasketsInfo[i].empty()) {
601 printf("none");
602 } else
603 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
604 if (fBasketsInfo[i][j].fMissed)
605 printf("%zu ", j);
606 }
607 printf("\n");
608
609 printf(" br=%zu %s cached more than once: ", i, branchname);
610 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
611 auto &info(fBasketsInfo[i][j]);
612 if ((info.fLoaded + info.fLoadedMiss) > 1)
613 printf("%zu[%d,%d] ", j, info.fLoaded, info.fLoadedMiss);
614 }
615 printf("\n");
616
617 printf(" br=%zu %s cached but not used: ", i, branchname);
618 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
619 auto &info(fBasketsInfo[i][j]);
620 if ((info.fLoaded + info.fLoadedMiss) && !info.fUsed) {
621 if (info.fLoadedMiss)
622 printf("%zu[%d,%d] ", j, info.fLoaded, info.fLoadedMiss);
623 else
624 printf("%zu ", j);
625 }
626 }
627 printf("\n");
628
629 if (all) {
630 printf(" br=%zu %s: ", i, branchname);
631 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
632 auto &info(fBasketsInfo[i][j]);
633 printf("%zu[%d,%d,%d,%d] ", j, info.fUsed, info.fLoaded, info.fLoadedMiss, info.fMissed);
634 }
635 printf("\n");
636 }
637 }
638 for (Int_t i = fBasketsInfo.size(); i < branches->GetEntries(); ++i) {
639 printf(" br=%d %s: no basket information\n", i, branches->At(i)->GetName());
640 }
641}
642
643////////////////////////////////////////////////////////////////////////////////
644/// Save this object to filename
645
646void TTreePerfStats::SaveAs(const char *filename, Option_t * /*option*/) const
647{
648 TTreePerfStats *ps = (TTreePerfStats*)this;
649 ps->Finish();
650 ps->TObject::SaveAs(filename);
651}
652
653////////////////////////////////////////////////////////////////////////////////
654/// Save primitive as a C++ statement(s) on output stream out
655
657{
658 SavePrimitiveConstructor(out, Class(), "perfstats");
659 out << " perfstats->SetName(\"" << TString(GetName()).ReplaceSpecialCppChars() << "\");\n";
660 out << " perfstats->SetHostInfo(\"" << TString(GetHostInfo()).ReplaceSpecialCppChars() << "\");\n";
661 out << " perfstats->SetTreeCacheSize(" << fTreeCacheSize << ");\n";
662 out << " perfstats->SetNleaves(" << fNleaves << ");\n";
663 out << " perfstats->SetReadCalls(" << fReadCalls << ");\n";
664 out << " perfstats->SetReadaheadSize(" << fReadaheadSize << ");\n";
665 out << " perfstats->SetBytesRead(" << fBytesRead << ");\n";
666 out << " perfstats->SetBytesReadExtra(" << fBytesReadExtra << ");\n";
667 out << " perfstats->SetRealNorm(" << fRealNorm << ");\n";
668 out << " perfstats->SetRealTime(" << fRealTime << ");\n";
669 out << " perfstats->SetCpuTime(" << fCpuTime << ");\n";
670 out << " perfstats->SetDiskTime(" << fDiskTime << ");\n";
671 out << " perfstats->SetUnzipTime(" << fUnzipTime << ");\n";
672 out << " perfstats->SetCompress(" << fCompress << ");\n";
673
674 fGraphIO->SavePrimitive(out, "nodraw");
675 out << " perfstats->SetGraphIO(gre);\n";
676
677 fGraphTime->SavePrimitive(out, "nodraw");
678 out << " perfstats->SetGraphTime(gre);\n";
679
680 SavePrimitiveDraw(out, "perfstats", option);
681}
#define e(i)
Definition RSha256.hxx:103
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
@ kRed
Definition Rtypes.h:67
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
char name[80]
Definition TGX11.cxx:110
#define gROOT
Definition TROOT.h:411
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2495
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
#define gPad
#define gPerfStats
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition TAttAxis.cxx:279
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
Definition TAttAxis.cxx:184
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:42
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition TAttText.h:44
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition TAttText.h:49
A TTree is a list of TBranches.
Definition TBranch.h:93
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4901
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition TDatime.h:37
virtual TFile * GetFile() const
Definition TDirectory.h:221
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:131
static Int_t GetReadaheadSize()
Static function returning the readahead buffer size.
Definition TFile.cxx:4281
Long64_t GetRelOffset() const
Definition TFile.h:330
virtual Long64_t GetBytesReadExtra() const
Definition TFile.h:321
TFileCacheRead * GetCacheRead(const TObject *tree=nullptr) const
Return a pointer to the current read cache.
Definition TFile.cxx:1251
The axis painter class.
Definition TGaxis.h:26
void SetTitleOffset(Float_t titleoffset=1)
Definition TGaxis.h:130
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition TGaxis.cxx:2916
void SetLabelColor(Int_t labelcolor)
Definition TGaxis.h:106
void SetTitleColor(Int_t titlecolor)
Definition TGaxis.h:133
void Paint(Option_t *chopt="") override
Draw this axis with its current attributes.
Definition TGaxis.cxx:985
void SetLabelSize(Float_t labelsize)
Definition TGaxis.h:109
virtual void SetName(const char *name)
Change the name of the axis.
Definition TGaxis.cxx:2878
A TGraphErrors is a TGraph with error bars.
virtual void SetPointError(Double_t ex, Double_t ey)
Set ex and ey values for point pointed by the mouse.
Double_t * GetEY() const override
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition TGraph.cxx:2290
Double_t * GetY() const
Definition TGraph.h:139
void Paint(Option_t *chopt="") override
Draw this graph with its current attributes.
Definition TGraph.cxx:1977
Int_t GetN() const
Definition TGraph.h:131
Double_t * GetX() const
Definition TGraph.h:138
void SetName(const char *name="") override
Set graph name.
Definition TGraph.cxx:2329
TAxis * GetXaxis() const
Get x axis of the graph.
Definition TGraph.cxx:1566
TAxis * GetYaxis() const
Get y axis of the graph.
Definition TGraph.cxx:1575
void SetTitle(const char *title="") override
Change (i.e.
Definition TGraph.cxx:2345
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a graph.
Definition TGraph.cxx:880
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a line.
Definition TLine.cxx:88
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:202
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:203
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition TObject.cxx:875
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
Definition TObject.cxx:822
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
Definition TObject.cxx:771
@ kCanDelete
if object in a list can be deleted
Definition TObject.h:68
A Pave (see TPave) with text, lines or/and boxes inside.
Definition TPaveText.h:21
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
void Paint(Option_t *option="") override
Paint this pavetext with its current attributes.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a pave.
Definition TPave.cxx:207
Stopwatch class.
Definition TStopwatch.h:28
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
Basic string class.
Definition TString.h:138
void ToLower()
Change string to lower-case.
Definition TString.cxx:1189
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
Definition TString.cxx:1121
const char * Data() const
Definition TString.h:384
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
Definition TString.cxx:1159
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:640
virtual TString GetFromPipe(const char *command, Int_t *ret=nullptr, Bool_t redirectStderr=kFALSE)
Execute command and return output in TString.
Definition TSystem.cxx:684
Base class for several text objects.
Definition TText.h:22
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a string.
Definition TText.cxx:143
void Paint(Option_t *option="") override
Paint this text with its current attributes.
Definition TText.cxx:686
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Definition TText.cxx:816
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition TTimeStamp.h:45
A cache to speed-up the reading of ROOT datasets.
Definition TTreeCache.h:32
const TObjArray * GetCachedBranches() const
Definition TTreeCache.h:139
TTree I/O performance measurement.
TGraphErrors * fGraphIO
Pointer to the graph with IO data.
Long64_t fUnzipInputSize
Compressed bytes seen by the decompressor.
TString fName
Name of this TTreePerfStats.
Int_t fNleaves
Number of leaves in the tree.
void Browse(TBrowser *b) override
Browse.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Return distance to one of the objects in the TTreePerfStats.
Double_t fRealNorm
Real time scale factor for fGraphTime.
BasketInfo & GetBasketInfo(TBranch *b, size_t basketNumber)
Return the BasketInfo corresponding to the given branch and basket.
std::vector< std::vector< BasketInfo > > fBasketsInfo
Long64_t fUnzipObjSize
Uncompressed bytes produced by the decompressor.
TStopwatch * fWatch
TStopwatch pointer.
TTree * fTree
! Pointer to the Tree being monitored
TString fHostInfo
Name of the host system, ROOT version and date.
void Print(Option_t *option="") const override
Print the TTree I/O perf stats.
Int_t fReadCalls
Number of read calls.
Long64_t fBytesRead
Number of bytes read.
void UpdateBranchIndices(TObjArray *branchNames) override
Update the fBranchIndexCache collection to match the current TTree given the ordered list of branch n...
BasketList_t GetDuplicateBasketCache() const
Return the collection of baskets which have been read by the TTreeCache more than once.
Double_t fCpuTime
Cpu time.
virtual void Finish()
When the run is finished this function must be called to save the current parameters in the file and ...
const char * GetName() const override
Returns name of object.
void Paint(Option_t *chopt="") override
Draw the TTree I/O perf graph.
std::vector< std::pair< TBranch *, std::vector< size_t > > > BasketList_t
void SaveAs(const char *filename="", Option_t *option="") const override
Save this object to filename.
void FileReadEvent(TFile *file, Int_t len, Double_t start) override
Record TTree file read event.
Double_t fCompress
Tree compression factor.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
static TClass * Class()
void PrintBasketInfo(Option_t *option="") const override
Print the TTree basket information.
void Draw(Option_t *option="") override
Draw the TTree I/O perf graph.
TFile * fFile
! Pointer to the file containing the Tree
const char * GetHostInfo() const
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Return distance to one of the objects in the TTreePerfStats.
Double_t fRealTime
Real time.
Int_t fReadaheadSize
Read-ahead cache size.
std::unordered_map< TBranch *, size_t > fBranchIndexCache
~TTreePerfStats() override
Destructor.
Double_t fDiskTime
Time spent in pure raw disk IO.
TGaxis * fRealTimeAxis
Pointer to TGaxis object showing real-time.
Double_t fUnzipTime
Time spent uncompressing the data.
TPaveText * fPave
Pointer to annotation pavetext.
Int_t fTreeCacheSize
TTreeCache buffer size.
TGraphErrors * fGraphTime
Pointer to the graph with timestamp info.
TText * fHostInfoText
Graphics Text object with the fHostInfo data.
Long64_t fBytesReadExtra
Number of bytes (overhead) of the read-ahead cache.
void UnzipEvent(TObject *tree, Long64_t pos, Double_t start, Int_t complen, Int_t objlen) override
Record TTree unzip event.
TTreePerfStats()
default constructor (used when reading an object only)
A TTree represents a columnar dataset.
Definition TTree.h:89
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition TTree.cxx:5555
TDirectory * GetDirectory() const
Definition TTree.h:501
virtual void SetPerfStats(TVirtualPerfStats *perf)
Set perf stats.
Definition TTree.cxx:9547
virtual Long64_t GetReadEntry() const
Definition TTree.h:588
virtual TTree * GetTree() const
Definition TTree.h:596
TClass * IsA() const override
Definition TTree.h:744
virtual Long64_t GetCacheSize() const
Definition TTree.h:492
Provides the interface for the an internal performance measurement and event tracing.
T MaxElement(Long64_t n, const T *a)
Returns maximum of array a of length n.
Definition TMath.h:979
th1 Draw()