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: devVXStats and task crash
From: Andy Foster <[email protected]>
To: EPICS Questions <[email protected]>
Date: Thu, 26 Apr 2001 12:26:03 +0000
 
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

Navigate by Date:
Prev: Re: gdct built with ivtools - bug Kristi Luchini
Next: New MCP750s That Don't Run VxWorks Boot Code Susanna Jacobson
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: Re: gdct built with ivtools - bug Kristi Luchini
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 ·