Re: bsnmpd hrProcessorLoad results incorrect on FreeBSD 7 or 8?

From: Michael Proto <mike_at_jellydonut.org>
Date: Mon, 19 May 2008 20:55:11 -0400
Stanislav A Svirid wrote:
> On Wed 07 May, 2008, Harti Brandt wrote:
>
>> On Tue, 6 May 2008, Michael Proto wrote:
>>
>> MP>Mike Tancsa wrote:
>> MP>> At 08:55 PM 5/6/2008, Michael Proto wrote:
>> MP>> > Is anyone seeing problems with bsnmpd reporting an incorrect
>> MP>> > HOST-RESOURCES-MIB::hrProcessorLoad value under HEAD? I'm using the
>> MP>> > default /etc/snmpd.config settings and am loading the
>> MP>> > /usr/lib/snmp_hostres.so library just as I do in 6.3, but the value for
>> MP>> > this MIB always reports CPU utilization at 100% regardless of the actual
>> MP>> > load on the system. 6.3 and 6-STABLE both work correctly and report the
>> MP>> > actual CPU utilization when queried.
>> MP>>
>> MP>> IIRC, I noticed this when I changed to ULE from 4BSD_SCHED.
>> MP>>
>> MP>>         ---Mike
>> MP>> _______________________________________________
>> MP>> freebsd-current_at_freebsd.org mailing list
>> MP>> http://lists.freebsd.org/mailman/listinfo/freebsd-current
>> MP>> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
>> MP>
>> MP>Would match my environment as well, as I'm using ULE on all of the
>> MP>affected systems. Just built a 4BSD kernel on my HEAD system and
>> MP>HOST-RESOURCES-MIB::hrProcessorLoad reports a correct value again.
>> MP>
>> MP>Anyone have an idea on a fix?
>>
>> If anybody has a fix that works with both schedulers, I happily commit
>> this.
>
> Here you are :)
>
> --- hostres_processor_tbl.c.old	2008-05-07 17:23:47.000000000 +0700
> +++ hostres_processor_tbl.c	2008-05-07 17:23:54.000000000 +0700
> _at__at_ -120,7 +120,7 _at__at_ static double
>  processor_getpcpu(struct kinfo_proc *ki_p)
>  {
>
> -	if (ccpu == 0 || fscale == 0)
> +	if (fscale == 0)
>  		return (0.0);
>
>  #define	fxtofl(fixpt) ((double)(fixpt) / fscale)
>


This worked (sorta). On my PCEngines ALIX platform CPU utilization on
HEAD dropped down to 0-2% from a constant 100%. It looks slightly
incorrect though, as there is 3-4% interrupt load at all times on that
system (as per top and vmstat). Still a much better representation than
before though.

So is this fix facetious and I'm not seeing it due to my lack of C prowess?


Thanks,
Proto
Received on Mon May 19 2008 - 22:55:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:31 UTC