[netperf-dev] netperf4 commit notice r41 - trunk/src
burger at netperf.org
burger at netperf.org
Tue Jan 24 13:11:04 PST 2006
Author: burger
Date: 2006-01-24 13:11:02 -0800 (Tue, 24 Jan 2006)
New Revision: 41
Added:
trunk/src/netlib_hpux.c
Modified:
trunk/src/netlib.h
trunk/src/netmsg.c
trunk/src/netperf.c
trunk/src/netperf.h
trunk/src/netperf_docs.dtd
Log:
Added set test locality capability to netperf4.
This required adding new files to do OS specific binding calls.
Also completed implementation of exec_local command.
System commands can now be executed inline in the netperf4 command file.
Removed exec_remote command for the dtd file.
Implementing exec_remote would create a security hole.
Stephen Burger
Modified: trunk/src/netlib.h
===================================================================
--- trunk/src/netlib.h 2006-01-23 23:48:30 UTC (rev 40)
+++ trunk/src/netlib.h 2006-01-24 21:11:02 UTC (rev 41)
@@ -43,6 +43,9 @@
extern void report_servers_test_status(server_t *server);
extern GenReport get_report_function(xmlNodePtr cmd);
extern const char * netperf_error_name(int rc);
+extern int set_test_locality(test_t *test,
+ xmlChar *loc_type,
+ xmlChar *loc_value);
/* do we REALLY want this stuff? */
#ifdef NO_DLOPEN
Added: trunk/src/netlib_hpux.c
===================================================================
--- trunk/src/netlib_hpux.c 2006-01-23 23:48:30 UTC (rev 40)
+++ trunk/src/netlib_hpux.c 2006-01-24 21:11:02 UTC (rev 41)
@@ -0,0 +1,107 @@
+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 $";
+
+/*
+
+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
+
+#include "netperf.h"
+#include "netlib.h"
+
+
+int
+set_thread_locality(test_t *test, char *loc_type, char *loc_value)
+{
+ int err = -1;
+ int value;
+ char *err_str;
+ psetid_t pset;
+ pthread_ldom_t ldom;
+ pthread_spu_t spu;
+
+ if (test->debug) {
+ fprintf(test->where,"%s: \n", __func__);
+ fflush(test->where);
+ }
+
+ value = atoi(loc_value);
+ if (strcmp(loc_type,"PROC") == 0) {
+ err = pthread_processor_bind_np(
+ PTHREAD_BIND_FORCED_NP,
+ &spu,
+ value,
+ test->tid);
+ }
+ else if (strcmp(loc_type,"LDOM") == 0) {
+ err = pthread_ldom_bind_np(
+ &ldom,
+ value,
+ test->tid);
+ }
+ else if (strcmp(loc_type,"PSET") == 0) {
+ err = pthread_pset_bind_np(
+ &pset,
+ value,
+ test->tid);
+ }
+ 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 == -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;
+ }
+ return(err);
+}
+
Modified: trunk/src/netmsg.c
===================================================================
--- trunk/src/netmsg.c 2006-01-23 23:48:30 UTC (rev 40)
+++ trunk/src/netmsg.c 2006-01-24 21:11:02 UTC (rev 41)
@@ -846,6 +846,8 @@
xmlNodePtr new_node;
xmlChar *test_name;
xmlChar *testid;
+ xmlChar *loc_type;
+ xmlChar *loc_value;
NETPERF_DEBUG_ENTRY(debug,where);
@@ -910,7 +912,14 @@
fflush(where);
}
}
-
+ /* Set test thread locality */
+ if (rc == NPE_SUCCESS) {
+ loc_type = xmlGetProp(test_node,(const xmlChar *)"locality_type");
+ loc_value = xmlGetProp(test_node,(const xmlChar *)"locality_value");
+ if ((loc_type != NULL) && (loc_value != NULL)) {
+ rc = set_thread_locality(new_test, loc_type, loc_value);
+ }
+ }
/* wait for test to initialize */
if (rc == NPE_SUCCESS) {
while (new_test->new_state == TEST_PREINIT) {
Modified: trunk/src/netperf.c
===================================================================
--- trunk/src/netperf.c 2006-01-23 23:48:30 UTC (rev 40)
+++ trunk/src/netperf.c 2006-01-24 21:11:02 UTC (rev 41)
@@ -1648,23 +1648,18 @@
static int
exec_local_command(xmlNodePtr cmd, uint32_t junk)
{
- int rc = NPE_SUCCESS;
- fprintf(where,"exec_local_command: routine needs to be completed\n");
+ int rc = NPE_SUCCESS;
+ xmlChar *command;
+
+ command = xmlGetProp(cmd,(const xmlChar *)"command");
+ fprintf(where,"%s: %s\n", __func__, command);
fflush(where);
+ system((char *)command);
return(rc);
}
static int
-exec_remote_command(xmlNodePtr cmd, uint32_t junk)
-{
- int rc = NPE_SUCCESS;
- fprintf(where,"exec_remote_command: routine needs to be completed\n");
- fflush(where);
- return(rc);
-}
-
-static int
exit_netperf_command(xmlNodePtr cmd, uint32_t junk)
{
return(NPE_COMMANDED_TO_EXIT_NETPERF);
Modified: trunk/src/netperf.h
===================================================================
--- trunk/src/netperf.h 2006-01-23 23:48:30 UTC (rev 40)
+++ trunk/src/netperf.h 2006-01-24 21:11:02 UTC (rev 41)
@@ -386,6 +386,7 @@
NPE_XMLPARSEMEMORY_ERROR,
NPE_NEG_MSG_BYTES,
NPE_TIMEOUT,
+ NPE_SET_THREAD_LOCALITY_FAILED,
NPE_SUCCESS = 0
};
@@ -442,7 +443,8 @@
"NPE_SHASH_ADD_FAILED",
"NPE_XMLPARSEMEMORY_ERROR",
"NPE_NEG_MSG_BYTES",
- "NPE_TIMEOUT"
+ "NPE_TIMEOUT",
+ "NPE_SET_THREAD_LOCALITY_FAILED"
};
#endif
Modified: trunk/src/netperf_docs.dtd
===================================================================
--- trunk/src/netperf_docs.dtd 2006-01-23 23:48:30 UTC (rev 40)
+++ trunk/src/netperf_docs.dtd 2006-01-24 21:11:02 UTC (rev 41)
@@ -90,7 +90,6 @@
(delete_test_set) |
(die) |
(exec_local) |
- (exec_remote) |
(exit) |
(get_stats) |
(idle) |
@@ -166,13 +165,15 @@
<!ELEMENT test ((dependson | dependency_data)?, (socket_args | unknown )?,
(dns_args)? ) >
<!ATTLIST test
- xmlns CDATA #FIXED "http://www.netperf.org/ns/netperf"
- tid ID #REQUIRED
- test_name CDATA "send_tcp_stream"
- library CDATA #REQUIRED
- test_clear CDATA #IMPLIED
- test_stats CDATA #IMPLIED
- test_decode CDATA #IMPLIED
+ xmlns CDATA #FIXED "http://www.netperf.org/ns/netperf"
+ tid ID #REQUIRED
+ test_name CDATA "send_tcp_stream"
+ library CDATA #REQUIRED
+ test_clear CDATA #IMPLIED
+ test_stats CDATA #IMPLIED
+ test_decode CDATA #IMPLIED
+ locality_type CDATA #IMPLIED
+ locality_value CDATA #IMPLIED
>
<!-- test_name
The attributes allow definition of different function symbol names.
@@ -190,6 +191,13 @@
accumulate, and report the statics counters for the tests in the library.
If test_decode is not specified the default function name will be used
which is the concatination of the test_name with "_decode_stats" -->
+<!-- locality_type is used to specify the type of locality binding which should
+ be performed. If locality_type is not specified no binding occurs.
+ For HP-UX valid locality_type values are ( PSET | LDOM | PROC ).
+ If an invalid locality_type is specified no binding occurs. -->
+<!-- locality_value is used to specify the id to which to bind. The value is
+ system specific. If locality_value is not specified no binding occurs.
+ If an invalid locality_value is specified no binding occurs. -->
<!ELEMENT unknown (#PCDATA) >
@@ -261,15 +269,7 @@
command CDATA #REQUIRED
>
-<!-- exec_remote is a security hole and is not implemented -->
-<!ELEMENT exec_remote EMPTY >
-<!ATTLIST exec_remote
- nid ID #REQUIRED
- command CDATA #REQUIRED
->
-
-
<!ELEMENT get_stats EMPTY >
<!ATTLIST get_stats
xmlns CDATA #FIXED "http://www.netperf.org/ns/netperf"
@@ -345,7 +345,6 @@
(create_test_set) |
(delete_test_set) |
(exec_local) |
- (exec_remote) |
(get_stats) |
(idle) |
(init) |
More information about the netperf-dev
mailing list