Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions root/interpreter/InterpreterTest.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstdlib>
#include <fstream>
#include <iostream>

#include <unistd.h>

#include "benchmark/benchmark.h"

static int runTutorial(const std::string& dir, const std::string& filename) {
static int runTutorial(const std::string& dir, const std::string& filename, const std::string& perffile) {
if (getenv("ROOTSYS") == nullptr) {
std::cerr << "Couldn't find ROOTSYS environment variable!\n";
exit(1);
Expand All @@ -15,14 +18,19 @@ static int runTutorial(const std::string& dir, const std::string& filename) {
std::string fullpath = rootsys + "/" + dir + "/" + filename;
std::string thisroot = rootsys + "/bin/thisroot.sh";
// FIXME: no source in /usr/dash
std::string rootInvocation = "source \"" + thisroot + "\" && root.exe -l -q -b -n -x \"" + fullpath + "\" -e return ";
// We are writing /usr/bin/time -v output in file to get maximum resident memory for the benchmark
std::string rootInvocation = "source \"" + thisroot + "\" && /usr/bin/time -v -o \"" + perffile + "\" root.exe -l -q -b -n -x \"" + fullpath + "\" -e return ";
return std::system(rootInvocation.c_str());
}

static void TestTutorial(benchmark::State &state, const char *dir, const char *tutorial) {
// size_t peakSize = 0;
int peakSize = 0;
std::string perftutorial ("perfile.txt");
for(auto _ : state){
runTutorial(dir, tutorial);
runTutorial(dir, tutorial,perftutorial);
std::string memorytutorial = "cat \"" + perftutorial + "\"| grep 'Maximum resident set size' | awk '{print $6}' > tmp_mem_file";
std::system(memorytutorial.c_str());
std::ifstream("tmp_mem_file") >> peakSize;
}
// state.counters["PeakRSS"] = peakSize;
state.counters.insert({{"RSS", peakSize}});
}
20 changes: 10 additions & 10 deletions root/interpreter/RunInterpreter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

#include "benchmark/benchmark.h"

BENCHMARK_CAPTURE(TestTutorial, Test_hsimple, "tutorials/", "hsimple.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_TMVAGAexample, "tutorials/", "tmva/TMVAGAexample.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_TMVAGAexample2, "tutorials/", "tmva/TMVAGAexample2.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_hvector, "tutorials/", "tree/hvector.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_hinvertMatrix, "tutorials/", "matrix/invertMatrix.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_fitLinear, "tutorials/", "fit/fitLinear.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_roofit103, "tutorials/", "roofit/rf103_interprfuncs.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_roofit105, "tutorials/", "roofit/rf105_funcbinding.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_roofit109, "tutorials/", "roofit/rf109_chi2residpull.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_hsimple, "tutorials/", "hsimple.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_TMVAGAexample, "tutorials/", "tmva/TMVAGAexample.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_TMVAGAexample2, "tutorials/", "tmva/TMVAGAexample2.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_hvector, "tutorials/", "tree/hvector.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_hinvertMatrix, "tutorials/", "matrix/invertMatrix.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_fitLinear, "tutorials/", "fit/fitLinear.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_roofit103, "tutorials/", "roofit/rf103_interprfuncs.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_roofit105, "tutorials/", "roofit/rf105_funcbinding.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_roofit109, "tutorials/", "roofit/rf109_chi2residpull.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_roofit110, "tutorials/", "roofit/rf110_normintegration.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_roofit204, "tutorials/", "roofit/rf204_extrangefit.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_roofit204, "tutorials/", "roofit/rf204_extrangefit.C")->Unit(benchmark::kMicrosecond)->UseRealTime();

BENCHMARK_MAIN();
34 changes: 17 additions & 17 deletions root/interpreter/RunInterpreterNoPCH.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

#include "benchmark/benchmark.h"

BENCHMARK_CAPTURE(TestTutorial, Test_nopch_minuit2, "tutorials/", "fit/minuit2FitBench.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_minuit2Gaus, "tutorials/", "fit/minuit2GausFit.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_quadp, "tutorials/", "quadp/portfolio.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_foam, "tutorials/", "foam/foam_demo.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_fftw, "tutorials/", "fft/FFT.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_minuit2, "tutorials/", "fit/minuit2FitBench.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_minuit2Gaus, "tutorials/", "fit/minuit2GausFit.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_quadp, "tutorials/", "quadp/portfolio.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_foam, "tutorials/", "foam/foam_demo.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_fftw, "tutorials/", "fft/FFT.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_mlp_higgs, "tutorials/", "mlp/mlpHiggs.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_mlp_regression, "tutorials/", "mlp/mlpRegression.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_mlp_higgs, "tutorials/", "mlp/mlpHiggs.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_mlp_regression, "tutorials/", "mlp/mlpRegression.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_mlp_higgs, "tutorials/", "mlp/mlpHiggs.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_mlp_regression, "tutorials/", "mlp/mlpRegression.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_assembly, "tutorials/", "geom/assembly.C")->Unit(benchmark::kMicrosecond);
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_na49, "tutorials/", "geom/na49.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_geomAlice, "tutorials/", "geom/geomAlice.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_geomAtlas, "tutorials/", "geom/geomAtlas.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_mp3player, "tutorials/", "geom/mp3player.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_geamD0, "tutorials/", "geom/geomD0.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_radionucl, "tutorials/", "geom/RadioNuclides.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_rootgeom, "tutorials/", "geom/rootgeom.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_geodemo, "tutorials/", "geom/geodemo.C")->Unit(benchmark::kMicrosecond)->UseRealTime();;
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_mlp_regression, "tutorials/", "mlp/mlpRegression.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_assembly, "tutorials/", "geom/assembly.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_na49, "tutorials/", "geom/na49.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_geomAlice, "tutorials/", "geom/geomAlice.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_geomAtlas, "tutorials/", "geom/geomAtlas.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_mp3player, "tutorials/", "geom/mp3player.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_geamD0, "tutorials/", "geom/geomD0.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_radionucl, "tutorials/", "geom/RadioNuclides.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_rootgeom, "tutorials/", "geom/rootgeom.C")->Unit(benchmark::kMicrosecond)->UseRealTime();
BENCHMARK_CAPTURE(TestTutorial, Test_nopch_geodemo, "tutorials/", "geom/geodemo.C")->Unit(benchmark::kMicrosecond)->UseRealTime();

BENCHMARK_MAIN();