forked from makortel/pixel-standalone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyzer_naive.cc
43 lines (37 loc) · 1.18 KB
/
analyzer_naive.cc
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
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <chrono>
#include <memory>
#include "input.h"
#include "output.h"
#include "rawtodigi_naive.h"
namespace {
constexpr int NLOOPS = 100;
}
namespace naive {
void analyze(Input const& input, std::unique_ptr<Output>& output, double& totaltime) {
for (int i = 0; i <= NLOOPS; ++i) {
output = std::make_unique<Output>();
auto start = std::chrono::high_resolution_clock::now();
naive::rawtodigi(&input.cablingMap,
input.wordCounter,
input.word,
input.fedId,
output->xx,
output->yy,
output->adc,
output->digi,
output->rawIdArr,
output->moduleInd,
&output->err,
true,
true,
i == 0);
auto stop = std::chrono::high_resolution_clock::now();
auto diff = stop - start;
auto time = std::chrono::duration_cast<std::chrono::microseconds>(diff).count();
if (i != 0) {
totaltime += time;
}
}
totaltime /= NLOOPS;
}
} // namespace naive