16#include "../include/PeriodicEventsVerifier.h"
18#include <yarp/os/LogStream.h>
40 bool init(
double period,
double tolerance,
double min,
double max,
double step,
double reportPeriod,
const std::string&
name = {})
43 uint64_t period_us=period*1000000;
45 uint64_t min_us=min*1000000;
46 uint64_t max_us=max*1000000;
47 uint32_t step_us=step*1000000;
48 uint64_t reportPeriod_us=reportPeriod*1000000;
51 return m_perVal.
init({period_us, period_us+tolerance_us, reportPeriod_us,
52 {min_us, max_us, step_us}});
56 void tick(
double currentTime)
59 uint64_t tnow =
static_cast<std::uint64_t
>(currentTime * 1000000);
64 std::vector<double> vect_prob;
68 yWarning() <<
"---------- PRINT HISTO" <<
name <<
"---------------";
69 for(
int i=0; i<vect_prob.size(); i++)
74 yWarning() <<
"-- histo" <<
name <<
"[" << min+step*i <<
"]="<< vect_prob[i];
76 yWarning() <<
"---------- END PRINT HISTO" <<
name <<
"---------------";
93 bool init(
double desiredResponseTime,
double tolerance,
double min,
double max,
double step,
double reportPeriod,
const std::string&
name = {})
97 uint64_t desiredResponseTime_us=desiredResponseTime*1000000;
99 uint64_t min_us=min*1000000;
100 uint64_t max_us=max*1000000;
101 uint32_t step_us=step*1000000;
102 uint64_t reportPeriod_us=reportPeriod*1000000;
104 return m_roundTripVal.
init({desiredResponseTime_us, desiredResponseTime_us+tolerance_us, reportPeriod_us,
105 {min_us, max_us, step_us}});
110 void tick(
double currentResponseTime,
double requestTime)
112 m_roundTripVal.
tick(currentResponseTime,
static_cast<std::uint64_t
>(1000000.0*requestTime));
119 std::vector<double> vect_prob;
123 yInfo() <<
"---------- PRINT HISTO" <<
name <<
"---------------";
124 for(
int i=0; i<vect_prob.size(); i++)
128 yInfo() <<
"-- histo PID [" << min+step*i <<
"]="<< vect_prob[i];
130 yInfo() <<
"---------- END PRINT HISTO" <<
name <<
"---------------";
154 return pImpl->init(period,
tolerance, min, max, step, reportPeriod, name);
159 pImpl->tick(currentTime);
174 return pImpl->init(desiredResponseTime,
tolerance, min, max, step, reportPeriod, name);
180 return pImpl->tick(currentResponseTime, requestTime);
constexpr double tolerance