diff options
Diffstat (limited to 'parallel/sge/patches/patch-ax')
-rw-r--r-- | parallel/sge/patches/patch-ax | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/parallel/sge/patches/patch-ax b/parallel/sge/patches/patch-ax new file mode 100644 index 00000000000..bff311c0c30 --- /dev/null +++ b/parallel/sge/patches/patch-ax @@ -0,0 +1,53 @@ +$NetBSD: patch-ax,v 1.1.1.1 2004/05/03 00:38:35 dmcmahill Exp $ + +--- source/libs/uti/sge_getloadavg.c 2003-10-02 14:25:49.000000000 +0200 ++++ source/libs/uti/sge_getloadavg.c 2003-10-01 17:11:38.000000000 +0200 +@@ -185,6 +185,8 @@ + # define KERNEL_AVG_TYPE double + # define VMUNIX "/stand/vmunix" + # define X_CP_TIME 0 ++#elif defined(NETBSD) ++# include <sys/sched.h> + #endif + + #if defined(SOLARIS) || defined(SOLARIS64) || defined(FREEBSD) +@@ -827,6 +829,30 @@ + return cpu_load; + } + ++#elif defined(NETBSD) ++ ++#include <sys/param.h> ++#include <sys/sysctl.h> ++ ++double get_cpu_load() { ++ int mib[2]; ++ static long cpu_time[CPUSTATES]; ++ static long cpu_old[CPUSTATES]; ++ static long cpu_diff[CPUSTATES]; ++ double cpu_states[CPUSTATES]; ++ double cpu_load; ++ size_t size; ++ ++ mib[0] = CTL_KERN; mib[1] = KERN_CP_TIME; ++ size = sizeof(cpu_time); ++ sysctl(mib, 2, &cpu_time, &size, NULL, 0); ++ percentages(CPUSTATES, cpu_states, cpu_time, cpu_old, cpu_diff); ++ cpu_load = cpu_states[0] + cpu_states[1] + cpu_states[2]; ++ if (cpu_load < 0.0) { ++ cpu_load = -1.0; } ++ ++ return cpu_load; } ++ + #endif + + #if defined(ALPHA4) || defined(ALPHA5) || defined(IRIX6) || defined(HP10) || (defined(SOLARIS) && !defined(SOLARIS64)) +@@ -1150,7 +1176,7 @@ + ) { + int elem = 0; + +-#if defined(SOLARIS64) || defined(FREEBSD) || defined(DARWIN) ++#if defined(SOLARIS64) || defined(FREEBSD) || defined(DARWIN) || defined(NETBSD) + elem = getloadavg(loadavg, nelem); /* <== library function */ + #elif (defined(SOLARIS) && !defined(SOLARIS64)) || defined(ALPHA4) || defined(ALPHA5) || defined(IRIX6) || defined(HP10) || defined(HP11) || defined(CRAY) || defined(NECSX4) || defined(NECSX5) || defined(LINUX) + elem = get_load_avg(loadavg, nelem); |