-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathInterpreterTest.h
More file actions
30 lines (28 loc) · 1.13 KB
/
InterpreterTest.h
File metadata and controls
30 lines (28 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "rootbench/MemoryMeasurement.h"
#include "benchmark/benchmark.h"
#include <chrono>
#include <unistd.h>
#include <cstdlib>
#include <string>
#include <fstream>
#include <iostream>
static int runTutorial(const std::string& dir, const std::string& filename, std::string& perftutorial) {
std::string rootInvocation;
std::string rootexe = "\" root.exe -l -q -b -n -x \"";
std::string endInvoc = "\" -e return ";
perftutorial = getMemoryStats(dir,filename,rootInvocation, rootexe, endInvoc);
return std::system(rootInvocation.c_str());
}
static void TestTutorial(benchmark::State &state, const char *dir, const char *tutorial) {
int peakSize = 0;
for(auto _ : state){
auto start = std::chrono::high_resolution_clock::now();
std::string perftutorial="";
runTutorial(dir, tutorial, perftutorial);
auto end = std::chrono::high_resolution_clock::now();
auto elapsed_seconds = std::chrono::duration_cast<std::chrono::duration<double>>(end - start);
state.SetIterationTime(elapsed_seconds.count());
peakSize = getMemoryMeasurement(perftutorial);
}
state.counters.insert({{"RSS", peakSize}});
}