summaryrefslogtreecommitdiff
path: root/parallel/ganglia-monitor-core
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2010-11-18 13:50:09 +0000
committerwiz <wiz@pkgsrc.org>2010-11-18 13:50:09 +0000
commit6c9a4b56353dbe058e988a9acc0042800e92f421 (patch)
tree0ad3cdf996b0ce46369631a8f4d5eb63d673f91c /parallel/ganglia-monitor-core
parent6916ab53d7df8136a843f95bbec1da0e9c1cf061 (diff)
downloadpkgsrc-6c9a4b56353dbe058e988a9acc0042800e92f421.tar.gz
Add patch from Manuel Tobias Schiller:
I managed to trace things to the file libmetrics/netbsd/metrics.c in the get_netbw function. Apparently, the code in get_netbw violates alignment constraints for sparc64. I attached a patch against the result of a "make patch" in parallel/ganglia-monitor-core. While I was at it, I also changed proc_run_func somewhat to only count actually running processes (having a look at NetBSD's ps(1) implementation) - without the change, I got around 30 running processes on an idle machine. "Looks good at a quick glance" martin@ Bump PKGREVISION.
Diffstat (limited to 'parallel/ganglia-monitor-core')
-rw-r--r--parallel/ganglia-monitor-core/Makefile4
-rw-r--r--parallel/ganglia-monitor-core/distinfo4
-rw-r--r--parallel/ganglia-monitor-core/patches/patch-ac173
3 files changed, 175 insertions, 6 deletions
diff --git a/parallel/ganglia-monitor-core/Makefile b/parallel/ganglia-monitor-core/Makefile
index da726c75154..bf308666018 100644
--- a/parallel/ganglia-monitor-core/Makefile
+++ b/parallel/ganglia-monitor-core/Makefile
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.28 2010/09/14 11:02:39 wiz Exp $
+# $NetBSD: Makefile,v 1.29 2010/11/18 13:50:09 wiz Exp $
#
DISTNAME= ganglia-3.1.2
PKGNAME= ganglia-monitor-core-3.1.2
-PKGREVISION= 3
+PKGREVISION= 4
CATEGORIES= net parallel
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=ganglia/}
diff --git a/parallel/ganglia-monitor-core/distinfo b/parallel/ganglia-monitor-core/distinfo
index 06d6386ce08..570d052e9f5 100644
--- a/parallel/ganglia-monitor-core/distinfo
+++ b/parallel/ganglia-monitor-core/distinfo
@@ -1,8 +1,8 @@
-$NetBSD: distinfo,v 1.9 2009/11/10 14:55:17 brook Exp $
+$NetBSD: distinfo,v 1.10 2010/11/18 13:50:09 wiz Exp $
SHA1 (ganglia-3.1.2.tar.gz) = be5db246eb755d8c450140d1c80afef4f1179fe1
RMD160 (ganglia-3.1.2.tar.gz) = 1f78cf1019759e12c3c65901fd74ac65dfddf4e3
Size (ganglia-3.1.2.tar.gz) = 1213196 bytes
SHA1 (patch-aa) = e258e4efb1ae012db51901de87e614cede78812c
SHA1 (patch-ab) = 260a78711c2c7f1111ce8c4b0d54d2edd60dde08
-SHA1 (patch-ac) = 094e07fac40d39093a80dfbee640a1503abaa4cb
+SHA1 (patch-ac) = d7fa7c4509589a88a568717296b1c7ea0b09fb1e
diff --git a/parallel/ganglia-monitor-core/patches/patch-ac b/parallel/ganglia-monitor-core/patches/patch-ac
index 8b29581a947..b5c3a456e47 100644
--- a/parallel/ganglia-monitor-core/patches/patch-ac
+++ b/parallel/ganglia-monitor-core/patches/patch-ac
@@ -1,6 +1,18 @@
-$NetBSD: patch-ac,v 1.3 2009/11/10 14:55:18 brook Exp $
+$NetBSD: patch-ac,v 1.4 2010/11/18 13:50:09 wiz Exp $
---- libmetrics/netbsd/metrics.c.orig 2009-01-28 16:23:20.000000000 -0700
+First chunk: update sysctl name for changes in NetBSD.
+
+Rest:
+From Manuel Tobias Schiller <mala@hinterbergen.de>:
+I managed to trace things to the file libmetrics/netbsd/metrics.c in
+the get_netbw function. Apparently, the code in get_netbw violates
+alignment constraints for sparc64. I attached a patch against the result
+of a "make patch" in parallel/ganglia-monitor-core. While I was at it, I
+also changed proc_run_func somewhat to only count actually running
+processes (having a look at NetBSD's ps(1) implementation) - without the
+change, I got around 30 running processes on an idle machine.
+
+--- libmetrics/netbsd/metrics.c.orig 2009-01-28 23:23:20.000000000 +0000
+++ libmetrics/netbsd/metrics.c
@@ -134,7 +134,10 @@ cpu_speed_func ( void )
@@ -14,3 +26,160 @@ $NetBSD: patch-ac,v 1.3 2009/11/10 14:55:18 brook Exp $
if (sysctlbyname("machdep.est.frequency.target", &cpu_speed, &len, NULL, 0) == -1)
val.uint32 = 0;
#endif
+@@ -559,44 +562,40 @@ proc_total_func ( void )
+ g_val_t
+ proc_run_func( void )
+ {
+- struct kinfo_proc *kp;
+- int i;
+- int state;
+- int nentries;
+- int what = KERN_PROC_ALL;
+ g_val_t val;
++ struct kinfo_proc2 *kp;
++ int cnt, i, j;
++ unsigned int count = 0;
+
+ val.uint32 = 0;
+
+ if (kd == NULL)
+ goto output;
+-#ifdef KERN_PROC_NOTHREADS
+- what |= KERN_PROC_NOTHREADS
+-#endif
+- if ((kp = kvm_getprocs(kd, what, 0, &nentries)) == 0 || nentries < 0)
++ kp = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &cnt);
++ if (0 == kp || cnt < 0)
+ goto output;
+-
+- for (i = 0; i < nentries; kp++, i++) {
+-#ifdef KINFO_PROC_SIZE
+- state = kp->ki_stat;
+-#else
+- state = kp->kp_proc.p_stat;
+-#endif
+- switch(state) {
+-#if (__NetBSD_Version__ >= 200000000)
+- case SACTIVE:
+-#else
+- case SRUN:
+- case SONPROC:
+-#endif
+- case SIDL:
+- val.uint32++;
+- break;
++ for (i = 0; i < cnt; i++) {
++ struct kinfo_lwp* kl;
++ int nlwps;
++ if (((kp + i) -> p_realstat != SACTIVE))
++ continue;
++ kl = kvm_getlwps(kd, (kp + i)->p_pid, (kp + i)->p_paddr,
++ sizeof(struct kinfo_lwp), &nlwps);
++ if (kl == 0)
++ nlwps = 0;
++ if (0 == nlwps) count ++;
++ else {
++ for (j = 0; j < nlwps; j++) {
++ switch (kl[j].l_stat) {
++ case LSRUN:
++ ++count;
++ break;
++ }
++ }
+ }
+ }
+
+- if (val.uint32 > 0)
+- val.uint32--;
++ val.uint32 = count;
+
+ output:
+ return val;
+@@ -1135,36 +1134,41 @@ get_netbw(double *in_bytes, double *out_
+
+ next = buf;
+ while (next < lim) {
++ struct if_msghdr tmp;
+
+ ifm = (struct if_msghdr *)next;
++ memcpy(&tmp, ifm, sizeof(tmp));
+
+- if (ifm->ifm_type == RTM_IFINFO) {
++ if (tmp.ifm_type == RTM_IFINFO) {
+ sdl = (struct sockaddr_dl *)(ifm + 1);
+ } else {
+ fprintf(stderr, "out of sync parsing NET_RT_IFLIST\n");
+ fprintf(stderr, "expected %d, got %d\n", RTM_IFINFO,
+- ifm->ifm_type);
+- fprintf(stderr, "msglen = %d\n", ifm->ifm_msglen);
++ tmp.ifm_type);
++ fprintf(stderr, "msglen = %d\n", tmp.ifm_msglen);
+ fprintf(stderr, "buf:%p, next:%p, lim:%p\n", buf, next,
+ lim);
+ exit (1);
+ }
+
+- next += ifm->ifm_msglen;
++ next += tmp.ifm_msglen;
+ while (next < lim) {
++ unsigned short msglen;
+ nextifm = (struct if_msghdr *)next;
+
+ if (nextifm->ifm_type != RTM_NEWADDR)
+ break;
+
+- next += nextifm->ifm_msglen;
++ memcpy(&msglen, &nextifm->ifm_msglen,
++ sizeof(nextifm->ifm_msglen));
++ next += msglen;
+ }
+
+- if ((ifm->ifm_flags & IFF_LOOPBACK) ||
+- !(ifm->ifm_flags & IFF_UP))
++ if ((tmp.ifm_flags & IFF_LOOPBACK) ||
++ !(tmp.ifm_flags & IFF_UP))
+ continue;
+
+- index = ifm->ifm_index;
++ index = tmp.ifm_index;
+
+ /* If we don't have a previous value yet, make a slot. */
+ if (index >= indexes) {
+@@ -1187,25 +1191,25 @@ get_netbw(double *in_bytes, double *out_
+ */
+ if (!seen[index]) {
+ seen[index] = 1;
+- lastcount[index].in_bytes = ifm->ifm_data.ifi_ibytes;
+- lastcount[index].out_bytes = ifm->ifm_data.ifi_obytes;
+- lastcount[index].in_pkts = ifm->ifm_data.ifi_ipackets;
+- lastcount[index].out_pkts = ifm->ifm_data.ifi_opackets;
++ lastcount[index].in_bytes = tmp.ifm_data.ifi_ibytes;
++ lastcount[index].out_bytes = tmp.ifm_data.ifi_obytes;
++ lastcount[index].in_pkts = tmp.ifm_data.ifi_ipackets;
++ lastcount[index].out_pkts = tmp.ifm_data.ifi_opackets;
+ }
+
+ traffic.in_bytes = counterdiff(lastcount[index].in_bytes,
+- ifm->ifm_data.ifi_ibytes, ULONG_MAX, 0);
++ tmp.ifm_data.ifi_ibytes, ULONG_MAX, 0);
+ traffic.out_bytes = counterdiff(lastcount[index].out_bytes,
+- ifm->ifm_data.ifi_obytes, ULONG_MAX, 0);
++ tmp.ifm_data.ifi_obytes, ULONG_MAX, 0);
+ traffic.in_pkts = counterdiff(lastcount[index].in_pkts,
+- ifm->ifm_data.ifi_ipackets, ULONG_MAX, 0);
++ tmp.ifm_data.ifi_ipackets, ULONG_MAX, 0);
+ traffic.out_pkts = counterdiff(lastcount[index].out_pkts,
+- ifm->ifm_data.ifi_opackets, ULONG_MAX, 0);
++ tmp.ifm_data.ifi_opackets, ULONG_MAX, 0);
+
+- lastcount[index].in_bytes = ifm->ifm_data.ifi_ibytes;
+- lastcount[index].out_bytes = ifm->ifm_data.ifi_obytes;
+- lastcount[index].in_pkts = ifm->ifm_data.ifi_ipackets;
+- lastcount[index].out_pkts = ifm->ifm_data.ifi_opackets;
++ lastcount[index].in_bytes = tmp.ifm_data.ifi_ibytes;
++ lastcount[index].out_bytes = tmp.ifm_data.ifi_obytes;
++ lastcount[index].in_pkts = tmp.ifm_data.ifi_ipackets;
++ lastcount[index].out_pkts = tmp.ifm_data.ifi_opackets;
+
+ #ifdef NETBW_DEBUG
+ if_indextoname(index, name);