In the last episode (May 05), Maxim Khitrov said: > Simple question - does the sum of differences in ssCpuRawIdle, > ssCpuRawUser, ssCpuRawNice, ssCpuRawKernel, and ssCpuRawInterrupt OIDs on > a FreeBSD 7.2 system give me total CPU allocation (i.e. is a constant)? > I've configured a few scripts to read these values from bsnmpd, store them > via rrdtool, and then generate a single graph with idle on the negative y > axis and everything else stacked on top. I want to make sure that no > other counter is missing from this ensemble and the ones listed do not > overlap. If either of those conditions is not met, my usage percent > calculation will not be accurate. > > The OIDs that I left out are: > > ssCpuRawSoftIRQ - documentation states that this is for Linux only, > but FreeBSD 7.2 does provide a value for it > ssCpuRawWait - always 0? > ssCpuRawSystem - seems to be a sum of ssCpuRawKernel and ssCpuRawInterrupt > > As far as I can tell, these three do not factor into the equation. The > only one I'm not sure about is ssCpuRawSystem. Is there ever a time when > it will not equal to ssCpuRawKernel + ssCpuRawInterrupt?
The nice thing about open source software is you can read the source and see what's going on :) The FreeBSD kernel statclock() function: http://fxr.watson.org/fxr/source/kern/kern_clock.c#L442 updates the cp_time array, and it increments one of CP_NICE, CP_USER, CP_INTR, CP_SYS, and CP_IDLE on each tick. The Net-SNMP var_extensible_vmstat() function: http://net-snmp.svn.sourceforge.net/viewvc/net-snmp/trunk/net-snmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.c?revision=HEAD&view=markup#l_165 fetches that array and maps those indexes to CPURAWNICE, CPURAWUSER, CPURAWINTR, CPURAWKERNEL, and CPURAWIDLE. So fetching the matching ssCpuRaw* oids and totaling them up should always equal 100% cpu. -- Dan Nelson dnel...@allantgroup.com _______________________________________________ email@example.com mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"