58 :
options_(std::move(other.options_))
126 <<
"Number of errors: " <<
numErrors_ <<
".");
177 return std::numeric_limits<double>::quiet_NaN();
189 return std::numeric_limits<double>::quiet_NaN();
201 return std::numeric_limits<double>::quiet_NaN();
216 return (end.tv_sec - start.tv_sec) + (end.tv_nsec - start.tv_nsec) *
SEC_PER_N_SEC;
221 time.tv_nsec +=
static_cast<long int>(duration *
N_SEC_PER_SEC);
static void addDuration(timespec &time, const double duration)
unsigned int numWarnings_
Counter storing how many times a time step took longer than the warning threshold.
double awakeTime_
Most recent time which elapsed between subsequent calls of sleep().
std::atomic< double > maxTimeStepFactorError_
If the awake time is bigger than the time step multiplied by this factor, it counts as an error...
double getAwakeTime() const
double getAwakeTimeMean() const
double getAwakeTimeVar() const
unsigned int numTimeSteps_
Counter storing how many times sleep has been called.
static constexpr long int N_SEC_PER_SEC
Factor storing nanoseconds per seconds.
std::atomic< double > timeStep_
Time step in seconds.
double getAwakeTimeStdDev() const
Rate(const std::string &name, const double timeStep)
#define ROS_WARN_STREAM(args)
RateOptions options_
Rate options.
timespec lastErrorPrintTime_
Point in time when the last error message was printed.
timespec lastWarningPrintTime_
Point in time when the last warning message was printed.
std::atomic< bool > enforceRate_
Boolean indicating whether the rate should be enforced.
double awakeTimeMean_
Mean of the time which elapsed between subsequent calls of sleep().
double awakeTimeM2_
Helper variable to compute the variance of the time step which elapsed between subsequent calls of sl...
timespec sleepStartTime_
Point in time when the most recent sleep() started.
unsigned int numErrors_
Counter storing how many times a time step took longer than the error threshold, not considering warn...
timespec sleepEndTime_
Point in time when the most recent sleep() ended.
std::string name_
Name for printing.
#define ROS_ERROR_STREAM(args)
std::atomic< clockid_t > clockId_
Linux clock ID.
static double getDuration(const timespec &start, const timespec &end)
std::atomic< double > maxTimeStepFactorWarning_
If the awake time is bigger than the time step multiplied by this factor, it counts as an warning...
static constexpr double SEC_PER_N_SEC
Factor storing seconds per nanoseconds.