EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: devVXStats and task crash
From: Marty Kraimer <[email protected]>
To: Andy Foster <[email protected]>
Cc: EPICS Questions <[email protected]>
Date: Fri, 27 Apr 2001 08:44:10 -0500
I have had some private message with Andy about this problem. We are making
changes to devVXStats to fix the problem. As soon as we have done some more
testing I will make the new code available. Andy also reports that the new
algorithm for computing cpu usage is more stable.

The crash did not happen on 68xxx processors because floating point exceptions
were not trapped. On the powerPC they are trapped.

Marty Kraimer

Andy Foster wrote:
> 
> 
> 
>   --------------------------------------------------------------------------------
> Dear All,
> 
> Has anyone experienced a task crash caused by the "devVXStats" support
> in 3.13.4?
> 
> I have just added the database records for this. I'm running on
> an MVME2700 PPC. The system is apparently about 7% loaded according
> to the report from the device support. I'm sampling the CPU load every
> 5 seconds, although I have varied this with the same outcome.
> 
> I traced the crash to line 373 of "devVXStats.c" (in the function "getCpu"):
> 
> temp = 100.0 * temp/ticksNow;
> 
> It appears to be possible for "ticksNow" to be 0 at this point.
> 
> I added a conditional check on "pcpuUsage->ticksNow" so that the code
> only gets executed if this value is non-zero (adding a printf statement so
> that I could see how many crashes I would have had):
> 
> static double getCpu()
> {
>     if((pcpuUsage->didNotComplete && pcpuUsage->nBurnNow==0) || !pcpuUsage->ticksNow) {
>         if( !pcpuUsage->ticksNow )
>           printf("This would have been a crash\n");
>         pcpuUsage->usage = 0.0;
>     } else {
>         double temp;
>         double ticksNow,nBurnNow;
> 
>         ticksNow = (double)pcpuUsage->ticksNow;
>         nBurnNow = (double)pcpuUsage->nBurnNow;
>         ticksNow *= (double)pcpuUsage->nBurnNoContention/nBurnNow;
>         temp = ticksNow - (double)pcpuUsage->ticksNoContention;
>         temp = 100.0 * temp/ticksNow;
>         if(temp<0.0 || temp>100.0) temp=0.0;/*take care of tick overflow*/
>         pcpuUsage->usage = temp;
>     }
>     pcpuUsage->didNotComplete = TRUE;
>     semGive(pcpuUsage->startSem);
>     return(pcpuUsage->usage);
> }
> 
> I saw the statement about 4 times in 1 hour on the console.
> I'm not sure why "pcpuUsage->ticksNow" is zero, but I think it might be
> worth adding in the check just to be defensive.
> 
> Cheers,
> 
> Andy
> 
> ---------------------------------------------------------------------
> Observatory Sciences Limited    Email: [email protected]
> William James House             Tel:  44 - (0)1223 - 508257
> Cowley Road                     Fax: 44 - (0)1223 - 508258
> Cambridge, CB4 0WX, UK          http://www.observatorysciences.co.uk


Replies:
Re: devVXStats and task crash Marty Kraimer
References:
devVXStats and task crash Andy Foster

Navigate by Date:
Prev: dbCaLink and broadcast messages Kevin Tsubota
Next: RAMIX RM139 memory board and PowerPC Pedro Gigoux
Index: 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: devVXStats and task crash Andy Foster
Next: Re: devVXStats and task crash Marty Kraimer
Index: 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·