Interesting because when I ran the same script on a RHEL 5.9 guest (w/ 2 vCPUs), we get:
./gettricks.sh getting one set of data sleeping 5 seconds and getting another set of data statOut1 = cpu 60259 128520 96523 256447792 415684 8000 15453 134955 statOut2 = cpu 60259 128520 96524 256448793 415686 8000 15453 134955 nums1 = 60259+128520+96523+256447792+415684+8000+15453+134955 nums2 = 60259+128520+96524+256448793+415686+8000+15453+134955 totalTicks = 1004 Do not have a RHEL 6.3 system to compare with :-(. James Chaplin Systems Programmer, MVS, zVM & zLinux Base Technologies, a CA Technologies Company Supporting the zSeries Platform Team -----Original Message----- From: Linux on 390 Port [mailto:LINUX-390@VM.MARIST.EDU] On Behalf Of Michael MacIsaac Sent: Friday, May 17, 2013 10:30 AM To: LINUX-390@VM.MARIST.EDU Subject: timer ticks in /proc/stat - more differences between SLES and RHEL? I'm hacking around with CPU utilization numbers from /proc/stat with this little script: # cat getticks #!/bin/bash echo "getting one set of data" statOut1=`egrep '^cpu ' /proc/stat` echo "sleeping 5 seconds and getting another set of data" sleep 5 statOut2=`egrep '^cpu ' /proc/stat` nums1=`echo "$statOut1" | grep ^cpu | sed -e 's/cpu\s*//g' -e 's/ /+/g'` let sum1=$nums1 nums2=`echo "$statOut2" | grep ^cpu | sed -e 's/cpu\s*//g' -e 's/ /+/g'` let sum2=$nums2 let totalTicks=$sum2-$sum1 echo "statOut1 = $statOut1" echo "statOut2 = $statOut2" echo "nums1 = $nums1" echo "nums2 = $nums2" echo "totalTicks = $totalTicks" On a SLES 11 SP2 system, with 5 vCPUs, I get the expected output: # ./getticks getting one set of data sleeping 5 seconds and getting another set of data statOut1 = cpu 251 8 170 857508 145 2 7 32 0 0 statOut2 = cpu 251 8 170 860009 145 2 7 32 0 0 nums1 = 251+8+170+857508+145+2+7+32+0+0 nums2 = 251+8+170+860009+145+2+7+32+0+0 totalTicks = 2501 2501 ~= 5 seconds * 5 CPUs * 100 ticks/sec On a RHEL 6.3 system (2 vCPUs), I get a *slightly* different number: # ./getticks getting one set of data sleeping 5 seconds and getting another set of data statOut1 = cpu 13059 57057 56528 4 0 2740 3152 3130 0 statOut2 = cpu 13059 57057 56529 4 0 2740 3152 3130 0 nums1 = 13059+57057+56528+4+0+2740+3152+3130+0 nums2 = 13059+57057+56529+4+0+2740+3152+3130+0 totalTicks = 1 HUH? Does RHEL not count ticks in /proc/stat? Any help will be appreciated. "Mike MacIsaac" <mikemac at-sign us.ibm.com> ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/ ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/