Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Feb 2005 12:50:42 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Jeff Behl <jbehl@fastclick.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: vmstat/iostat/top all fail to report CPU usage
Message-ID:  <20050228185042.GH8778@dan.emsphone.com>
In-Reply-To: <422366DE.6020001@fastclick.com>
References:  <422366DE.6020001@fastclick.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Feb 28), Jeff Behl said:
> as reported in bug: bin/60385
> 
> this is still occurring in almost all of our systems, even those at 
> stable, and is pretty major issue.  any known progress on this?  we're 
> running ibm e325 servers. 
> 
> FreeBSD www3 5.3-STABLE FreeBSD 5.3-STABLE #1: Tue Feb 15 10:09:17 PST 
> 2005    root@www3.cdn.sjc:/usr/obj/usr/src/sys/SMP  amd64

Here's the workaround I use on a machine here that loses its stat clock
after a week or so of uptime.  Put this in /etc/crontab:

#  Flaky clock.  Check it every 5 minutes.
*/5     *       *       *       *       root    /usr/local/bin/fixrtc

.. and this in /usr/local/bin/fixrtc:

#! /bin/sh

# get the interrupt rate for the stat clock over one second
getticks() {
  ( vmstat -i ; sleep 1 ; vmstat -i ) |
  awk '/rtc/ { if (sum) sum+=$3; else sum-=$3 } END { print sum }'
}

ticks=$(getticks)

# It should be firing at 128 hz.  If not, kick it
if [ $ticks -lt 64 ] ; then
  echo "Stat clock has died.  Attempting to reset."
  echo
  /etc/rc.d/ntpd stop
  echo
  /usr/sbin/ntpdate -b ntp.pool.org
  echo
  /etc/rc.d/ntpd start
  echo
  echo "RTC interrupt rate is now $(getticks)"
fi


-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050228185042.GH8778>