g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014 
<== Date ==> <== Thread ==>

Subject: dbScan.c: periodicTask( ), initOnce( ), ...
From: Jack Smith <jacksmithvent2009@gmail.com>
To: "tech-talk@aps.anl.gov" <Tech-talk@aps.anl.gov>
Date: Thu, 10 Jan 2013 09:26:32 -0500
Hi Eric, Andrew, et al:

Thanks for all your explanations. I tried Eric's codes and it works. I
think Eric's algorithm is accurate enough for compensating the time
spent on processing the records in its chain. Now, the delay in
epicsEventWaitWithTimeout is (scan_period - time_on_scanList).

Since I have more questions in dbScan.c, I am starting a new thread ...

1. In Eric's previous email, it says "It's the
epicsEventWaitWithTimeout().  This allows the pause to be interrupted
early in the case of IOC shutdown.". What does "This allows the pause
to be interrupted early in the case of IOC shutdown" mean?

2. Why do we need initOnce( ) in scanInit( )?

Thanks again,

Jack


On Wed, Jan 9, 2013 at 2:45 PM, Andrew Johnson <anj@aps.anl.gov> wrote:
> Hi Eric,
>
> FYI Jack wasn't the reporter.
>
> Your fixed version works fine for me.  I'm adding some code to print warnings
> about continuous overruns (at increasing periods, up to hourly) before I
> commit it.
>
> I'm also inclined to keep the original delay = 0.1 penalty for an over-run
> instead of dropping it to 0.02 seconds, but I will consider arguments against
> that if there are objections.
>
> - Andrew
>
> On 2013-01-09 Eric Norum wrote:
>> Sorry.
>> Previous message had wrong periodicTask code.  Here's what I meant to send.
>>
>> Jack, can you try this and see if it fixes the problem that you were
>>  seeing/
>>
>>
>> static void periodicTask(void *arg)
>> {
>>     periodic_scan_list *ppsl = (periodic_scan_list *)arg;
>>
>>     epicsTimeStamp nextScan, now;
>>     double delay;
>>
>>     taskwdInsert(0, NULL, NULL);
>>     epicsEventSignal(startStopEvent);
>>
>>     epicsTimeGetCurrent(&nextScan);
>>     while (ppsl->scanCtl != ctlExit) {
>>         if (ppsl->scanCtl == ctlRun) scanList(&ppsl->scan_list);
>>         epicsTimeAddSeconds(&nextScan, ppsl->period);
>>         epicsTimeGetCurrent(&now);
>>         delay = epicsTimeDiffInSeconds(&nextScan, &now);
>>         if (delay <= 0.0) {
>>             ppsl->overrunCount++;
>>             delay = 0.02;
>>             epicsTimeGetCurrent(&nextScan);
>>         }
>>         epicsEventWaitWithTimeout(ppsl->loopEvent, delay);
>>     }
>>
>>     taskwdRemove(0);
>>     epicsEventSignal(startStopEvent);
>> }

Replies:
Re: dbScan.c: periodicTask( ), initOnce( ), ... Eric Norum
Re: dbScan.c: periodicTask( ), initOnce( ), ... Andrew Johnson

Navigate by Date:
Prev: Re: routing Pavel Maslov
Next: Re: dbScan.c: periodicTask( ), initOnce( ), ... Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014 
Navigate by Thread:
Prev: Re: Extensions installation for newbie Ralph Lange
Next: Re: dbScan.c: periodicTask( ), initOnce( ), ... Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·