[netperf-dev] netperf2 commit notice r248 - in trunk: . src

raj at netperf.org raj at netperf.org
Fri Mar 7 14:52:25 PST 2008


Author: raj
Date: 2008-03-07 14:52:24 -0800 (Fri, 07 Mar 2008)
New Revision: 248

Added:
   trunk/src/netsys_hpux11i.c
Modified:
   trunk/configure
   trunk/configure.ac
Log:
get system information from hpux 11i systems

Modified: trunk/configure
===================================================================
--- trunk/configure	2008-03-07 20:03:29 UTC (rev 247)
+++ trunk/configure	2008-03-07 22:52:24 UTC (rev 248)
@@ -9715,10 +9715,29 @@
 
 NETSYSLKUP_SOURCE="$enable_syslookup"
 case "$enable_syslookup" in
+	hpux11i)
+		use_drvlookup=true
 
+cat >>confdefs.h <<\_ACEOF
+#define USE_HPUX
+_ACEOF
+
+		;;
+
+
 	'')
 # guess it automagically in a nice big case statement
 		case $target in
+		     *-*-hpux11.1231)
+			use_drvlookup=true
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_HPUX
+_ACEOF
+
+			enable_drvlookup="hpux11i - auto"
+			NETDRVLKUP_SOURCE="hpux11i"
+			;;
 		     *)
 			use_syslookup=false
 			NETSYSLKUP_SOURCE="none"
@@ -9730,8 +9749,8 @@
 		use_syslookup=false
 		;;
 	*)
-		{ { echo "$as_me:$LINENO: error: --enable-syslookup takes none" >&5
-echo "$as_me: error: --enable-syslookup takes none" >&2;}
+		{ { echo "$as_me:$LINENO: error: --enable-syslookup takes hpux or none" >&5
+echo "$as_me: error: --enable-syslookup takes hpux or none" >&2;}
    { (exit 1); exit 1; }; }
 		;;
 esac

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2008-03-07 20:03:29 UTC (rev 247)
+++ trunk/configure.ac	2008-03-07 22:52:24 UTC (rev 248)
@@ -878,10 +878,21 @@
 
 NETSYSLKUP_SOURCE="$enable_syslookup"
 case "$enable_syslookup" in
+	hpux11i)
+		use_drvlookup=true
+		AC_DEFINE([USE_HPUX],,[Use pstat and sysinfo on HP-UX.])
+		;;
 
+
 	'')
 # guess it automagically in a nice big case statement
 		case $target in
+		     *-*-hpux11.[123]1)
+			use_drvlookup=true
+			AC_DEFINE([USE_HPUX],,[Use Linux's ethtool interface to determine driver information.])
+			enable_drvlookup="hpux11i - auto"
+			NETDRVLKUP_SOURCE="hpux11i"
+			;;
 		     *)
 			use_syslookup=false
 			NETSYSLKUP_SOURCE="none"
@@ -893,7 +904,7 @@
 		use_syslookup=false
 		;;
 	*)
-		AC_MSG_ERROR([--enable-syslookup takes none])
+		AC_MSG_ERROR([--enable-syslookup takes hpux or none])
 		;;
 esac
 

Added: trunk/src/netsys_hpux11i.c
===================================================================
--- trunk/src/netsys_hpux11i.c	                        (rev 0)
+++ trunk/src/netsys_hpux11i.c	2008-03-07 22:52:24 UTC (rev 248)
@@ -0,0 +1,52 @@
+#include <string.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/pstat.h>
+
+/* tusc can be a very useful thing... */
+
+#ifndef _SI_MACHINE_MODEL
+#define _SI_MACHING_MODEL 5
+#endif
+
+extern int sysinfo(int info, char *buffer, int len);
+
+
+void
+find_system_info(char **system_model, char **cpu_model, int *cpu_frequency) {
+  char model_str[64];
+  int  ret;
+
+  struct pst_processor processor_info;
+
+  /* first the system model name */
+  ret = sysinfo(_SI_MACHINE_MODEL,model_str,64);
+  model_str[63] = 0;
+  *system_model = strdup(model_str);
+
+  /* now lets try to find processor frequency. we will for now
+     ass-u-me that an index of zero will always get us something,
+     which may not actually be the case but lets see how long it takes
+     to be noticed :) raj 2008-03-07 */
+  ret = pstat_getprocessor(&processor_info,
+			   sizeof(processor_info),
+			   1, /* one processor, one processor only please */
+			   0);
+
+  if (ret > 0) {
+#ifdef PAP_MAX_CACHE_LEVELS
+    /* we can get it "directly" */
+    *cpu_frequency = processor_info.psp_cpu_frequency / 1000000;
+#else
+    /* older OSes were "known" to be on CPUs where the itick was
+       1to1 here */
+    *cpu_frequency = 
+      (processor_info.psp_iticksperclktick * sysconf(_SC_CLK_TCK)) / 1000000;
+#endif 
+  }
+  else
+    *cpu_frquency = -1;
+
+  *cpu_model = strdup("Unknown CPU Model");
+}
+  



More information about the netperf-dev mailing list