Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
time_tracking.hh
Go to the documentation of this file.
1#ifndef TIME_TRACKING_HH
2#define TIME_TRACKING_HH
3
4#include <fstream>
5
6#include <datatypespec.hh>
7#include "chronometer.hpp"
8
9/**
10 * \author cpellegrino
11 */
12
13// NOTE: All the functions and classes inside this file expand to
14// nothing if the BENCH_TIME macro is unset
15
16namespace benchmark {
17
19{
20 #ifdef BENCH_TIME
21 Chronometer m_ch;
22 #endif // BENCH_TIME
23
24 friend
25 void chrono_set(chronometrable& chr);
26
27 friend
29
30 friend
31 void chrono_swap(chronometrable& input, chronometrable& output);
32
33 template<typename Frame>
34 friend
35 void chrono_dump(const Frame& frame);
36};
37
38inline
40{
41 #ifdef BENCH_TIME
42 chr.m_ch.set();
43 #endif // BENCH_TIME
44}
45
46inline
48{
49 #ifdef BENCH_TIME
50 chr.m_ch.reset();
51 chr.m_ch.set();
52 #endif // BENCH_TIME
53}
54
55inline
57{
58 #ifdef BENCH_TIME
59 output.m_ch.swap(input.m_ch);
60 #endif // BENCH_TIME
61}
62
63template<typename Frame>
64inline
65void chrono_dump(const Frame& frame)
66{
67 #ifdef BENCH_TIME
68 if (frame.getHeader()->DataType == ttdc)
69 {
70 static std::ofstream g_perf_file("/dev/shm/opto_dq_perf_measure.txt", std::ios_base::app);
71 g_perf_file << frame.m_ch << '\n';
72 }
73 if (frame.getHeader()->DataType == taes)
74 {
75 static std::ofstream g_perf_file("/dev/shm/acou_dq_perf_measure.txt", std::ios_base::app);
76 g_perf_file << frame.m_ch << '\n';
77 }
78 #endif // BENCH_TIME
79}
80
81} // ns benchmark
82
83#endif // TIME_TRACKING_HH
Template Frame for ARS data.
Definition frame.hh:13
const DAQCommonHeader *const getHeader() const
Definition frame.hh:18
friend void chrono_set(chronometrable &chr)
friend void chrono_dump(const Frame &frame)
friend void chrono_reset(chronometrable &chr)
friend void chrono_swap(chronometrable &input, chronometrable &output)
static const unsigned int taes
static const unsigned int ttdc
void chrono_reset(chronometrable &chr)
void chrono_set(chronometrable &chr)
void chrono_swap(chronometrable &input, chronometrable &output)
void chrono_dump(const Frame &frame)