Merge remote-tracking branch 'lp-Com/use-monotonic' into 7.0

* lp-Com/use-monotonic:
  VxWorks: Measure CPU time-base frequency if necessary
  replace most internal getCurrent() -> getMonotonic()
  dbScan periodic scan use monotonic time
  monotonic adapt to regular time APIs
This commit is contained in:
Michael Davidsaver
2019-10-06 20:10:20 -07:00
26 changed files with 114 additions and 73 deletions

View File

@@ -173,7 +173,7 @@ extern "C" double epicsShareAPI
epicsTimerQueuePassiveProcess ( epicsTimerQueuePassiveId pQueue )
{
try {
return pQueue->process ( epicsTime::getCurrent() );
return pQueue->process ( epicsTime::getMonotonic() );
}
catch ( ... ) {
return 1.0;

View File

@@ -118,7 +118,7 @@ inline double epicsTimer::getExpireDelay ()
{
epicsTimer::expireInfo info = this->getExpireInfo ();
if ( info.active ) {
double delay = info.expireTime - epicsTime::getCurrent ();
double delay = info.expireTime - epicsTime::getMonotonic ();
if ( delay < 0.0 ) {
delay = 0.0;
}

View File

@@ -54,7 +54,7 @@ void timer::destroy ()
void timer::start ( epicsTimerNotify & notify, double delaySeconds )
{
this->start ( notify, epicsTime::getCurrent () + delaySeconds );
this->start ( notify, epicsTime::getMonotonic () + delaySeconds );
}
void timer::start ( epicsTimerNotify & notify, const epicsTime & expire )
@@ -129,7 +129,7 @@ void timer::privateStart ( epicsTimerNotify & notify, const epicsTime & expire )
debugPrintf ( ("Start of \"%s\" with delay %f at %p preempting %u\n",
typeid ( this->notify ).name (),
expire - epicsTime::getCurrent (),
expire - epicsTime::getMonotonic (),
this, preemptCount ) );
}
@@ -190,7 +190,7 @@ void timer::show ( unsigned int level ) const
double delay;
if ( this->curState == statePending || this->curState == stateActive ) {
try {
delay = this->exp - epicsTime::getCurrent();
delay = this->exp - epicsTime::getMonotonic();
}
catch ( ... ) {
delay = - DBL_MAX;

View File

@@ -30,7 +30,7 @@ timerQueue::timerQueue ( epicsTimerQueueNotify & notifyIn ) :
pExpireTmr ( 0 ),
processThread ( 0 ),
exceptMsgTimeStamp (
epicsTime :: getCurrent () - exceptMsgMinPeriod ),
epicsTime :: getMonotonic () - exceptMsgMinPeriod ),
cancelPending ( false )
{
}
@@ -49,7 +49,7 @@ void timerQueue ::
char date[64];
double delay;
try {
epicsTime cur = epicsTime :: getCurrent ();
epicsTime cur = epicsTime :: getMonotonic ();
delay = cur - this->exceptMsgTimeStamp;
cur.strftime ( date, sizeof ( date ),
"%a %b %d %Y %H:%M:%S.%f" );

View File

@@ -73,7 +73,7 @@ void timerQueueActive :: _printLastChanceExceptionMessage (
{
char date[64];
try {
epicsTime cur = epicsTime :: getCurrent ();
epicsTime cur = epicsTime :: getMonotonic ();
cur.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f");
}
catch ( ... ) {
@@ -91,7 +91,7 @@ void timerQueueActive :: run ()
epics::atomic::set(this->exitFlag, 0);
while ( ! this->terminateFlag ) {
try {
double delay = this->queue.process ( epicsTime::getCurrent() );
double delay = this->queue.process ( epicsTime::getMonotonic() );
debugPrintf ( ( "timer thread sleeping for %g sec (max)\n", delay ) );
this->rescheduleEvent.wait ( delay );
}