[netperf-dev] netperf2 commit notice r222 - trunk/src
raj at netperf.org
raj at netperf.org
Fri Feb 8 11:56:18 PST 2008
Author: raj
Date: 2008-02-08 11:56:17 -0800 (Fri, 08 Feb 2008)
New Revision: 222
Modified:
trunk/src/netlib.c
trunk/src/netlib.h
trunk/src/netserver.c
trunk/src/nettest_omni.c
Log:
teach netperf omni about uname information
Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c 2008-02-08 17:58:39 UTC (rev 221)
+++ trunk/src/netlib.c 2008-02-08 19:56:17 UTC (rev 222)
@@ -238,6 +238,11 @@
char *local_data_address=NULL;
char *remote_data_address=NULL;
+char *local_sysname, *remote_sysname;
+char *local_release, *remote_release;
+char *local_version, *remote_version;
+char *local_machine, *remote_machine;
+
int local_data_family=AF_UNSPEC;
int remote_data_family=AF_UNSPEC;
@@ -1107,6 +1112,32 @@
#endif
}
+void
+get_local_system_info()
+{
+#ifndef WIN32
+ struct utsname buf;
+ if (uname(&buf) == 0) {
+ local_sysname = strdup(buf.sysname);
+ local_release = strdup(buf.release);
+ local_version = strdup(buf.version);
+ local_machine = strdup(buf.machine);
+ }
+ else {
+ local_sysname = strdup("UnknownSystem");
+ local_release = strdup("UnknownRelease");
+ local_version = strdup("UnknownVersion");
+ local_machine = strdup("UnknownMachine");
+ }
+#else
+ local_sysname = strdup("Windows");
+ local_release = strdup("UnknownRelease");
+ local_version = strdup("UnknownVersion");
+ local_machine = strdup("UnknownMachine");
+
+#endif
+}
+
/****************************************************************/
/* */
@@ -1135,6 +1166,9 @@
lib_remote_peak_cpu_id = -1;
lib_remote_peak_cpu_util = -1.0;
+ /* retrieve the local system information */
+ get_local_system_info();
+
/* on those systems where we know that CPU numbers may not start at
zero and be contiguous, we provide a way to map from a
contiguous, starting from 0 CPU id space to the actual CPU ids.
@@ -2594,6 +2628,48 @@
recv_response_timed_n(0,n);
}
+void
+get_remote_system_info()
+{
+ int ret;
+ char delim[2];
+ char *token;
+
+ netperf_request.content.request_type = DO_SYSINFO;
+ send_request();
+ recv_response_n(0);
+ if (!netperf_response.content.serv_errno) {
+ delim[1] = '\0';
+ delim[0] = *(char *)netperf_response.content.test_specific_data;
+#if 0
+ token = (char *)netperf_response.content.test_specific_data +
+ (sizeof(netperf_response) - 7); /* OBOB? */
+ *token = 0;
+#endif
+ printf("sizeof %d start %p token %p delim %s\n",
+ sizeof(netperf_response), &netperf_response,token,delim);
+ token = strtok((char *)netperf_response.content.test_specific_data,delim);
+ if (token) remote_sysname = strdup(token);
+ else remote_sysname = strdup("UnknownRemoteSysname");
+ token = strtok(NULL,delim);
+ if (token) remote_release = strdup(token);
+ else remote_release = strdup("UnknownRemoteRelease");
+ token = strtok(NULL,delim);
+ if (token) remote_machine = strdup(token);
+ else remote_machine = strdup("UnknownRemoteMachine");
+ token = strtok(NULL,delim);
+ if (token) remote_version = strdup(token);
+ else remote_version = strdup("UnknownRemoteVersion");
+ }
+ else {
+ remote_sysname = strdup("UnknownRemoteSysname");
+ remote_release = strdup("UnknownRemoteRelease");
+ remote_machine = strdup("UnknownRemoteMachine");
+ remote_version = strdup("UnknownRemoteVersion");
+ }
+
+}
+
#if defined(USE_PSTAT) || defined (USE_SYSCTL)
@@ -3504,6 +3580,8 @@
return(remrate);
}
}
+
+
#ifndef WIN32
/* WIN32 requires that at least one of the file sets to select be non-null. */
Modified: trunk/src/netlib.h
===================================================================
--- trunk/src/netlib.h 2008-02-08 17:58:39 UTC (rev 221)
+++ trunk/src/netlib.h 2008-02-08 19:56:17 UTC (rev 222)
@@ -225,6 +225,9 @@
#define SDP_CC_RESPONSE 553
#define SDP_CC_RESULTS 554
+#define DO_SYSINFO 600
+#define SYSINFO_RESPONSE 601
+
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
@@ -432,6 +435,11 @@
extern char *local_data_address;
extern char *remote_data_address;
+extern char *local_sysname, *remote_sysname;
+extern char *local_release, *remote_release;
+extern char *local_version, *remote_version;
+extern char *local_machine, *remote_machine;
+
extern int local_data_family;
extern int remote_data_family;
@@ -509,6 +517,8 @@
int *effective_sizep);
extern char *format_units();
+extern void get_remote_system_info();
+
extern char *inet_ftos(int family);
extern char *inet_ttos(int type);
extern char *inet_ptos(int protocol);
Modified: trunk/src/netserver.c
===================================================================
--- trunk/src/netserver.c 2008-02-08 17:58:39 UTC (rev 221)
+++ trunk/src/netserver.c 2008-02-08 19:56:17 UTC (rev 222)
@@ -248,7 +248,53 @@
#endif /* !WIN32 !MPE !__VMS */
}
break;
-
+
+ case DO_SYSINFO:
+ {
+ char *delims[4];
+ int i;
+ delims[0] = strdup("|");
+ delims[1] = strdup(",");
+ delims[2] = strdup("_");
+ delims[3] = strdup(";");
+
+ netperf_response.content.response_type = SYSINFO_RESPONSE;
+ for (i = 0; i < 4; i++) {
+ if ((!strstr(local_sysname,delims[i])) &&
+ (!strstr(local_release,delims[i])) &&
+ (!strstr(local_machine,delims[i])) &&
+ (!strstr(local_version,delims[i]))) {
+ snprintf((char *)netperf_response.content.test_specific_data,
+ sizeof(netperf_response) - 7,
+ "%c%s%c%s%c%s%c%s",
+ delims[i][0],
+ local_sysname,
+ delims[i][0],
+ local_release,
+ delims[i][0],
+ local_machine,
+ delims[i][0],
+ local_version);
+ break;
+ }
+ }
+ if (i == 4) {
+ /* none of the delimiters were unique, use the last one */
+ snprintf((char *)netperf_response.content.test_specific_data,
+ sizeof(netperf_response) - 7,
+ "%c%s%c%s%c%s%c%s",
+ delims[i][0],
+ "NoDelimUnique",
+ delims[i][0],
+ "NoDelimUnique",
+ delims[i][0],
+ "NoDelimUnique",
+ delims[i][0],
+ "NoDelimUnique");
+ }
+ send_response_n(0);
+ break;
+ }
case CPU_CALIBRATE:
netperf_response.content.response_type = CPU_CALIBRATE;
temp_rate = calibrate_local_cpu(0.0);
Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c 2008-02-08 17:58:39 UTC (rev 221)
+++ trunk/src/nettest_omni.c 2008-02-08 19:56:17 UTC (rev 222)
@@ -436,6 +436,14 @@
REMOTE_RECV_CLEAN_COUNT,
REMOTE_NODELAY,
REMOTE_CORK,
+ LOCAL_SYSNAME,
+ LOCAL_RELEASE,
+ LOCAL_VERSION,
+ LOCAL_MACHINE,
+ REMOTE_SYSNAME,
+ REMOTE_RELEASE,
+ REMOTE_VERSION,
+ REMOTE_MACHINE,
OUTPUT_END,
NETPERF_OUTPUT_MAX
};
@@ -773,6 +781,22 @@
return "REMOTE_NODELAY";
case REMOTE_CORK:
return "REMOTE_CORK";
+ case REMOTE_SYSNAME:
+ return "REMOTE_SYSNAME";
+ case REMOTE_MACHINE:
+ return "REMOTE_MACHINE";
+ case REMOTE_VERSION:
+ return "REMOTE_VERSION";
+ case REMOTE_RELEASE:
+ return "REMOTE_RELEASE";
+ case LOCAL_SYSNAME:
+ return "LOCAL_SYSNAME";
+ case LOCAL_MACHINE:
+ return "LOCAL_MACHINE";
+ case LOCAL_VERSION:
+ return "LOCAL_VERSION";
+ case LOCAL_RELEASE:
+ return "LOCAL_RELEASE";
case OUTPUT_END:
return "OUTPUT_END";
default:
@@ -1110,6 +1134,14 @@
output_csv_list[i++] = REMOTE_RECV_CLEAN_COUNT;
output_csv_list[i++] = REMOTE_NODELAY;
output_csv_list[i++] = REMOTE_CORK;
+ output_csv_list[i++] = LOCAL_SYSNAME;
+ output_csv_list[i++] = LOCAL_RELEASE;
+ output_csv_list[i++] = LOCAL_VERSION;
+ output_csv_list[i++] = LOCAL_MACHINE;
+ output_csv_list[i++] = REMOTE_SYSNAME;
+ output_csv_list[i++] = REMOTE_RELEASE;
+ output_csv_list[i++] = REMOTE_VERSION;
+ output_csv_list[i++] = REMOTE_MACHINE;
output_csv_list[i++] = RESULT_BRAND;
output_csv_list[i++] = COMMAND_LINE;
@@ -2282,6 +2314,102 @@
netperf_output_source[REMOTE_CORK].tot_line_len =
NETPERF_LINE_TOT(REMOTE_CORK);
+ netperf_output_source[REMOTE_MACHINE].output_name = REMOTE_MACHINE;
+ netperf_output_source[REMOTE_MACHINE].line[0] = "Remote";
+ netperf_output_source[REMOTE_MACHINE].line[1] = "Machine";
+ netperf_output_source[REMOTE_MACHINE].line[2] = "";
+ netperf_output_source[REMOTE_MACHINE].line[3] = "";
+ netperf_output_source[REMOTE_MACHINE].format = "%s";
+ netperf_output_source[REMOTE_MACHINE].display_value = remote_machine;
+ netperf_output_source[REMOTE_MACHINE].max_line_len =
+ NETPERF_LINE_MAX(REMOTE_MACHINE);
+ netperf_output_source[REMOTE_MACHINE].tot_line_len =
+ NETPERF_LINE_TOT(REMOTE_MACHINE);
+
+ netperf_output_source[REMOTE_VERSION].output_name = REMOTE_VERSION;
+ netperf_output_source[REMOTE_VERSION].line[0] = "Remote";
+ netperf_output_source[REMOTE_VERSION].line[1] = "Version";
+ netperf_output_source[REMOTE_VERSION].line[2] = "";
+ netperf_output_source[REMOTE_VERSION].line[3] = "";
+ netperf_output_source[REMOTE_VERSION].format = "%s";
+ netperf_output_source[REMOTE_VERSION].display_value = remote_version;
+ netperf_output_source[REMOTE_VERSION].max_line_len =
+ NETPERF_LINE_MAX(REMOTE_VERSION);
+ netperf_output_source[REMOTE_VERSION].tot_line_len =
+ NETPERF_LINE_TOT(REMOTE_VERSION);
+
+ netperf_output_source[REMOTE_RELEASE].output_name = REMOTE_RELEASE;
+ netperf_output_source[REMOTE_RELEASE].line[0] = "Remote";
+ netperf_output_source[REMOTE_RELEASE].line[1] = "Release";
+ netperf_output_source[REMOTE_RELEASE].line[2] = "";
+ netperf_output_source[REMOTE_RELEASE].line[3] = "";
+ netperf_output_source[REMOTE_RELEASE].format = "%s";
+ netperf_output_source[REMOTE_RELEASE].display_value = remote_release;
+ netperf_output_source[REMOTE_RELEASE].max_line_len =
+ NETPERF_LINE_MAX(REMOTE_RELEASE);
+ netperf_output_source[REMOTE_RELEASE].tot_line_len =
+ NETPERF_LINE_TOT(REMOTE_RELEASE);
+
+ netperf_output_source[REMOTE_SYSNAME].output_name = REMOTE_SYSNAME;
+ netperf_output_source[REMOTE_SYSNAME].line[0] = "Remote";
+ netperf_output_source[REMOTE_SYSNAME].line[1] = "Sysname";
+ netperf_output_source[REMOTE_SYSNAME].line[2] = "";
+ netperf_output_source[REMOTE_SYSNAME].line[3] = "";
+ netperf_output_source[REMOTE_SYSNAME].format = "%s";
+ netperf_output_source[REMOTE_SYSNAME].display_value = remote_sysname;
+ netperf_output_source[REMOTE_SYSNAME].max_line_len =
+ NETPERF_LINE_MAX(REMOTE_SYSNAME);
+ netperf_output_source[REMOTE_SYSNAME].tot_line_len =
+ NETPERF_LINE_TOT(REMOTE_SYSNAME);
+
+ netperf_output_source[LOCAL_MACHINE].output_name = LOCAL_MACHINE;
+ netperf_output_source[LOCAL_MACHINE].line[0] = "Local";
+ netperf_output_source[LOCAL_MACHINE].line[1] = "Machine";
+ netperf_output_source[LOCAL_MACHINE].line[2] = "";
+ netperf_output_source[LOCAL_MACHINE].line[3] = "";
+ netperf_output_source[LOCAL_MACHINE].format = "%s";
+ netperf_output_source[LOCAL_MACHINE].display_value = local_machine;
+ netperf_output_source[LOCAL_MACHINE].max_line_len =
+ NETPERF_LINE_MAX(LOCAL_MACHINE);
+ netperf_output_source[LOCAL_MACHINE].tot_line_len =
+ NETPERF_LINE_TOT(LOCAL_MACHINE);
+
+ netperf_output_source[LOCAL_VERSION].output_name = LOCAL_VERSION;
+ netperf_output_source[LOCAL_VERSION].line[0] = "Local";
+ netperf_output_source[LOCAL_VERSION].line[1] = "Version";
+ netperf_output_source[LOCAL_VERSION].line[2] = "";
+ netperf_output_source[LOCAL_VERSION].line[3] = "";
+ netperf_output_source[LOCAL_VERSION].format = "%s";
+ netperf_output_source[LOCAL_VERSION].display_value = local_version;
+ netperf_output_source[LOCAL_VERSION].max_line_len =
+ NETPERF_LINE_MAX(LOCAL_VERSION);
+ netperf_output_source[LOCAL_VERSION].tot_line_len =
+ NETPERF_LINE_TOT(LOCAL_VERSION);
+
+ netperf_output_source[LOCAL_RELEASE].output_name = LOCAL_RELEASE;
+ netperf_output_source[LOCAL_RELEASE].line[0] = "Local";
+ netperf_output_source[LOCAL_RELEASE].line[1] = "Release";
+ netperf_output_source[LOCAL_RELEASE].line[2] = "";
+ netperf_output_source[LOCAL_RELEASE].line[3] = "";
+ netperf_output_source[LOCAL_RELEASE].format = "%s";
+ netperf_output_source[LOCAL_RELEASE].display_value = local_release;
+ netperf_output_source[LOCAL_RELEASE].max_line_len =
+ NETPERF_LINE_MAX(LOCAL_RELEASE);
+ netperf_output_source[LOCAL_RELEASE].tot_line_len =
+ NETPERF_LINE_TOT(LOCAL_RELEASE);
+
+ netperf_output_source[LOCAL_SYSNAME].output_name = LOCAL_SYSNAME;
+ netperf_output_source[LOCAL_SYSNAME].line[0] = "Local";
+ netperf_output_source[LOCAL_SYSNAME].line[1] = "Sysname";
+ netperf_output_source[LOCAL_SYSNAME].line[2] = "";
+ netperf_output_source[LOCAL_SYSNAME].line[3] = "";
+ netperf_output_source[LOCAL_SYSNAME].format = "%s";
+ netperf_output_source[LOCAL_SYSNAME].display_value = local_sysname;
+ netperf_output_source[LOCAL_SYSNAME].max_line_len =
+ NETPERF_LINE_MAX(LOCAL_SYSNAME);
+ netperf_output_source[LOCAL_SYSNAME].tot_line_len =
+ NETPERF_LINE_TOT(LOCAL_SYSNAME);
+
netperf_output_source[OUTPUT_END].output_name = OUTPUT_END;
netperf_output_source[OUTPUT_END].line[0] = "This";
netperf_output_source[OUTPUT_END].line[1] = "Is";
@@ -3034,6 +3162,11 @@
omni_result =
(struct omni_results_struct *)netperf_response.content.test_specific_data;
+
+ /* before we start doing things with our own requests and responses
+ lets go ahead and find-out about the remote system. at some point
+ we probably need to put this somewhere else... */
+ get_remote_system_info();
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
@@ -4287,6 +4420,7 @@
trans_completed = 0;
bytes_sent = 0;
bytes_received = 0;
+ connected = 0;
while ((!times_up) || (units_remaining > 0)) {
More information about the netperf-dev
mailing list