Logo ROOT  
Reference Guide
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 "Riostream.h"
86#include "TFile.h"
87#include "TTree.h"
88#include "TTreeCache.h"
89#include "TAxis.h"
90#include "TBranch.h"
91#include "TBrowser.h"
92#include "TVirtualPad.h"
93#include "TPaveText.h"
94#include "TGraphErrors.h"
95#include "TStopwatch.h"
96#include "TGaxis.h"
97#include "TTimeStamp.h"
98#include "TDatime.h"
99#include "TMath.h"
100
102
103////////////////////////////////////////////////////////////////////////////////
104/// default constructor (used when reading an object only)
105
107{
108 fName = "";
109 fHostInfo = "";
110 fTree = 0;
111 fNleaves = 0;
112 fFile = 0;
113 fGraphIO = 0;
114 fGraphTime = 0;
115 fWatch = 0;
116 fPave = 0;
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;
127 fCompress = 0;
128 fRealTimeAxis = 0;
129 fHostInfoText = 0;
130}
131
132////////////////////////////////////////////////////////////////////////////////
133/// Create a TTree I/O perf stats object.
134
136{
137 fName = name;
138 fTree = T;
139 T->SetPerfStats(this);
140 fNleaves= T->GetListOfLeaves()->GetEntries();
141 fFile = T->GetCurrentFile();
142 fGraphIO = new TGraphErrors(0);
143 fGraphIO->SetName("ioperf");
144 fGraphIO->SetTitle(Form("%s/%s",fFile->GetName(),T->GetName()));
145 fGraphIO->SetUniqueID(999999999);
146 fGraphTime = new TGraphErrors(0);
148 fGraphTime->SetName("iotime");
149 fGraphTime->SetTitle("Real time vs entries");
150 fWatch = new TStopwatch();
151 fWatch->Start();
152 fPave = 0;
153 fTreeCacheSize = 0;
154 fReadCalls = 0;
155 fReadaheadSize = 0;
156 fBytesRead = 0;
158 fRealNorm = 0;
159 fRealTime = 0;
160 fCpuTime = 0;
161 fDiskTime = 0;
162 fUnzipTime = 0;
163 fRealTimeAxis = 0;
164 fCompress = (T->GetTotBytes()+0.00001)/T->GetZipBytes();
165
166 Bool_t isUNIX = strcmp(gSystem->GetName(), "Unix") == 0;
167 if (isUNIX)
168 fHostInfo = gSystem->GetFromPipe("uname -a");
169 else
170 fHostInfo = "Windows ";
171 fHostInfo.Resize(20);
172 fHostInfo += TString::Format("ROOT %s, Git: %s", gROOT->GetVersion(), gROOT->GetGitCommit());
173 TDatime dt;
174 fHostInfo += TString::Format(" %s",dt.AsString());
175 fHostInfoText = 0;
176
177 gPerfStats = this;
178}
179
180////////////////////////////////////////////////////////////////////////////////
181/// Destructor
182
184{
185 fTree = 0;
186 fFile = 0;
187 delete fGraphIO;
188 delete fGraphTime;
189 delete fPave;
190 delete fWatch;
191 delete fRealTimeAxis;
192 delete fHostInfoText;
193
194 if (gPerfStats == this) {
195 gPerfStats = 0;
196 }
197}
198
199
200////////////////////////////////////////////////////////////////////////////////
201/// Browse
202
204{
205 Draw();
206 gPad->Update();
207}
208
209////////////////////////////////////////////////////////////////////////////////
210/// Return distance to one of the objects in the TTreePerfStats
211
213{
214 const Int_t kMaxDiff = 7;
215 Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
216 Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
217 Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
218 Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
219 if (py < puymax) return 9999;
220 //on the fGraphIO ?
221 Int_t distance = fGraphIO->DistancetoPrimitive(px,py);
222 if (distance <kMaxDiff) {if (px > puxmin && py < puymin) gPad->SetSelected(fGraphIO); return distance;}
223 // on the fGraphTime ?
224 distance = fGraphTime->DistancetoPrimitive(px,py);
225 if (distance <kMaxDiff) {if (px > puxmin && py < puymin) gPad->SetSelected(fGraphTime); return distance;}
226 // on the pave ?
227 distance = fPave->DistancetoPrimitive(px,py);
228 if (distance <kMaxDiff) {gPad->SetSelected(fPave); return distance;}
229 // on the real time axis ?
230 distance = fRealTimeAxis->DistancetoPrimitive(px,py);
231 if (distance <kMaxDiff) {gPad->SetSelected(fRealTimeAxis); return distance;}
232 // on the host info label ?
233 distance = fHostInfoText->DistancetoPrimitive(px,py);
234 if (distance <kMaxDiff) {gPad->SetSelected(fHostInfoText); return distance;}
235 if (px > puxmax-300) return 2;
236 return 999;
237}
238
239////////////////////////////////////////////////////////////////////////////////
240/// Draw the TTree I/O perf graph.
241/// by default the graph is drawn with option "al"
242/// Specify option ="ap" to show only the read blocks and not the line
243/// connecting the blocks
244
246{
247 Finish();
248
249 TString opt = option;
250 if (strlen(option)==0) opt = "al";
251 opt.ToLower();
252 if (gPad) {
253 if (!gPad->IsEditable()) gROOT->MakeDefCanvas();
254 //the following statement is necessary in case one attempts to draw
255 //a temporary histogram already in the current pad
256 if (TestBit(kCanDelete)) gPad->GetListOfPrimitives()->Remove(this);
257 } else {
258 gROOT->MakeDefCanvas();
259 }
260 if (opt.Contains("a")) {
261 gPad->SetLeftMargin(0.35);
262 gPad->Clear();
263 gPad->SetGridx();
264 gPad->SetGridy();
265 }
266 AppendPad(opt.Data());
267}
268
269////////////////////////////////////////////////////////////////////////////////
270/// Return distance to one of the objects in the TTreePerfStats
271
272void TTreePerfStats::ExecuteEvent(Int_t /*event*/, Int_t /*px*/, Int_t /*py*/)
273{
274}
275
276////////////////////////////////////////////////////////////////////////////////
277/// Record TTree file read event.
278/// - start is the TimeStamp before reading
279/// - len is the number of bytes read
280
282{
283 if (file == this->fFile){
284 Long64_t offset = file->GetRelOffset();
285 Int_t np = fGraphIO->GetN();
286 Int_t entry = fTree->GetReadEntry();
287 fGraphIO->SetPoint(np,entry,1e-6*offset);
288 fGraphIO->SetPointError(np,0.001,1e-9*len);
289 Double_t tnow = TTimeStamp();
290 Double_t dtime = tnow-start;
291 fDiskTime += dtime;
292 fGraphTime->SetPoint(np,entry,tnow);
293 fGraphTime->SetPointError(np,0.001,dtime);
294 fReadCalls++;
295 fBytesRead += len;
296 }
297}
298
299
300////////////////////////////////////////////////////////////////////////////////
301/// Record TTree unzip event.
302/// - start is the TimeStamp before unzip
303/// - pos is where in the file the compressed buffer came from
304/// - complen is the length of the compressed buffer
305/// - objlen is the length of the de-compressed buffer
306
307void TTreePerfStats::UnzipEvent(TObject * tree, Long64_t /* pos */, Double_t start, Int_t /* complen */, Int_t /* objlen */)
308{
309 if (tree == this->fTree){
310 Double_t tnow = TTimeStamp();
311 Double_t dtime = tnow-start;
312 fUnzipTime += dtime;
313 }
314}
315
316////////////////////////////////////////////////////////////////////////////////
317/// When the run is finished this function must be called
318/// to save the current parameters in the file and Tree in this object
319/// the function is automatically called by Draw and Print
320
322{
323 if (fRealNorm) return; //has already been called
324 if (!fFile) return;
325 if (!fTree) return;
331 Int_t npoints = fGraphIO->GetN();
332 if (!npoints) return;
333 Double_t iomax = TMath::MaxElement(npoints,fGraphIO->GetY());
334 fRealNorm = iomax/fRealTime;
336 // we normalize the fGraphTime such that it can be drawn on top of fGraphIO
337 for (Int_t i=1;i<npoints;i++) {
338 fGraphTime->GetY()[i] = fGraphTime->GetY()[i-1] +fRealNorm*fGraphTime->GetEY()[i];
339 fGraphTime->GetEY()[i] = 0;
340 }
341}
342
343////////////////////////////////////////////////////////////////////////////////
344/// Update the fBranchIndexCache collection to match the current TTree given
345/// the ordered list of branch names.
346
348{
349 fBranchIndexCache.clear();
350
351 for (int i = 0; i < branches->GetEntries(); ++i) {
352 fBranchIndexCache.emplace((TBranch*)(branches->UncheckedAt(i)), i);
353 }
354}
355
356////////////////////////////////////////////////////////////////////////////////
357/// Return the BasketInfo corresponding to the given branch and basket.
358
360{
361 static BasketInfo fallback;
362
363 // First find the branch index.
365 if (!file)
366 return fallback;
367
368 TTreeCache *cache = dynamic_cast<TTreeCache *>(file->GetCacheRead(fTree));
369 if (!cache)
370 return fallback;
371
372 Int_t index = -1;
373 auto iter = fBranchIndexCache.find(br);
374 if (iter == fBranchIndexCache.end()) {
375 auto branches = cache->GetCachedBranches();
376 for (Int_t i = 0; i < branches->GetEntries(); ++i) {
377 if (br == branches->UncheckedAt(i)) {
378 index = i;
379 break;
380 }
381 }
382 if (index < 0)
383 return fallback;
384 fBranchIndexCache.emplace(br, index);
385 } else {
386 index = iter->second;
387 }
388
389 return GetBasketInfo(index, basketNumber);
390}
391
392////////////////////////////////////////////////////////////////////////////////
393/// Return the BasketInfo corresponding to the given branch and basket.
394
396{
397 if (fBasketsInfo.size() <= (size_t)index)
398 fBasketsInfo.resize(index + 1);
399
400 auto &brvec(fBasketsInfo[index]);
401 if (brvec.size() <= basketNumber)
402 brvec.resize(basketNumber + 1);
403
404 return brvec[basketNumber];
405}
406
407////////////////////////////////////////////////////////////////////////////////
408/// Return the collection of baskets which have been read by the TTreeCache more
409/// than once
410
412{
413 BasketList_t result;
414
416 if (!file)
417 return result;
418
419 TTreeCache *cache = dynamic_cast<TTreeCache *>(file->GetCacheRead(fTree));
420 if (!cache)
421 return result;
422
423 auto branches = cache->GetCachedBranches();
424 for (size_t i = 0; i < fBasketsInfo.size(); ++i) {
426 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
427 auto &info(fBasketsInfo[i][j]);
428 if ((info.fLoaded + info.fLoadedMiss) > 1) {
429 if (first) {
430 result.emplace_back(BasketList_t::value_type((TBranch*)branches->At(i), std::vector<size_t>(1)));;
431 first = false;
432 }
433 auto &ref( result.back() );
434 ref.second.push_back(j);
435 }
436 }
437 }
438
439 return result;
440}
441
442////////////////////////////////////////////////////////////////////////////////
443/// Draw the TTree I/O perf graph.
444
446{
447 Int_t npoints = fGraphIO->GetN();
448 if (!npoints) return;
449 Double_t iomax = fGraphIO->GetY()[npoints-1];
450 Double_t toffset=1;
451 if (iomax >= 1e9) toffset = 1.2;
452 fGraphIO->GetXaxis()->SetTitle("Tree entry number");
453 fGraphIO->GetYaxis()->SetTitle("file position (MBytes) ");
454 fGraphIO->GetYaxis()->SetTitleOffset(toffset);
457 fGraphIO->Paint(option);
458
459 TString opts(option);
460 opts.ToLower();
461 Bool_t unzip = opts.Contains("unzip");
462
463 //superimpose the time info (max 10 points)
464 if (fGraphTime) {
465 fGraphTime->Paint("l");
466 TText tdisk(fGraphTime->GetX()[npoints-1],1.1*fGraphTime->GetY()[npoints-1],"RAW IO");
467 tdisk.SetTextAlign(31);
468 tdisk.SetTextSize(0.03);
469 tdisk.SetTextColor(kRed);
470 tdisk.Paint();
471 if (!fRealTimeAxis) {
472 Double_t uxmax = gPad->GetUxmax();
473 Double_t uymax = gPad->GetUymax();
474 Double_t rtmax = uymax/fRealNorm;
475 fRealTimeAxis = new TGaxis(uxmax,0,uxmax,uymax,0.,rtmax,510,"+L");
476 fRealTimeAxis->SetName("RealTimeAxis");
478 fRealTimeAxis->SetTitle("RealTime (s) ");
480 toffset = 1;
481 if (fRealTime >= 100) toffset = 1.2;
482 if (fRealTime >= 1000) toffset = 1.4;
486 }
488 }
489
491 if (!fPave) {
492 fPave = new TPaveText(.01,.10,.24,.90,"brNDC");
493 fPave->SetTextAlign(12);
494 fPave->AddText(Form("TreeCache = %d MB",fTreeCacheSize/1000000));
495 fPave->AddText(Form("N leaves = %d",fNleaves));
496 fPave->AddText(Form("ReadTotal = %g MB",1e-6*fBytesRead));
497 fPave->AddText(Form("ReadUnZip = %g MB",1e-6*fBytesRead*fCompress));
498 fPave->AddText(Form("ReadCalls = %d",fReadCalls));
499 fPave->AddText(Form("ReadSize = %7.3f KB",0.001*fBytesRead/fReadCalls));
500 fPave->AddText(Form("Readahead = %d KB",fReadaheadSize/1000));
501 fPave->AddText(Form("Readextra = %5.2f per cent",extra));
502 fPave->AddText(Form("Real Time = %7.3f s",fRealTime));
503 fPave->AddText(Form("CPU Time = %7.3f s",fCpuTime));
504 fPave->AddText(Form("Disk Time = %7.3f s",fDiskTime));
505 if (unzip) {
506 fPave->AddText(Form("UnzipTime = %7.3f s",fUnzipTime));
507 }
508 fPave->AddText(Form("Disk IO = %7.3f MB/s",1e-6*fBytesRead/fDiskTime));
509 fPave->AddText(Form("ReadUZRT = %7.3f MB/s",1e-6*fCompress*fBytesRead/fRealTime));
510 fPave->AddText(Form("ReadUZCP = %7.3f MB/s",1e-6*fCompress*fBytesRead/fCpuTime));
511 fPave->AddText(Form("ReadRT = %7.3f MB/s",1e-6*fBytesRead/fRealTime));
512 fPave->AddText(Form("ReadCP = %7.3f MB/s",1e-6*fBytesRead/fCpuTime));
513 }
514 fPave->Paint();
515
516 if (!fHostInfoText) {
517 fHostInfoText = new TText(0.01,0.01,fHostInfo.Data());
520 }
522}
523
524////////////////////////////////////////////////////////////////////////////////
525/// Print the TTree I/O perf stats.
526
527void TTreePerfStats::Print(Option_t * option) const
528{
529 TString opts(option);
530 opts.ToLower();
531 Bool_t unzip = opts.Contains("unzip");
532 Bool_t basket = opts.Contains("basket");
534 ps->Finish();
535
537 printf("TreeCache = %d MBytes\n",Int_t(fTreeCacheSize/1000000));
538 printf("N leaves = %d\n",fNleaves);
539 printf("ReadTotal = %g MBytes\n",1e-6*fBytesRead);
540 printf("ReadUnZip = %g MBytes\n",1e-6*fBytesRead*fCompress);
541 printf("ReadCalls = %d\n",fReadCalls);
542 printf("ReadSize = %7.3f KBytes/read\n",0.001*fBytesRead/fReadCalls);
543 printf("Readahead = %d KBytes\n",fReadaheadSize/1000);
544 printf("Readextra = %5.2f per cent\n",extra);
545 printf("Real Time = %7.3f seconds\n",fRealTime);
546 printf("CPU Time = %7.3f seconds\n",fCpuTime);
547 printf("Disk Time = %7.3f seconds\n",fDiskTime);
548 if (unzip) {
549 printf("Strm Time = %7.3f seconds\n",fCpuTime-fUnzipTime);
550 printf("UnzipTime = %7.3f seconds\n",fUnzipTime);
551 }
552 printf("Disk IO = %7.3f MBytes/s\n",1e-6*fBytesRead/fDiskTime);
553 printf("ReadUZRT = %7.3f MBytes/s\n",1e-6*fCompress*fBytesRead/fRealTime);
554 printf("ReadUZCP = %7.3f MBytes/s\n",1e-6*fCompress*fBytesRead/fCpuTime);
555 printf("ReadRT = %7.3f MBytes/s\n",1e-6*fBytesRead/fRealTime);
556 printf("ReadCP = %7.3f MBytes/s\n",1e-6*fBytesRead/fCpuTime);
557 if (unzip) {
558 printf("ReadStrCP = %7.3f MBytes/s\n",1e-6*fCompress*fBytesRead/(fCpuTime-fUnzipTime));
559 printf("ReadZipCP = %7.3f MBytes/s\n",1e-6*fCompress*fBytesRead/fUnzipTime);
560 }
561 if (basket)
562 PrintBasketInfo(option);
563}
564
565////////////////////////////////////////////////////////////////////////////////
566/// Print the TTree basket information
567
569{
570
571 TString opts(option);
572 opts.ToLower();
573 Bool_t all = opts.Contains("allbasketinfo");
574
576 if (!file)
577 return;
578
579 TTreeCache *cache = dynamic_cast<TTreeCache *>(file->GetCacheRead(fTree));
580 if (!cache)
581 return;
582
583 auto branches = cache->GetCachedBranches();
584 for (size_t i = 0; i < fBasketsInfo.size(); ++i) {
585 const char *branchname = branches->At(i)->GetName();
586
587 printf(" br=%zu %s read not cached: ", i, branchname);
588 if (fBasketsInfo[i].size() == 0) {
589 printf("none");
590 } else
591 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
592 if (fBasketsInfo[i][j].fMissed)
593 printf("%zu ", j);
594 }
595 printf("\n");
596
597 printf(" br=%zu %s cached more than once: ", i, branchname);
598 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
599 auto &info(fBasketsInfo[i][j]);
600 if ((info.fLoaded + info.fLoadedMiss) > 1)
601 printf("%zu[%d,%d] ", j, info.fLoaded, info.fLoadedMiss);
602 }
603 printf("\n");
604
605 printf(" br=%zu %s cached but not used: ", i, branchname);
606 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
607 auto &info(fBasketsInfo[i][j]);
608 if ((info.fLoaded + info.fLoadedMiss) && !info.fUsed) {
609 if (info.fLoadedMiss)
610 printf("%zu[%d,%d] ", j, info.fLoaded, info.fLoadedMiss);
611 else
612 printf("%zu ", j);
613 }
614 }
615 printf("\n");
616
617 if (all) {
618 printf(" br=%zu %s: ", i, branchname);
619 for (size_t j = 0; j < fBasketsInfo[i].size(); ++j) {
620 auto &info(fBasketsInfo[i][j]);
621 printf("%zu[%d,%d,%d,%d] ", j, info.fUsed, info.fLoaded, info.fLoadedMiss, info.fMissed);
622 }
623 printf("\n");
624 }
625 }
626 for (Int_t i = fBasketsInfo.size(); i < branches->GetEntries(); ++i) {
627 printf(" br=%d %s: no basket information\n", i, branches->At(i)->GetName());
628 }
629}
630
631////////////////////////////////////////////////////////////////////////////////
632/// Save this object to filename
633
634void TTreePerfStats::SaveAs(const char *filename, Option_t * /*option*/) const
635{
637 ps->Finish();
638 ps->TObject::SaveAs(filename);
639}
640
641////////////////////////////////////////////////////////////////////////////////
642/// Save primitive as a C++ statement(s) on output stream out
643
644void TTreePerfStats::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
645{
646 char quote = '"';
647 out<<" "<<std::endl;
648 if (gROOT->ClassSaved(TTreePerfStats::Class())) {
649 out<<" ";
650 } else {
651 out<<" TTreePerfStats *";
652 }
653 out<<"ps = new TTreePerfStats();"<<std::endl;
654 out<<" ps->SetName("<<quote<<GetName()<<quote<<");"<<std::endl;
655 out<<" ps->SetHostInfo("<<quote<<GetHostInfo()<<quote<<");"<<std::endl;
656 out<<" ps->SetTreeCacheSize("<<fTreeCacheSize<<");"<<std::endl;
657 out<<" ps->SetNleaves("<<fNleaves<<");"<<std::endl;
658 out<<" ps->SetReadCalls("<<fReadCalls<<");"<<std::endl;
659 out<<" ps->SetReadaheadSize("<<fReadaheadSize<<");"<<std::endl;
660 out<<" ps->SetBytesRead("<<fBytesRead<<");"<<std::endl;
661 out<<" ps->SetBytesReadExtra("<<fBytesReadExtra<<");"<<std::endl;
662 out<<" ps->SetRealNorm("<<fRealNorm<<");"<<std::endl;
663 out<<" ps->SetRealTime("<<fRealTime<<");"<<std::endl;
664 out<<" ps->SetCpuTime("<<fCpuTime<<");"<<std::endl;
665 out<<" ps->SetDiskTime("<<fDiskTime<<");"<<std::endl;
666 out<<" ps->SetUnzipTime("<<fUnzipTime<<");"<<std::endl;
667 out<<" ps->SetCompress("<<fCompress<<");"<<std::endl;
668
669 Int_t i, npoints = fGraphIO->GetN();
670 out<<" TGraphErrors *psGraphIO = new TGraphErrors("<<npoints<<");"<<std::endl;
671 out<<" psGraphIO->SetName("<<quote<<fGraphIO->GetName()<<quote<<");"<<std::endl;
672 out<<" psGraphIO->SetTitle("<<quote<<fGraphIO->GetTitle()<<quote<<");"<<std::endl;
673 out<<" ps->SetGraphIO(psGraphIO);"<<std::endl;
674 fGraphIO->SaveFillAttributes(out,"psGraphIO",0,1001);
675 fGraphIO->SaveLineAttributes(out,"psGraphIO",1,1,1);
676 fGraphIO->SaveMarkerAttributes(out,"psGraphIO",1,1,1);
677 for (i=0;i<npoints;i++) {
678 out<<" psGraphIO->SetPoint("<<i<<","<<fGraphIO->GetX()[i]<<","<<fGraphIO->GetY()[i]<<");"<<std::endl;
679 out<<" psGraphIO->SetPointError("<<i<<",0,"<<fGraphIO->GetEY()[i]<<");"<<std::endl;
680 }
681 npoints = fGraphTime->GetN();
682 out<<" TGraphErrors *psGraphTime = new TGraphErrors("<<npoints<<");"<<std::endl;
683 out<<" psGraphTime->SetName("<<quote<<fGraphTime->GetName()<<quote<<");"<<std::endl;
684 out<<" psGraphTime->SetTitle("<<quote<<fGraphTime->GetTitle()<<quote<<");"<<std::endl;
685 out<<" ps->SetGraphTime(psGraphTime);"<<std::endl;
686 fGraphTime->SaveFillAttributes(out,"psGraphTime",0,1001);
687 fGraphTime->SaveLineAttributes(out,"psGraphTime",1,1,1);
688 fGraphTime->SaveMarkerAttributes(out,"psGraphTime",1,1,1);
689 for (i=0;i<npoints;i++) {
690 out<<" psGraphTime->SetPoint("<<i<<","<<fGraphTime->GetX()[i]<<","<<fGraphTime->GetY()[i]<<");"<<std::endl;
691 out<<" psGraphTime->SetPointError("<<i<<",0,"<<fGraphTime->GetEY()[i]<<");"<<std::endl;
692 }
693
694 out<<" ps->Draw("<<quote<<option<<quote<<");"<<std::endl;
695}
void Class()
Definition: Class.C:29
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:43
double Double_t
Definition: RtypesCore.h:57
long long Long64_t
Definition: RtypesCore.h:71
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassImp(name)
Definition: Rtypes.h:361
@ kRed
Definition: Rtypes.h:64
char name[80]
Definition: TGX11.cxx:109
#define gROOT
Definition: TROOT.h:406
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Definition: TSystem.h:556
#define gPad
Definition: TVirtualPad.h:287
#define gPerfStats
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition: TAttAxis.cxx:294
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
Definition: TAttAxis.cxx:204
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
Definition: TAttFill.cxx:234
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Definition: TAttLine.cxx:270
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
Save line attributes as C++ statement(s) on output stream out.
Definition: TAttMarker.cxx:339
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:41
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition: TAttText.h:43
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46
A TTree is a list of TBranches.
Definition: TBranch.h:91
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:37
const char * AsString() const
Return the date & time as a string (ctime() format).
Definition: TDatime.cxx:101
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:53
static Int_t GetReadaheadSize()
Static function returning the readahead buffer size.
Definition: TFile.cxx:4434
virtual Long64_t GetBytesReadExtra() const
Definition: TFile.h:233
The axis painter class.
Definition: TGaxis.h:24
virtual void Paint(Option_t *chopt="")
Draw this axis with its current attributes.
Definition: TGaxis.cxx:933
void SetTitleOffset(Float_t titleoffset=1)
Definition: TGaxis.h:125
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition: TGaxis.cxx:2694
void SetLabelColor(Int_t labelcolor)
Definition: TGaxis.h:105
void SetTitleColor(Int_t titlecolor)
Definition: TGaxis.h:128
void SetLabelSize(Float_t labelsize)
Definition: TGaxis.h:108
virtual void SetName(const char *name)
Change the name of the axis.
Definition: TGaxis.cxx:2656
A TGraphErrors is a TGraph with error bars.
Definition: TGraphErrors.h:26
virtual void SetPointError(Double_t ex, Double_t ey)
Set ex and ey values for point pointed by the mouse.
Double_t * GetEY() const
Definition: TGraphErrors.h:68
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition: TGraph.cxx:2269
Double_t * GetY() const
Definition: TGraph.h:131
virtual void SetName(const char *name="")
Set graph name.
Definition: TGraph.cxx:2308
Int_t GetN() const
Definition: TGraph.h:123
virtual void SetTitle(const char *title="")
Change (i.e.
Definition: TGraph.cxx:2324
Double_t * GetX() const
Definition: TGraph.h:130
virtual void Paint(Option_t *chopt="")
Draw this graph with its current attributes.
Definition: TGraph.cxx:2030
TAxis * GetXaxis() const
Get x axis of the graph.
Definition: TGraph.cxx:1626
TAxis * GetYaxis() const
Get y axis of the graph.
Definition: TGraph.cxx:1636
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a graph.
Definition: TGraph.cxx:804
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
Definition: TLine.cxx:76
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
An array of TObjects.
Definition: TObjArray.h:37
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:523
TObject * UncheckedAt(Int_t i) const
Definition: TObjArray.h:90
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:105
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition: TObject.cxx:705
@ kCanDelete
if object in a list can be deleted
Definition: TObject.h:58
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.
Definition: TPaveText.cxx:182
virtual void Paint(Option_t *option="")
Paint this pavetext with its current attributes.
Definition: TPaveText.cxx:410
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
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...
Definition: TStopwatch.cxx:110
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Definition: TStopwatch.cxx:58
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
Definition: TStopwatch.cxx:125
Basic string class.
Definition: TString.h:131
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
const char * Data() const
Definition: TString.h:364
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
Definition: TString.cxx:1095
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:2311
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
virtual TString GetFromPipe(const char *command)
Execute command and return output in TString.
Definition: TSystem.cxx:678
Base class for several text objects.
Definition: TText.h:23
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a string.
Definition: TText.cxx:144
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Definition: TText.cxx:813
virtual void Paint(Option_t *option="")
Paint this text with its current attributes.
Definition: TText.cxx:680
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition: TTimeStamp.h:71
A cache to speed-up the reading of ROOT datasets.
Definition: TTreeCache.h:35
const TObjArray * GetCachedBranches() const
Definition: TTreeCache.h:142
TTree I/O performance measurement.
TGraphErrors * fGraphIO
pointer to the Tree being monitored
virtual void Print(Option_t *option="") const
Print the TTree I/O perf stats.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual void Draw(Option_t *option="")
Draw the TTree I/O perf graph.
const char * GetName() const
Returns name of object.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Return distance to one of the objects in the TTreePerfStats.
Double_t fRealNorm
BasketInfo & GetBasketInfo(TBranch *b, size_t basketNumber)
Return the BasketInfo corresponding to the given branch and basket.
std::vector< std::vector< BasketInfo > > fBasketsInfo
TStopwatch * fWatch
TTree * fTree
pointer to the file containing the Tree
virtual void UpdateBranchIndices(TObjArray *branchNames)
Update the fBranchIndexCache collection to match the current TTree given the ordered list of branch n...
Long64_t fBytesRead
virtual void Paint(Option_t *chopt="")
Draw the TTree I/O perf graph.
BasketList_t GetDuplicateBasketCache() const
Return the collection of baskets which have been read by the TTreeCache more than once.
Double_t fCpuTime
virtual void Finish()
When the run is finished this function must be called to save the current parameters in the file and ...
Double_t fCompress
const char * GetHostInfo() const
Double_t fRealTime
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save this object to filename.
virtual void UnzipEvent(TObject *tree, Long64_t pos, Double_t start, Int_t complen, Int_t objlen)
Record TTree unzip event.
std::unordered_map< TBranch *, size_t > fBranchIndexCache
virtual void Browse(TBrowser *b)
Browse.
Double_t fDiskTime
virtual void PrintBasketInfo(Option_t *option="") const
Print the TTree basket information.
TGaxis * fRealTimeAxis
Double_t fUnzipTime
std::vector< std::pair< TBranch *, std::vector< size_t > > > BasketList_t
TPaveText * fPave
TGraphErrors * fGraphTime
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Return distance to one of the objects in the TTreePerfStats.
virtual ~TTreePerfStats()
Destructor.
TText * fHostInfoText
Long64_t fBytesReadExtra
TTreePerfStats()
default constructor (used when reading an object only)
virtual void FileReadEvent(TFile *file, Int_t len, Double_t start)
Record TTree file read event.
A TTree represents a columnar dataset.
Definition: TTree.h:78
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition: TTree.cxx:5383
virtual Long64_t GetReadEntry() const
Definition: TTree.h:503
virtual Long64_t GetCacheSize() const
Definition: TTree.h:447
Provides the interface for the PROOF internal performance measurement and event tracing.
double T(double x)
Definition: ChebyshevPol.h:34
static constexpr double ps
T MaxElement(Long64_t n, const T *a)
Return maximum of array a of length n.
Definition: TMath.h:949
Definition: file.py:1
Definition: first.py:1
Definition: tree.py:1