From nobody@FreeBSD.org  Thu Feb  3 07:23:30 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 995A31065674
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  3 Feb 2011 07:23:30 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 875918FC1D
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  3 Feb 2011 07:23:30 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p137NUNH000979
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 3 Feb 2011 07:23:30 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p137NTYf000955;
	Thu, 3 Feb 2011 07:23:29 GMT
	(envelope-from nobody)
Message-Id: <201102030723.p137NTYf000955@red.freebsd.org>
Date: Thu, 3 Feb 2011 07:23:29 GMT
From: KOIE Hidetaka <koie@suri.co.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: gmond reports wrong number of running processes.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         154480
>Category:       ports
>Synopsis:       sysutils/ganglia-monitor-core: gmond reports wrong number of running processes.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    brooks
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 03 07:30:11 UTC 2011
>Closed-Date:    Thu May 19 18:26:15 UTC 2011
>Last-Modified:  Thu May 19 18:26:15 UTC 2011
>Originator:     KOIE Hidetaka
>Release:        Current
>Organization:
surigiken
>Environment:
FreeBSD guriandgura 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r216681+5c4bd1174659,ver-hg,nice-powerd: Fri Dec 24 11:46:20 JST 2010     koie@guriandgura:/usr/obj/usr/src/sys/GURIANDGURA  amd64
>Description:
gmond is in sysutils/ganglia-monitor-core.
gmond resports reports running processes >= CPU even if system is idle.
for example, on 4 CPU machine, gmond reports 4 processes are running at least.
>How-To-Repeat:

>Fix:
when counting, idle threads running on each CPU must be skipped.
I don't know SWI (software interrupt) thread should be skipped.


Patch attached with submission follows:

--- libmetrics/freebsd/metrics.c-base	2011-02-03 15:32:37.931606016 +0900
+++ libmetrics/freebsd/metrics.c	2011-02-03 15:37:31.347603233 +0900
@@ -541,6 +541,16 @@ proc_run_func( void )
       goto output;
 
    for (i = 0; i < nentries; kp++, i++) {
+#if 1 /*KOIE1*/
+      /* This is a per-CPU idle thread. */ /* idle thread */
+      if ((kp->ki_tdflags & TDF_IDLETD) != 0)
+         continue;
+#endif
+#if 1 /*KOIE2*/
+      /* Ignore during load avg calculations. */ /* swi or idle thead */
+      if ((kp->ki_tdflags & TDF_NOLOAD) != 0)
+         continue;
+#endif
 #ifdef KINFO_PROC_SIZE
       state = kp->ki_stat;
 #else


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->brooks 
Responsible-Changed-By: arved 
Responsible-Changed-When: Thu Feb 3 09:21:41 UTC 2011 
Responsible-Changed-Why:  
over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154480 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/154480: commit references a PR
Date: Thu, 19 May 2011 18:10:30 +0000 (UTC)

 brooks      2011-05-19 18:10:20 UTC
 
   FreeBSD ports repository
 
   Modified files:
     sysutils/ganglia-monitor-core Makefile 
     sysutils/ganglia-monitor-core/files 
                                         patch-libmetrics_freebsd_metrics.c 
   Log:
   Don't report idle processes as running processing.
   Also don't count P_NOLOAD and TDF_NOLOAD processes.
   
   PR:             ports/154480
   Submitted by:   KOIE Hidetaka <koie at suri.co.jp>
   
   Revision  Changes    Path
   1.39      +1 -1      ports/sysutils/ganglia-monitor-core/Makefile
   1.5       +29 -8     ports/sysutils/ganglia-monitor-core/files/patch-libmetrics_freebsd_metrics.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: brooks 
State-Changed-When: Thu May 19 18:25:13 UTC 2011 
State-Changed-Why:  
Committed with some small changes to account for the fact that 
TDF_NOLOAD doesn't exist until after 8.2. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154480 
>Unformatted:
