ATLAS Offline Software
Classes | Functions
main_benchmark.cxx File Reference
#include "LWHists/LWHistControls.h"
#include "TH1I.h"
#include "LWHists/TH1I_LW.h"
#include "TH1F.h"
#include "LWHists/TH1F_LW.h"
#include "TH1D.h"
#include "LWHists/TH1D_LW.h"
#include "TH2F.h"
#include "LWHists/TH2F_LW.h"
#include "TH2D.h"
#include "LWHists/TH2D_LW.h"
#include "TH2I.h"
#include "LWHists/TH2I_LW.h"
#include "TProfile.h"
#include "LWHists/TProfile_LW.h"
#include "TProfile2D.h"
#include "LWHists/TProfile2D_LW.h"
#include "TRandom3.h"
#include <iostream>
#include <sstream>
#include <ctime>
#include <climits>
#include <cstdlib>

Go to the source code of this file.

Classes

struct  Timer
 
struct  MemCheck
 

Functions

long long thisProcess_VirtualMemUsed_kB ()
 
double vmemUsedMB ()
 
template<class T >
std::string histClassName ()
 
template<>
std::string histClassName< TH1I > ()
 
template<>
std::string histClassName< TH1I_LW > ()
 
template<>
std::string histClassName< TH1F > ()
 
template<>
std::string histClassName< TH1F_LW > ()
 
template<>
std::string histClassName< TH1D > ()
 
template<>
std::string histClassName< TH1D_LW > ()
 
template<>
std::string histClassName< TH2I > ()
 
template<>
std::string histClassName< TH2I_LW > ()
 
template<>
std::string histClassName< TH2F > ()
 
template<>
std::string histClassName< TH2F_LW > ()
 
template<>
std::string histClassName< TH2D > ()
 
template<>
std::string histClassName< TH2D_LW > ()
 
template<>
std::string histClassName< TProfile > ()
 
template<>
std::string histClassName< TProfile_LW > ()
 
template<>
std::string histClassName< TProfile2D > ()
 
template<>
std::string histClassName< TProfile2D_LW > ()
 
double getRandX (TRandom &rand)
 
template<class T >
void fillX (TRandom &rand, T *t)
 
template<class T >
void fillXW (TRandom &rand, T *t)
 
template<>
void fillX (TRandom &rand, TH2F *t)
 
template<>
void fillX (TRandom &rand, TH2D *t)
 
template<>
void fillX (TRandom &rand, TH2I *t)
 
template<>
void fillX (TRandom &rand, TH2F_LW *t)
 
template<>
void fillX (TRandom &rand, TH2D_LW *t)
 
template<>
void fillX (TRandom &rand, TH2I_LW *t)
 
template<>
void fillX (TRandom &rand, TProfile *t)
 
template<>
void fillX (TRandom &rand, TProfile_LW *t)
 
template<>
void fillX (TRandom &rand, TProfile2D *t)
 
template<>
void fillX (TRandom &rand, TProfile2D_LW *t)
 
template<>
void fillXW (TRandom &rand, TH2F *t)
 
template<>
void fillXW (TRandom &rand, TH2D *t)
 
template<>
void fillXW (TRandom &rand, TH2I *t)
 
template<>
void fillXW (TRandom &rand, TH2F_LW *t)
 
template<>
void fillXW (TRandom &rand, TH2D_LW *t)
 
template<>
void fillXW (TRandom &rand, TH2I_LW *t)
 
template<>
void fillXW (TRandom &rand, TProfile *t)
 
template<>
void fillXW (TRandom &rand, TProfile_LW *t)
 
template<>
void fillXW (TRandom &rand, TProfile2D *t)
 
template<>
void fillXW (TRandom &rand, TProfile2D_LW *t)
 
template<class T >
void fakeFillRandGen (TRandom &rand)
 
template<>
void fakeFillRandGen< TH2F > (TRandom &rand)
 
template<>
void fakeFillRandGen< TH2D > (TRandom &rand)
 
template<>
void fakeFillRandGen< TH2I > (TRandom &rand)
 
template<>
void fakeFillRandGen< TH2F_LW > (TRandom &rand)
 
template<>
void fakeFillRandGen< TH2D_LW > (TRandom &rand)
 
template<>
void fakeFillRandGen< TH2I_LW > (TRandom &rand)
 
template<class T >
T * book (const std::string &n, const std::string &t, unsigned nbins)
 
template<>
TH1F_LWbook (const std::string &n, const std::string &t, unsigned nbins)
 
template<class T >
void triggerConversion (T *)
 
template<>
void triggerConversion (TH1F_LW *h)
 
template<>
void triggerConversion (TH1D_LW *h)
 
template<>
void triggerConversion (TH1I_LW *h)
 
template<>
void triggerConversion (TH2F_LW *h)
 
template<>
void triggerConversion (TH2D_LW *h)
 
template<>
void triggerConversion (TH2I_LW *h)
 
template<>
void triggerConversion (TProfile_LW *h)
 
template<>
void triggerConversion (TProfile2D_LW *h)
 
template<class T >
bool isROOT ()
 
template<>
bool isROOT< TH1F_LW > ()
 
template<>
bool isROOT< TH1D_LW > ()
 
template<>
bool isROOT< TH1I_LW > ()
 
template<>
bool isROOT< TH2F_LW > ()
 
template<>
bool isROOT< TH2D_LW > ()
 
template<>
bool isROOT< TH2I_LW > ()
 
template<>
bool isROOT< TProfile_LW > ()
 
template<>
bool isROOT< TProfile2D_LW > ()
 
template<class T >
void safeDelete (T *h)
 
template<class T >
int performBenchmark (TRandom &rand, const unsigned nhists, const unsigned nbins, const int nfills)
 
int usage (const std::string &progname)
 
int main (int argc, char **argv)
 

Function Documentation

◆ book() [1/2]

template<class T >
T* book ( const std::string &  n,
const std::string &  t,
unsigned  nbins 
)

Definition at line 138 of file main_benchmark.cxx.

139 {T*h=new T(n.c_str(),t.c_str(),nbins,0.0,100.0);
140  h->Sumw2();//TODO monitor sumw2!!
141  return h; }

◆ book() [2/2]

template<>
TProfile2D_LW * book ( const std::string &  n,
const std::string &  t,
unsigned  nbins 
)

Definition at line 144 of file main_benchmark.cxx.

145 { return TH1F_LW::create(n.c_str(),t.c_str(),nbins,0.0,100.0); }

◆ fakeFillRandGen()

template<class T >
void fakeFillRandGen ( TRandom &  rand)

Definition at line 130 of file main_benchmark.cxx.

130 { getRandX(rand); }

◆ fakeFillRandGen< TH2D >()

template<>
void fakeFillRandGen< TH2D > ( TRandom &  rand)

Definition at line 132 of file main_benchmark.cxx.

132 { getRandX(rand);getRandX(rand); }

◆ fakeFillRandGen< TH2D_LW >()

template<>
void fakeFillRandGen< TH2D_LW > ( TRandom &  rand)

Definition at line 135 of file main_benchmark.cxx.

135 { getRandX(rand);getRandX(rand); }

◆ fakeFillRandGen< TH2F >()

template<>
void fakeFillRandGen< TH2F > ( TRandom &  rand)

Definition at line 131 of file main_benchmark.cxx.

131 { getRandX(rand);getRandX(rand); }

◆ fakeFillRandGen< TH2F_LW >()

template<>
void fakeFillRandGen< TH2F_LW > ( TRandom &  rand)

Definition at line 134 of file main_benchmark.cxx.

134 { getRandX(rand);getRandX(rand); }

◆ fakeFillRandGen< TH2I >()

template<>
void fakeFillRandGen< TH2I > ( TRandom &  rand)

Definition at line 133 of file main_benchmark.cxx.

133 { getRandX(rand);getRandX(rand); }

◆ fakeFillRandGen< TH2I_LW >()

template<>
void fakeFillRandGen< TH2I_LW > ( TRandom &  rand)

Definition at line 136 of file main_benchmark.cxx.

136 { getRandX(rand);getRandX(rand); }

◆ fillX() [1/11]

template<class T >
void fillX ( TRandom &  rand,
T *  t 
)

Definition at line 107 of file main_benchmark.cxx.

107 { t->Fill(getRandX(rand)); }

◆ fillX() [2/11]

template<>
void fillX ( TRandom &  rand,
TH2D t 
)

Definition at line 110 of file main_benchmark.cxx.

110 { t->Fill(getRandX(rand),15.0); }

◆ fillX() [3/11]

template<>
void fillX ( TRandom &  rand,
TH2D_LW t 
)

Definition at line 113 of file main_benchmark.cxx.

113 { t->Fill(getRandX(rand),15.0); }

◆ fillX() [4/11]

template<>
void fillX ( TRandom &  rand,
TH2F t 
)

Definition at line 109 of file main_benchmark.cxx.

109 { t->Fill(getRandX(rand),15.0); }

◆ fillX() [5/11]

template<>
void fillX ( TRandom &  rand,
TH2F_LW t 
)

Definition at line 112 of file main_benchmark.cxx.

112 { t->Fill(getRandX(rand),15.0); }

◆ fillX() [6/11]

template<>
void fillX ( TRandom &  rand,
TH2I t 
)

Definition at line 111 of file main_benchmark.cxx.

111 { t->Fill(getRandX(rand),15.0); }

◆ fillX() [7/11]

template<>
void fillX ( TRandom &  rand,
TH2I_LW t 
)

Definition at line 114 of file main_benchmark.cxx.

114 { t->Fill(getRandX(rand),15.0); }

◆ fillX() [8/11]

template<>
void fillX ( TRandom &  rand,
TProfile t 
)

Definition at line 115 of file main_benchmark.cxx.

115 { t->Fill(getRandX(rand),15.0); }

◆ fillX() [9/11]

template<>
void fillX ( TRandom &  rand,
TProfile2D t 
)

Definition at line 117 of file main_benchmark.cxx.

117 { t->Fill(getRandX(rand),getRandX(rand),15.0); }

◆ fillX() [10/11]

template<>
void fillX ( TRandom &  rand,
TProfile2D_LW t 
)

Definition at line 118 of file main_benchmark.cxx.

118 { t->Fill(getRandX(rand),getRandX(rand),15.0); }

◆ fillX() [11/11]

template<>
void fillX ( TRandom &  rand,
TProfile_LW t 
)

Definition at line 116 of file main_benchmark.cxx.

116 { t->Fill(getRandX(rand),15.0); }

◆ fillXW() [1/11]

template<class T >
void fillXW ( TRandom &  rand,
T *  t 
)

Definition at line 108 of file main_benchmark.cxx.

108 { t->Fill(getRandX(rand),1.2); }

◆ fillXW() [2/11]

template<>
void fillXW ( TRandom &  rand,
TH2D t 
)

Definition at line 120 of file main_benchmark.cxx.

120 { t->Fill(getRandX(rand),getRandX(rand),1.2); }

◆ fillXW() [3/11]

template<>
void fillXW ( TRandom &  rand,
TH2D_LW t 
)

Definition at line 123 of file main_benchmark.cxx.

123 { t->Fill(getRandX(rand),getRandX(rand),1.2); }

◆ fillXW() [4/11]

template<>
void fillXW ( TRandom &  rand,
TH2F t 
)

Definition at line 119 of file main_benchmark.cxx.

119 { t->Fill(getRandX(rand),getRandX(rand),1.2); }

◆ fillXW() [5/11]

template<>
void fillXW ( TRandom &  rand,
TH2F_LW t 
)

Definition at line 122 of file main_benchmark.cxx.

122 { t->Fill(getRandX(rand),getRandX(rand),1.2); }

◆ fillXW() [6/11]

template<>
void fillXW ( TRandom &  rand,
TH2I t 
)

Definition at line 121 of file main_benchmark.cxx.

121 { t->Fill(getRandX(rand),getRandX(rand),1.2); }

◆ fillXW() [7/11]

template<>
void fillXW ( TRandom &  rand,
TH2I_LW t 
)

Definition at line 124 of file main_benchmark.cxx.

124 { t->Fill(getRandX(rand),getRandX(rand),1.2); }

◆ fillXW() [8/11]

template<>
void fillXW ( TRandom &  rand,
TProfile t 
)

Definition at line 125 of file main_benchmark.cxx.

125 { t->Fill(getRandX(rand),getRandX(rand),1.2); }

◆ fillXW() [9/11]

template<>
void fillXW ( TRandom &  rand,
TProfile2D t 
)

Definition at line 127 of file main_benchmark.cxx.

127 { t->Fill(getRandX(rand),getRandX(rand),15.0,1.2); }

◆ fillXW() [10/11]

template<>
void fillXW ( TRandom &  rand,
TProfile2D_LW t 
)

Definition at line 128 of file main_benchmark.cxx.

128 { t->Fill(getRandX(rand),getRandX(rand),15.0,1.2); }

◆ fillXW() [11/11]

template<>
void fillXW ( TRandom &  rand,
TProfile_LW t 
)

Definition at line 126 of file main_benchmark.cxx.

126 { t->Fill(getRandX(rand),getRandX(rand),1.2); }

◆ getRandX()

double getRandX ( TRandom &  rand)

Definition at line 103 of file main_benchmark.cxx.

103 { return rand.Gaus(50.0,12.5); }

◆ histClassName()

template<class T >
std::string histClassName ( )

Definition at line 57 of file main_benchmark.cxx.

57 { return "unknown"; }

◆ histClassName< TH1D >()

template<>
std::string histClassName< TH1D > ( )

Definition at line 62 of file main_benchmark.cxx.

62 { return "TH1D"; }

◆ histClassName< TH1D_LW >()

template<>
std::string histClassName< TH1D_LW > ( )

Definition at line 63 of file main_benchmark.cxx.

63 { return "TH1D_LW"; }

◆ histClassName< TH1F >()

template<>
std::string histClassName< TH1F > ( )

Definition at line 60 of file main_benchmark.cxx.

60 { return "TH1F"; }

◆ histClassName< TH1F_LW >()

template<>
std::string histClassName< TH1F_LW > ( )

Definition at line 61 of file main_benchmark.cxx.

61 { return "TH1F_LW"; }

◆ histClassName< TH1I >()

template<>
std::string histClassName< TH1I > ( )

Definition at line 58 of file main_benchmark.cxx.

58 { return "TH1I"; }

◆ histClassName< TH1I_LW >()

template<>
std::string histClassName< TH1I_LW > ( )

Definition at line 59 of file main_benchmark.cxx.

59 { return "TH1I_LW"; }

◆ histClassName< TH2D >()

template<>
std::string histClassName< TH2D > ( )

Definition at line 68 of file main_benchmark.cxx.

68 { return "TH2D"; }

◆ histClassName< TH2D_LW >()

template<>
std::string histClassName< TH2D_LW > ( )

Definition at line 69 of file main_benchmark.cxx.

69 { return "TH2D_LW"; }

◆ histClassName< TH2F >()

template<>
std::string histClassName< TH2F > ( )

Definition at line 66 of file main_benchmark.cxx.

66 { return "TH2F"; }

◆ histClassName< TH2F_LW >()

template<>
std::string histClassName< TH2F_LW > ( )

Definition at line 67 of file main_benchmark.cxx.

67 { return "TH2F_LW"; }

◆ histClassName< TH2I >()

template<>
std::string histClassName< TH2I > ( )

Definition at line 64 of file main_benchmark.cxx.

64 { return "TH2I"; }

◆ histClassName< TH2I_LW >()

template<>
std::string histClassName< TH2I_LW > ( )

Definition at line 65 of file main_benchmark.cxx.

65 { return "TH2I_LW"; }

◆ histClassName< TProfile >()

template<>
std::string histClassName< TProfile > ( )

Definition at line 70 of file main_benchmark.cxx.

70 { return "TProfile"; }

◆ histClassName< TProfile2D >()

template<>
std::string histClassName< TProfile2D > ( )

Definition at line 72 of file main_benchmark.cxx.

72 { return "TProfile2D"; }

◆ histClassName< TProfile2D_LW >()

template<>
std::string histClassName< TProfile2D_LW > ( )

Definition at line 73 of file main_benchmark.cxx.

73 { return "TProfile2D_LW"; }

◆ histClassName< TProfile_LW >()

template<>
std::string histClassName< TProfile_LW > ( )

Definition at line 71 of file main_benchmark.cxx.

71 { return "TProfile_LW"; }

◆ isROOT()

template<class T >
bool isROOT ( )

Definition at line 179 of file main_benchmark.cxx.

179 { return true; }

◆ isROOT< TH1D_LW >()

template<>
bool isROOT< TH1D_LW > ( )

Definition at line 181 of file main_benchmark.cxx.

181 { return false; }

◆ isROOT< TH1F_LW >()

template<>
bool isROOT< TH1F_LW > ( )

Definition at line 180 of file main_benchmark.cxx.

180 { return false; }

◆ isROOT< TH1I_LW >()

template<>
bool isROOT< TH1I_LW > ( )

Definition at line 182 of file main_benchmark.cxx.

182 { return false; }

◆ isROOT< TH2D_LW >()

template<>
bool isROOT< TH2D_LW > ( )

Definition at line 184 of file main_benchmark.cxx.

184 { return false; }

◆ isROOT< TH2F_LW >()

template<>
bool isROOT< TH2F_LW > ( )

Definition at line 183 of file main_benchmark.cxx.

183 { return false; }

◆ isROOT< TH2I_LW >()

template<>
bool isROOT< TH2I_LW > ( )

Definition at line 185 of file main_benchmark.cxx.

185 { return false; }

◆ isROOT< TProfile2D_LW >()

template<>
bool isROOT< TProfile2D_LW > ( )

Definition at line 187 of file main_benchmark.cxx.

187 { return false; }

◆ isROOT< TProfile_LW >()

template<>
bool isROOT< TProfile_LW > ( )

Definition at line 186 of file main_benchmark.cxx.

186 { return false; }

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 306 of file main_benchmark.cxx.

306  {
307  std::string progname=argv[0];
308  if (argc!=7)
309  return usage(progname);
310  const int nbins = atoi(argv[4]);
311  const int nfills = atoi(argv[5]);
312  const int nhists = atoi(argv[6]);
313  if (nbins<1||nbins>USHRT_MAX-1||nhists<1||nhists>1000000)
314  return usage(progname);
315 
316  std::string valtype(argv[1]),dim(argv[2]),histimpl(argv[3]);
317  if (histimpl=="lwrb") {
318  histimpl = "lw";
320  std::cout<<"Using ROOT backend for LW histograms."<<std::endl;
321  }
322 
323  TRandom3 rand(117);
324 
325  if (valtype=="float"&&dim=="1d"&&histimpl=="lw")
326  return performBenchmark<TH1F_LW> (rand, nhists,nbins,nfills);
327  if (valtype=="double"&&dim=="1d"&&histimpl=="lw")
328  return performBenchmark<TH1D_LW> (rand, nhists,nbins,nfills);
329  if (valtype=="int"&&dim=="1d"&&histimpl=="lw")
330  return performBenchmark<TH1I_LW> (rand, nhists,nbins,nfills);
331  if (valtype=="profile"&&dim=="1d"&&histimpl=="lw")
332  return performBenchmark<TProfile_LW> (rand, nhists,nbins,nfills);
333  if (valtype=="float"&&dim=="1d"&&histimpl=="root")
334  return performBenchmark<TH1F> (rand, nhists,nbins,nfills);
335  if (valtype=="double"&&dim=="1d"&&histimpl=="root")
336  return performBenchmark<TH1D> (rand, nhists,nbins,nfills);
337  if (valtype=="int"&&dim=="1d"&&histimpl=="root")
338  return performBenchmark<TH1I> (rand, nhists,nbins,nfills);
339  if (valtype=="profile"&&dim=="1d"&&histimpl=="root")
340  return performBenchmark<TProfile> (rand, nhists,nbins,nfills);
341 
342  if (valtype=="float"&&dim=="2d"&&histimpl=="lw")
343  return performBenchmark<TH2F_LW> (rand, nhists,nbins,nfills);
344  if (valtype=="double"&&dim=="2d"&&histimpl=="lw")
345  return performBenchmark<TH2D_LW> (rand, nhists,nbins,nfills);
346  if (valtype=="int"&&dim=="2d"&&histimpl=="lw")
347  return performBenchmark<TH2I_LW> (rand, nhists,nbins,nfills);
348  if (valtype=="profile"&&dim=="2d"&&histimpl=="lw")
349  return performBenchmark<TProfile2D_LW> (rand, nhists,nbins,nfills);
350  if (valtype=="float"&&dim=="2d"&&histimpl=="root")
351  return performBenchmark<TH2F> (rand, nhists,nbins,nfills);
352  if (valtype=="double"&&dim=="2d"&&histimpl=="root")
353  return performBenchmark<TH2D> (rand, nhists,nbins,nfills);
354  if (valtype=="int"&&dim=="2d"&&histimpl=="root")
355  return performBenchmark<TH2I> (rand, nhists,nbins,nfills);
356  if (valtype=="profile"&&dim=="2d"&&histimpl=="root")
357  return performBenchmark<TProfile2D> (rand, nhists,nbins,nfills);
358 
359  return usage(progname);
360 }

◆ performBenchmark()

template<class T >
int performBenchmark ( TRandom &  rand,
const unsigned  nhists,
const unsigned  nbins,
const int  nfills 
)

Definition at line 199 of file main_benchmark.cxx.

203 {
204 
205  std::vector<std::pair<std::string,T*> > hists(nhists);
206  typename std::vector<std::pair<std::string,T*> >::iterator it,itE (hists.end());
207  for (unsigned i = 0; i < nhists; ++i) {
208  std::ostringstream s;
209  s << "some_hist_"<<i;
210  hists.at(i)=std::pair<std::string,T*>(s.str(),0);
211  }
212 
213  //First we book:
214  std::string title("This is some title");
215  it=hists.begin();
216  MemCheck m1;
217  Timer t1;
218  for (;it!=itE;++it)
219  it->second = book<T>(it->first,title,nbins);
220  t1.end(histClassName<T>()+" booking",nhists);
221  double mem_booked = m1.end("Booked size ["+histClassName<T>()+"]",hists.size());
222 
223  if (!isROOT<T>())
224  std::cout<<"Pool wastage: "<<LWHistControls::poolWasteFraction()*100.0<<" %"<<std::endl;
225 
226  const unsigned nrandfills = (nfills<0?-nfills:nfills);
227 
228  //Estimate overhead of random filling (looping & random number generation):
229  const long clock1 = clock();
230  it=hists.begin();
231  for (;it!=itE;++it)
232  for (unsigned i = 0; i < nrandfills; ++i)
233  fakeFillRandGen<T>(rand);
234  const long loopandrandgenoverhead(clock()-clock1);
235 
236  if (nfills!=0) {
237  MemCheck m2;
238 
239 
240  //Time random fills:
241  it=hists.begin();
242  Timer t2;
243  if (nfills<0) {
244  for (;it!=itE;++it)
245  for (unsigned i = 0; i < nrandfills; ++i)
246  fillXW(rand, it->second);
247  t2.end(histClassName<T>()+" average time of random fills (Fill(x,w))",nhists*nrandfills,loopandrandgenoverhead);
248  } else {
249  for (;it!=itE;++it)
250  for (unsigned i = 0; i < nrandfills; ++i)
251  fillX(rand, it->second);
252  t2.end(histClassName<T>()+" average time of random fills (Fill(x))",nhists*nrandfills,loopandrandgenoverhead);
253  }
254 
255  m2.end("Size after random fills ["+histClassName<T>()+"]",hists.size(),mem_booked);
256 
257  if (!isROOT<T>())
258  std::cout<<"Pool wastage: "<<LWHistControls::poolWasteFraction()*100.0<<" %"<<std::endl;
259  }
260  if (!isROOT<T>()) {
261  //Fixme: Perform conversion benchmarks!
262 
263  it=hists.begin();
264  long base_t0(clock());
265  for (;it!=itE;++it)
266  it->second->GetName();
267  long base_t1(clock());
268 
269  it = hists.begin();
270  long actual_t0(clock());
271  for (;it!=itE;++it)
272  triggerConversion(it->second);
273  long actual_t1(clock());
274  std::cout<<"Conversion took "<<((actual_t1-actual_t0)-(base_t1-base_t0))/(double(CLOCKS_PER_SEC)*hists.size())*1.0e3<<" ms/hist"<<std::endl;
275  }
276 
277  //For valgrind we also delete the histograms again:
278  it=hists.begin();
279  for (;it!=itE;++it) {
280  safeDelete(it->second);
281  }
282 
284  //Magic report triggering lines in case librootspy.so is preloaded:
285  TH1F * hreport = new TH1F("rootspy","",1,0,1);
286  hreport->Fill("rootspy_producereport",0.123456);
287  delete hreport;
288  return 0;
289 }

◆ safeDelete()

template<class T >
void safeDelete ( T *  h)

Definition at line 189 of file main_benchmark.cxx.

190 {
191  if (isROOT<T>()) {
192  delete dynamic_cast<TH1*>(h);
193  } else {
194  LWHist::safeDelete(reinterpret_cast<LWHist*>(h));
195  }
196 }

◆ thisProcess_VirtualMemUsed_kB()

long long thisProcess_VirtualMemUsed_kB ( )
inline

Definition at line 32 of file main_benchmark.cxx.

33 {
34  FILE* file = fopen("/proc/self/status", "r");
35  if (!file) {
36  std::cerr << "ERROR: Could not open /proc/self/stat"<<std::endl;
37  return -1;
38  };
39  long long result = -1;
40  char line[128];
41  while (fgets(line, 128, file) != NULL){
42  if (strncmp(line, "VmSize:", 7) == 0) {
43  std::stringstream s(&(line[7]));
44  s >> result;
45  break;
46  }
47  }
48  fclose(file);
49  return result;
50 }

◆ triggerConversion() [1/9]

template<class T >
void triggerConversion ( T *  )

Definition at line 169 of file main_benchmark.cxx.

169 { /*ROOT classes*/ }

◆ triggerConversion() [2/9]

template<>
void triggerConversion ( TH1D_LW h)

Definition at line 171 of file main_benchmark.cxx.

171 { h->getROOTHist(); }

◆ triggerConversion() [3/9]

template<>
void triggerConversion ( TH1F_LW h)

Definition at line 170 of file main_benchmark.cxx.

170 { h->getROOTHist(); }

◆ triggerConversion() [4/9]

template<>
void triggerConversion ( TH1I_LW h)

Definition at line 172 of file main_benchmark.cxx.

172 { h->getROOTHist(); }

◆ triggerConversion() [5/9]

template<>
void triggerConversion ( TH2D_LW h)

Definition at line 174 of file main_benchmark.cxx.

174 { h->getROOTHist(); }

◆ triggerConversion() [6/9]

template<>
void triggerConversion ( TH2F_LW h)

Definition at line 173 of file main_benchmark.cxx.

173 { h->getROOTHist(); }

◆ triggerConversion() [7/9]

template<>
void triggerConversion ( TH2I_LW h)

Definition at line 175 of file main_benchmark.cxx.

175 { h->getROOTHist(); }

◆ triggerConversion() [8/9]

template<>
void triggerConversion ( TProfile2D_LW h)

Definition at line 177 of file main_benchmark.cxx.

177 { h->getROOTHist(); }

◆ triggerConversion() [9/9]

template<>
void triggerConversion ( TProfile_LW h)

Definition at line 176 of file main_benchmark.cxx.

176 { h->getROOTHist(); }

◆ usage()

int usage ( const std::string &  progname)

Definition at line 291 of file main_benchmark.cxx.

292 {
293  std::cout << "Usage:\n\n "
294  << progname << " [float|double|int|profile] [1d|2d] [root|lw|lwrb] [nbins] [nfills] [nhists]\n\n"
295  << " float|double|int|profile : type of histogram (e.g. TH1F vs. TH1D vs. TH1I vs. TProfile)\n\n"
296  << " 1d|2d : Dimension of histogram (e.g. TH1F vs. TH2F)\n\n"
297  << " 'root': benchmark cpu/vmem usage of booking & filling root hists\n"
298  << " 'lw': benchmark cpu/vmem usage of booking & filling lw hists + conversion lw->root\n\n"
299  << " 'lwrb': benchmark cpu/vmem usage of booking & filling lw hists using a root backend\n\n"
300  << " nbins : Number of histogram bins (in both dimensions for 2D hists)\n\n"
301  << " nfills : Number of fills per histogram (put <0 for fill(x,w) rather than fill(x))\n\n"
302  << " nhists : Number of histograms to use for test"
303  << std::endl;
304  return 1;
305 }

◆ vmemUsedMB()

double vmemUsedMB ( )
inline

Definition at line 52 of file main_benchmark.cxx.

53 {
54  return thisProcess_VirtualMemUsed_kB()/1024.0;
55 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Timer
Definition: main_benchmark.cxx:76
LWHist
Definition: LWHist.h:26
extractSporadic.nhists
nhists
Definition: extractSporadic.py:111
checkFileSG.line
line
Definition: checkFileSG.py:75
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
get_generator_info.result
result
Definition: get_generator_info.py:21
python.SystemOfUnits.m2
int m2
Definition: SystemOfUnits.py:92
TH1F_LW::create
static TH1F_LW * create(const char *name, const char *title, unsigned nbinsx, const double &xlow, const double &xup)
Definition: TH1F_LW.cxx:33
triggerConversion
void triggerConversion(T *)
Definition: main_benchmark.cxx:169
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition: ALFA_EventTPCnvDict.h:43
skel.it
it
Definition: skel.GENtoEVGEN.py:423
fillXW
void fillXW(TRandom &rand, T *t)
Definition: main_benchmark.cxx:108
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TruthTest.itE
itE
Definition: TruthTest.py:25
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
getRandX
double getRandX(TRandom &rand)
Definition: main_benchmark.cxx:103
python.changerun.m1
m1
Definition: changerun.py:32
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
LArG4FSStartPointFilter.rand
rand
Definition: LArG4FSStartPointFilter.py:80
thisProcess_VirtualMemUsed_kB
long long thisProcess_VirtualMemUsed_kB()
Definition: main_benchmark.cxx:32
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
extractSporadic.h
list h
Definition: extractSporadic.py:97
covarianceTool.title
title
Definition: covarianceTool.py:542
LWHistControls::setROOTBackend
static void setROOTBackend(bool)
Definition: LWHistControls.cxx:53
file
TFile * file
Definition: tile_monitor.h:29
MakeTH3DFromTH2Ds.hists
hists
Definition: MakeTH3DFromTH2Ds.py:72
fillX
void fillX(TRandom &rand, T *t)
Definition: main_benchmark.cxx:107
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
LWHistControls::releaseAllHeldMemory
static void releaseAllHeldMemory()
Definition: LWHistControls.cxx:41
usage
int usage(const std::string &progname)
Definition: main_benchmark.cxx:291
LWHist::safeDelete
static void safeDelete(LWHist *)
Definition: LWHist.cxx:30
LWHistControls::poolWasteFraction
static double poolWasteFraction()
Definition: LWHistControls.cxx:77
ALFA_EventTPCnv_Dict::t2
std::vector< ALFA_RawDataContainer_p1 > t2
Definition: ALFA_EventTPCnvDict.h:44
h
TH1F
Definition: rootspy.cxx:320
TH1
Definition: rootspy.cxx:268
MemCheck
Definition: main_benchmark.cxx:91
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
safeDelete
void safeDelete(T *h)
Definition: main_benchmark.cxx:189
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35