18int main(
int argc,
char* argv[])
36 catch(
const exception &error) {
37 FATAL(error.what() << endl);
43 if (intervalTime_ms <= 0) {
FATAL(
"interval time [ms] " << intervalTime_ms <<
" < 0." << endl); }
44 if (totalTime_s <= 0) {
FATAL(
"total time [s] " << totalTime_s <<
" < 0." << endl); }
48 cout <<
"hit <return> to interrupt" << endl;
55 const long long int t0 = getLocalTime();
58 int numberOfInterrupts = 0;
60 for (
int i = 0; i < 1000 * totalTime_s / intervalTime_ms; ) {
64 mask.
set(STDIN_FILENO);
66 if (clock.
wait(mask)) {
79 const long long int t1 = getLocalTime();
81 NOTICE(
"Number of interrupts " << setw(8) << right << numberOfInterrupts << endl);
82 NOTICE(
"Total delay [ms] " << setw(8) << right << clock.
getDelay() / 1000 << endl);
83 NOTICE(
"Elapsed time [ms] " << setw(8) << right << (t1 - t0) / 1000 << endl);
85 if (numberOfInterrupts != 0) {
86 NOTICE(
"Time per interrupt [us] " << setw(8) << right << (t1 - t0 - clock.
getDelay()) / numberOfInterrupts << endl);
std::ostream & rewind(std::ostream &out)
Rewind character.
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
int main(int argc, char *argv[])
Scheduling of actions via fixed latency intervals.
long long int getDelay() const
Get total delay time.
void setInterval(const long long int interval_us)
Set interval time.
void wait() const
Wait until the number of time intervals has elapsed since the last call to the reset method.
void reset(const long long int t0)
Reset time.
Auxiliary class for method select.
void set(const int file_descriptor)
Set file descriptor.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).