[netperf-dev] netperf4 commit notice r42 - in trunk: . src

raj at netperf.org raj at netperf.org
Tue Jan 24 14:48:36 PST 2006


Author: raj
Date: 2006-01-24 14:48:31 -0800 (Tue, 24 Jan 2006)
New Revision: 42

Added:
   trunk/src/netlib_linux.c
Modified:
   trunk/config.h.in
   trunk/configure
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/Makefile.in
   trunk/src/netlib_hpux.c
   trunk/src/netperf.c
Log:
Fixups for netlib_hpux.c, add netlib_linux.c and alter Makefile and configure
accordingly


Modified: trunk/config.h.in
===================================================================
--- trunk/config.h.in	2006-01-24 21:11:02 UTC (rev 41)
+++ trunk/config.h.in	2006-01-24 22:48:31 UTC (rev 42)
@@ -135,9 +135,15 @@
 /* Define to 1 if you have the `processor_bind' function. */
 #undef HAVE_PROCESSOR_BIND
 
+/* Define to 1 if you have the <pthread.h> header file. */
+#undef HAVE_PTHREAD_H
+
 /* Define to 1 if you have the <resolv.h> header file. */
 #undef HAVE_RESOLV_H
 
+/* Define to 1 if you have the <sched.h> header file. */
+#undef HAVE_SCHED_H
+
 /* Define to 1 if you have the `sched_setaffinity' function. */
 #undef HAVE_SCHED_SETAFFINITY
 

Modified: trunk/configure
===================================================================
--- trunk/configure	2006-01-24 21:11:02 UTC (rev 41)
+++ trunk/configure	2006-01-24 22:48:31 UTC (rev 42)
@@ -20992,7 +20992,9 @@
 
 
 
-for ac_header in arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h math.h arpa/nameser.h resolv.h poll.h
+
+
+for ac_header in arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h math.h arpa/nameser.h resolv.h poll.h pthread.h sched.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2006-01-24 21:11:02 UTC (rev 41)
+++ trunk/configure.ac	2006-01-24 22:48:31 UTC (rev 42)
@@ -33,7 +33,7 @@
 # Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h math.h arpa/nameser.h resolv.h poll.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h math.h arpa/nameser.h resolv.h poll.h pthread.h sched.h])
 
 # Some platforms require these.  There may be a better way.
 AC_HAVE_LIBRARY(socket)

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2006-01-24 21:11:02 UTC (rev 41)
+++ trunk/src/Makefile.am	2006-01-24 22:48:31 UTC (rev 42)
@@ -4,17 +4,20 @@
 
 AM_CFLAGS = $(NETPERF_CFLAGS)
 
+# for now we will use "NETSYS_SOURCE" for both the netsysstats and
+# netlib platform-specific stuff
 USE_CPU_SOURCE=netsysstats_ at NETSYS_SOURCE@.c
+USE_NETLIB_SOURCE=netlib_ at NETSYS_SOURCE@.c
 
 # anything that might be platform-specific and thus not covered
 # directly in COMMON_SRC or *_SOURCES should be in EXTRA_DIST
 
 EXTRA_DIST = missing/* dirs NetPerf/* NetServer/* *.xml netperf_docs.dtd netperf.h netsysstats*.c 
 
-COMMON_SRC = netperf_hist.h netlib.c netperf.h netlib.h netcpu.h netmsg.c netconfidence.c netconfidence.h
+COMMON_SRC = netperf_hist.h netlib.c netperf.h netlib.h netcpu.h netmsg.c netconfidence.c netconfidence.h 
 
-netperf_SOURCES = netperf.c $(COMMON_SRC)
-netserver_SOURCES = netserver.c $(COMMON_SRC)
+netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_NETLIB_SOURCE)
+netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_NETLIB_SOURCE)
 
 # in theory this will cause these header files to be put in the
 # installed headers location, where folks who want to make their own

Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in	2006-01-24 21:11:02 UTC (rev 41)
+++ trunk/src/Makefile.in	2006-01-24 22:48:31 UTC (rev 42)
@@ -143,17 +143,20 @@
 
 AM_CFLAGS = $(NETPERF_CFLAGS)
 
+# for now we will use "NETSYS_SOURCE" for both the netsysstats and
+# netlib platform-specific stuff
 USE_CPU_SOURCE = netsysstats_ at NETSYS_SOURCE@.c
+USE_NETLIB_SOURCE = netlib_ at NETSYS_SOURCE@.c
 
 
 # anything that might be platform-specific and thus not covered
 # directly in COMMON_SRC or *_SOURCES should be in EXTRA_DIST
 EXTRA_DIST = missing/* dirs NetPerf/* NetServer/* *.xml netperf_docs.dtd netperf.h netsysstats*.c 
 
-COMMON_SRC = netperf_hist.h netlib.c netperf.h netlib.h netcpu.h netmsg.c netconfidence.c netconfidence.h
+COMMON_SRC = netperf_hist.h netlib.c netperf.h netlib.h netcpu.h netmsg.c netconfidence.c netconfidence.h 
 
-netperf_SOURCES = netperf.c $(COMMON_SRC)
-netserver_SOURCES = netserver.c $(COMMON_SRC)
+netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_NETLIB_SOURCE)
+netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_NETLIB_SOURCE)
 
 # in theory this will cause these header files to be put in the
 # installed headers location, where folks who want to make their own
@@ -207,10 +210,12 @@
 
 am__objects_2 = netlib.$(OBJEXT) netmsg.$(OBJEXT) \
 	netconfidence.$(OBJEXT)
-am_netperf_OBJECTS = netperf.$(OBJEXT) $(am__objects_2)
+am__objects_3 = netlib_ at NETSYS_SOURCE@.$(OBJEXT)
+am_netperf_OBJECTS = netperf.$(OBJEXT) $(am__objects_2) $(am__objects_3)
 netperf_OBJECTS = $(am_netperf_OBJECTS)
 netperf_DEPENDENCIES = @LIBOBJS@
-am_netserver_OBJECTS = netserver.$(OBJEXT) $(am__objects_2)
+am_netserver_OBJECTS = netserver.$(OBJEXT) $(am__objects_2) \
+	$(am__objects_3)
 netserver_OBJECTS = $(am_netserver_OBJECTS)
 netserver_DEPENDENCIES = @LIBOBJS@
 netserver_LDFLAGS =
@@ -224,6 +229,7 @@
 @AMDEP_TRUE@	$(DEPDIR)/missing/getopt1.Po \
 @AMDEP_TRUE@	$(DEPDIR)/missing/inet_ntop.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/netconfidence.Po ./$(DEPDIR)/netlib.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/netlib_ at NETSYS_SOURCE@.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/netmsg.Po ./$(DEPDIR)/netperf.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/netserver.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/netsysstats_ at NETSYS_SOURCE@.Plo \
@@ -342,6 +348,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/missing/inet_ntop.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netconfidence.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netlib.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netlib_ at NETSYS_SOURCE@.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netmsg.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netperf.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netserver.Po at am__quote@

Modified: trunk/src/netlib_hpux.c
===================================================================
--- trunk/src/netlib_hpux.c	2006-01-24 21:11:02 UTC (rev 41)
+++ trunk/src/netlib_hpux.c	2006-01-24 22:48:31 UTC (rev 42)
@@ -1,5 +1,5 @@
-char netlib_specific_id[]="\
-@(#)netlib_hpux.c (c) Copyright 2005, Hewlett-Packard Company, $Id: netlib_hpux.c 21 2006-1-19 01:07:54Z burger $";
+static char netlib_specific_id[]="\
+@(#)(c) Copyright 2006 Hewlett-Packard Company, $Id: netlib_hpux.c 21 2006-1-19 01:07:54Z burger $";
 
 /*
 
@@ -40,6 +40,12 @@
 #include <unistd.h>
 #endif
 
+/* mustn't forget the include file for the pthread_mumble stuff... raj
+   2006-01-24 */
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+#endif
+
 #include "netperf.h"
 #include "netlib.h"
 
@@ -54,10 +60,7 @@
   pthread_ldom_t ldom;
   pthread_spu_t  spu;
 
-  if (test->debug) {
-    fprintf(test->where,"%s: \n", __func__);
-    fflush(test->where);
-  }
+  NETPERF_DEBUG_ENTRY(test->debug,test->where);
 
   value  = atoi(loc_value);
   if (strcmp(loc_type,"PROC") == 0) {
@@ -102,6 +105,9 @@
   else {
     err = NPE_SUCCESS;
   }
+
+  NETPERF_DEBUG_EXIT(test->debug,test->where);
+
   return(err);
 }
 

Added: trunk/src/netlib_linux.c
===================================================================
--- trunk/src/netlib_linux.c	2006-01-24 21:11:02 UTC (rev 41)
+++ trunk/src/netlib_linux.c	2006-01-24 22:48:31 UTC (rev 42)
@@ -0,0 +1,136 @@
+static char netlib_specific_id[]="\
+@(#)(c) Copyright 2006, Hewlett-Packard Company, $Id: netlib_hpux.c 21 2006-1-19 01:07:54Z burger $";
+
+/*
+
+This file is part of netperf4.
+
+Netperf4 is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+Netperf4 is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+USA.
+
+In addition, as a special exception, the copyright holders give
+permission to link the code of netperf4 with the OpenSSL project's
+"OpenSSL" library (or with modified versions of it that use the same
+license as the "OpenSSL" library), and distribute the linked
+executables.  You must obey the GNU General Public License in all
+respects for all of the code used other than "OpenSSL".  If you modify
+this file, you may extend this exception to your version of the file,
+but you are not obligated to do so.  If you do not wish to do so,
+delete this exception statement from your version.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_SCHED_H
+#include <sched.h>
+#endif
+
+#include <errno.h>
+
+#include "netperf.h"
+#include "netlib.h"
+
+
+#ifdef HAVE_SCHED_SETAFFINITY
+int
+set_thread_locality(test_t *test, char *loc_type, char *loc_value)
+{
+  int   err = -1;
+  int   value;
+  char *err_str;
+  cpu_set_t      mask;
+
+
+  NETPERF_DEBUG_ENTRY(test->debug,test->where);
+
+  CPU_ZERO(&mask);
+
+  /* OK, right off the bat I see we have a potential issue with > 32
+     CPUs if we just use atoi() so we'll need something else at some
+     point. raj 2006-01-24 */
+
+  value  = atoi(loc_value);
+
+  CPU_SET(value, &mask);
+
+  /* under linux, for now at least, all the flavors of affinity are
+     the same. we keep the strucutre from the HP-UX version just for
+     grins. raj 2006-01-24 */
+
+  if (strcmp(loc_type,"PROC") == 0) {
+    err  = sched_setaffinity(test->tid,
+			     sizeof(mask),
+			     &mask);
+  }
+  else if (strcmp(loc_type,"LDOM") == 0) {
+    err  = sched_setaffinity(test->tid,
+			     sizeof(mask),
+			     &mask);
+  }
+  else if (strcmp(loc_type,"PSET") == 0) {
+    err  = sched_setaffinity(test->tid,
+			     sizeof(mask),
+			     &mask);
+  }
+  if (err) {
+    if (err == EINVAL) {
+      err_str = "Invalid locality value";
+    }
+    if (err == EPERM) {
+      err_str = "Netserver Permission Failure";
+    }
+    if (err == ESRCH) {
+      err_str = "Invalid thread id";
+    }
+    if (err == EFAULT) {
+      err_str = "Invalid memory address";
+    }
+    if (err == -1) {
+      err_str = "Invalid locality type";
+    }
+    fprintf(test->where,
+            "%s: failed to set locality %s\n",
+            __func__,
+            err_str);
+    fflush(test->where);
+    err = NPE_SET_THREAD_LOCALITY_FAILED;
+  }
+  else {
+    err = NPE_SUCCESS;
+  }
+  NETPERF_DEBUG_EXIT(test->debug,test->where);
+  return(err);
+}
+#else
+int
+set_thread_locality(test_t *test, char *loc_type, char *loc_value)
+{
+  NETPERF_DEBUG_ENTRY(test->debug,test->where);
+  if (test->debug) {
+    fprintf(test->where,
+	    "No call to set CPU affinity available, request ignored.\n");
+    fflush(test->where);
+  }
+  NETPERF_DEBUG_EXIT(test->debug,test->where);
+  return(NPE_SUCCESS);
+}
+#endif

Modified: trunk/src/netperf.c
===================================================================
--- trunk/src/netperf.c	2006-01-24 21:11:02 UTC (rev 41)
+++ trunk/src/netperf.c	2006-01-24 22:48:31 UTC (rev 42)
@@ -1850,7 +1850,7 @@
   { "close",           close_command,           0               },
   { "exit",            exit_netperf_command,    0               },
   { "exec_local",      exec_local_command,      0               },
-  { "exec_remote",     exec_remote_command,     0               },
+  { "exec_remote",     unknown_command,         0               },
   { NULL,              unknown_command,         0               }
 };
 



More information about the netperf-dev mailing list