[netperf-dev] netperf2 commit notice r525 - trunk/src
raj at netperf.org
raj at netperf.org
Tue Jan 31 14:23:50 PST 2012
Author: raj
Date: 2012-01-31 14:23:50 -0800 (Tue, 31 Jan 2012)
New Revision: 525
Modified:
trunk/src/netperf.c
trunk/src/nettest_bsd.c
trunk/src/nettest_omni.c
trunk/src/nettest_unix.c
Log:
start a delete trailing whitespace kick
Modified: trunk/src/netperf.c
===================================================================
--- trunk/src/netperf.c 2012-01-31 22:19:03 UTC (rev 524)
+++ trunk/src/netperf.c 2012-01-31 22:23:50 UTC (rev 525)
@@ -1,30 +1,30 @@
/*
-
+
Copyright (C) 1993-2011 Hewlett-Packard Company
ALL RIGHTS RESERVED.
-
+
The enclosed software and documentation includes copyrighted works
of Hewlett-Packard Co. For as long as you comply with the following
limitations, you are hereby authorized to (i) use, reproduce, and
modify the software and documentation, and to (ii) distribute the
software and documentation, including modifications, for
non-commercial purposes only.
-
+
1. The enclosed software and documentation is made available at no
charge in order to advance the general development of
high-performance networking products.
-
+
2. You may not delete any copyright notices contained in the
software or documentation. All hard copies, and copies in
source code or object code form, of the software or
documentation (including modifications) must contain at least
one of the copyright notices.
-
+
3. The enclosed software and documentation has not been subjected
to testing and quality control and is not a Hewlett-Packard Co.
product. At a future time, Hewlett-Packard Co. may or may not
offer a version of the software and documentation as a product.
-
+
4. THE SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS".
HEWLETT-PACKARD COMPANY DOES NOT WARRANT THAT THE USE,
REPRODUCTION, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR
@@ -34,12 +34,12 @@
EXPRESS AND IMPLIED, WITH REGARD TO THE SOFTWARE AND THE
DOCUMENTATION. HP SPECIFICALLY DISCLAIMS ALL WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
+
5. HEWLETT-PACKARD COMPANY WILL NOT IN ANY EVENT BE LIABLE FOR ANY
DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
(INCLUDING LOST PROFITS) RELATED TO ANY USE, REPRODUCTION,
MODIFICATION, OR DISTRIBUTION OF THE SOFTWARE OR DOCUMENTATION.
-
+
*/
char netperf_id[]="\
@(#)netperf.c (c) Copyright 1993-2011 Hewlett-Packard Company. Version 2.5.0";
@@ -112,30 +112,30 @@
#ifdef WIN32
WSADATA wsa_data ;
-
+
/* Initialize the winsock lib ( version 2.2 ) */
if ( WSAStartup(MAKEWORD(2,2), &wsa_data) == SOCKET_ERROR ){
printf("WSAStartup() failed : %lu\n", GetLastError()) ;
return 1 ;
}
#endif /* WIN32 */
-
+
netlib_init();
/* the call to set_defaults() is gone because we can initialize in
declarations (or is that definitions) unlike the old days */
scan_cmd_line(argc,argv);
-
+
if (debug) {
dump_globals();
install_signal_catchers();
}
-
+
if (debug) {
printf("remotehost is %s and port %s\n",host_name,test_port);
fflush(stdout);
}
-
-
+
+
if (!no_control) {
establish_control(host_name,test_port,address_family,
local_host_name,local_test_port,local_address_family);
@@ -148,7 +148,7 @@
send_request_n(0);
}
}
-
+
if (strcasecmp(test_name,"TCP_STREAM") == 0) {
send_tcp_stream(host_name);
}
@@ -241,11 +241,11 @@
send_xti_udp_rr(host_name);
}
#endif /* WANT_XTI */
-
+
#ifdef WANT_SCTP
else if (strcasecmp(test_name, "SCTP_STREAM") == 0) {
send_sctp_stream(host_name);
- }
+ }
else if (strcasecmp(test_name, "SCTP_RR") == 0) {
send_sctp_rr(host_name);
}
@@ -256,7 +256,7 @@
send_sctp_rr_1toMany(host_name);
}
#endif
-
+
#ifdef DO_DNS
else if (strcasecmp(test_name,"DNS_RR") == 0) {
fprintf(stderr,
@@ -291,16 +291,16 @@
test_name);
exit(1);
}
-
+
if (!no_control) {
shutdown_control();
}
-
+
#ifdef WIN32
/* Cleanup the winsock lib */
WSACleanup();
#endif
-
+
return(0);
}
Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c 2012-01-31 22:19:03 UTC (rev 524)
+++ trunk/src/nettest_bsd.c 2012-01-31 22:23:50 UTC (rev 525)
@@ -145,7 +145,7 @@
#include "netsh.h"
#include "nettest_bsd.h"
-#if defined(WANT_HISTOGRAM) || defined(WANT_DEMO)
+#if defined(WANT_HISTOGRAM) || defined(WANT_DEMO)
#include "hist.h"
#endif /* WANT_HISTOGRAM */
@@ -171,7 +171,7 @@
* be used elsewhere if needed. They are externed through nettest_bsd.h
*/
-int
+int
socket_type, /* used initially by the "omni" tests */
rss_size_req = -1, /* requested remote socket send buffer size */
rsr_size_req = -1, /* requested remote socket recv buffer size */
@@ -362,7 +362,7 @@
value, specifying a value with a leading comma will set just the second\n\
parm, a value with a trailing comma will set just the first. To set\n\
each parm to unique values, specify both and separate them with a\n\
-comma.\n";
+comma.\n";
@@ -413,7 +413,7 @@
default:
return NF_UNSPEC;
}
-}
+}
/* these routines will convert between the hosts' socket types and
@@ -557,7 +557,7 @@
sock_opt_len = sizeof(int);
if (getsockopt(socket,
- getprotobyname("tcp")->p_proto,
+ getprotobyname("tcp")->p_proto,
TCP_MAXSEG,
(char *)mss,
&sock_opt_len) == SOCKET_ERROR) {
@@ -580,7 +580,7 @@
sock_opt_len = sizeof(int);
if ((setsockopt(socket,
- getprotobyname("tcp")->p_proto,
+ getprotobyname("tcp")->p_proto,
TCP_MAXSEG,
&mss,
sock_opt_len) == SOCKET_ERROR) && (debug)) {
@@ -609,7 +609,7 @@
family */
struct addrinfo *
-complete_addrinfo(char *controlhost, char *data_address, char *port, int family, int type, int protocol, int flags)
+complete_addrinfo(char *controlhost, char *data_address, char *port, int family, int type, int protocol, int flags)
{
struct addrinfo hints;
struct addrinfo *res;
@@ -773,7 +773,7 @@
}
temp_res = temp_res->ai_next;
}
-
+
if ((change_info & CHANGED_SOCK_TYPE) &&
!(change_warning_displayed & CHANGED_SOCK_TYPE)) {
change_warning_displayed |= CHANGED_SOCK_TYPE;
@@ -838,7 +838,7 @@
if (remote_data_family == AF_UNSPEC) {
remote_data_family = control_family;
}
-
+
*remote = complete_addrinfo(remote_host,
remote_data_address,
remote_data_port,
@@ -877,7 +877,7 @@
if ((AF_INET6 == local_data_family) ||
((AF_UNSPEC == local_data_family) &&
(AF_INET6 == remote_data_family)) ||
- ((AF_UNSPEC == local_data_family) &&
+ ((AF_UNSPEC == local_data_family) &&
(AF_INET6 == (*remote)->ai_family))) {
strcpy(local_data_address,"::0");
}
@@ -914,13 +914,13 @@
strcpy(hostname,"::0");
}
#endif
-
+
sprintf(portstr, "%u", port);
}
static unsigned short
-get_port_number(struct addrinfo *res)
+get_port_number(struct addrinfo *res)
{
switch(res->ai_family) {
case AF_INET: {
@@ -973,7 +973,7 @@
set_port_number(struct addrinfo *res, unsigned short port)
{
switch(res->ai_family) {
- case AF_INET:
+ case AF_INET:
#if defined(AF_RDS)
case AF_RDS:
#endif
@@ -1002,7 +1002,7 @@
first */
void
set_sockaddr_family_addr_port(struct sockaddr_storage *sockaddr, int family, void *addr, int port) {
-
+
memset(sockaddr,0,sizeof(struct sockaddr_storage));
switch (family) {
@@ -1171,7 +1171,7 @@
temp_socket = socket(res->ai_family,
res->ai_socktype,
res->ai_protocol);
-
+
if (temp_socket == INVALID_SOCKET){
fprintf(where,
"netperf: create_data_socket: socket: errno %d fam %s type %s prot %s errmsg %s\n",
@@ -1183,12 +1183,12 @@
fflush(where);
exit(1);
}
-
+
if (debug) {
fprintf(where,"create_data_socket: socket %d obtained...\n",temp_socket);
fflush(where);
}
-
+
/* Modify the local socket size. The reason we alter the send buffer
size here rather than when the connection is made is to take care
of decreases in buffer size. Decreasing the window size after
@@ -1202,7 +1202,7 @@
will try to find-out what their values are. If we cannot touch the
socket buffer in any way, we will set the values to -1 to indicate
that. */
-
+
/* all the oogy nitty gritty stuff moved from here into the routine
being called below, per patches from davidm to workaround the bug
in Linux getsockopt(). raj 2004-06-15 */
@@ -1211,7 +1211,7 @@
/* now, we may wish to enable the copy avoidance features on the */
/* local system. of course, this may not be possible... */
-
+
#ifdef SO_RCV_COPYAVOID
if (loc_rcvavoid) {
if (setsockopt(temp_socket,
@@ -1247,7 +1247,7 @@
/* it was not compiled in... */
loc_sndavoid = 0;
#endif
-
+
/* Now, we will see about setting the TCP_NODELAY flag on the local */
/* socket. We will only do this for those systems that actually */
/* support the option. If it fails, note the fact, but keep going. */
@@ -1268,7 +1268,7 @@
have to make sure that res->ai_protocol actually makes sense for
a _NODELAY setsockopt() or a UDP_RR test on Linux where someone
mistakenly sets -D will hang. raj 2005-04-21 */
-
+
#if defined(TCP_NODELAY) || defined(SCTP_NODELAY)
if ((loc_nodelay) && (res->ai_protocol != IPPROTO_UDP)) {
@@ -1283,7 +1283,7 @@
/* I suspect that WANT_SCTP would suffice here since that is the
only time we would have called getaddrinfo with a hints asking
for SCTP, but just in case there is an SCTP implementation out
- there _without_ SCTP_NODELAY... raj 2005-03-15 */
+ there _without_ SCTP_NODELAY... raj 2005-03-15 */
/* change this to IPPROTO_SCTP rather than WANT_SCTP to better fit
with the modus operandi of the new "omni" tests. raj
2008-02-04 */
@@ -1304,7 +1304,7 @@
errno);
fflush(where);
}
-
+
if (debug > 1) {
fprintf(where,
"netperf: create_data_socket: [TCP|SCTP]_NODELAY requested...\n");
@@ -1312,9 +1312,9 @@
}
}
#else /* TCP_NODELAY */
-
+
loc_nodelay = 0;
-
+
#endif /* TCP_NODELAY */
if ((transport_mss_req != -1) && (IPPROTO_TCP == res->ai_protocol)) {
@@ -1322,7 +1322,7 @@
}
#if defined(TCP_CORK)
-
+
if (loc_tcpcork > 0) {
/* the user wishes for us to set TCP_CORK on the socket */
if (setsockopt(temp_socket,
@@ -1337,9 +1337,9 @@
fprintf(where,"create_data_socket: tcp_cork...\n");
}
}
-
-#endif /* TCP_CORK */
+#endif /* TCP_CORK */
+
/* well, after Knuth only knows how many years, I have finally
decided to enable setting SO_KEEPALIVE on the data socket. 99
times out of 10 this should not be necessary, but that 100th time,
@@ -1367,7 +1367,7 @@
}
#endif /* SO_KEEPALIVE */
-
+
/* since some of the UDP tests do not do anything to cause an
implicit bind() call, we need to be rather explicit about our
bind() call here. even if the address and/or the port are zero
@@ -1401,7 +1401,7 @@
errno);
fflush(where);
}
-
+
if (bind(temp_socket,
res->ai_addr,
res->ai_addrlen) < 0) {
@@ -1459,7 +1459,7 @@
SOL_SOCKET,
SO_PRIORITY,
&local_socket_prio,
- &sock_opt_len);
+ &sock_opt_len);
}
}
#else
@@ -1467,7 +1467,7 @@
#endif
#if defined (IP_TOS) || defined(IPV6_TCLASS)
- if (local_socket_tos > 0)
+ if (local_socket_tos > 0)
local_socket_tos = set_socket_tos(temp_socket,res->ai_family, local_socket_tos);
#endif
@@ -1494,13 +1494,13 @@
/* written correctly, and so we do not need to include those calls */
/* in this kludgy routine. raj 11/95 */
-
+
/* Now, we will see about setting the TCP_NODELAY flag on the local */
/* socket. We will only do this for those systems that actually */
/* support the option. If it fails, note the fact, but keep going. */
/* If the user tries to enable TCP_NODELAY on a UDP socket, this */
/* will cause an error to be displayed */
-
+
#ifdef TCP_NODELAY
if (loc_nodelay) {
one = 1;
@@ -1513,7 +1513,7 @@
errno);
fflush(where);
}
-
+
if (debug > 1) {
fprintf(where,
"netperf: kludge_socket_options: TCP_NODELAY requested...\n");
@@ -1521,9 +1521,9 @@
}
}
#else /* TCP_NODELAY */
-
+
loc_nodelay = 0;
-
+
#endif /* TCP_NODELAY */
}
@@ -1532,7 +1532,7 @@
static void *
-get_address_address(struct addrinfo *info)
+get_address_address(struct addrinfo *info)
{
struct sockaddr_in *sin;
#if defined(AF_INET6)
@@ -1557,7 +1557,7 @@
}
}
-#if defined(WIN32)
+#if defined(WIN32)
#if !defined(InetNtop)
/* +*+ Why isn't this in the winsock headers yet? */
const char *
@@ -1618,7 +1618,7 @@
if ((loc_nodelay > 0) || (rem_nodelay > 0)) {
fprintf(where," : nodelay");
}
- if ((loc_sndavoid > 0) ||
+ if ((loc_sndavoid > 0) ||
(loc_rcvavoid > 0) ||
(rem_sndavoid > 0) ||
(rem_rcvavoid > 0)) {
@@ -1641,7 +1641,7 @@
#endif
#endif /* WANT_INTERVALS */
-#ifdef DIRTY
+#ifdef DIRTY
fprintf(where," : dirty data");
#endif /* DIRTY */
#ifdef WANT_DEMO
@@ -1672,34 +1672,34 @@
/* parameters via global variables from the shell and writes its */
/* output to the standard output. */
-void
+void
send_tcp_stream(char remote_host[])
{
-
+
char *tput_title = "\
Recv Send Send \n\
Socket Socket Message Elapsed \n\
Size Size Size Time Throughput \n\
bytes bytes bytes secs. %s/sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f %s\n";
-
+
char *tput_fmt_1 =
"%6d %6d %6d %-6.2f %7.2f %s\n";
-
+
char *cpu_title = "\
Recv Send Send Utilization Service Demand\n\
Socket Socket Message Elapsed Send Recv Send Recv\n\
Size Size Size Time Throughput local remote local remote\n\
bytes bytes bytes secs. %-8.8s/s %% %c %% %c us/KB us/KB\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f %c %s\n";
char *cpu_fmt_1 =
"%6d %6d %6d %-6.2f %7.2f %-6.2f %-6.2f %-6.3f %-6.3f %s\n";
-
+
char *ksink_fmt = "\n\
Alignment Offset %-8.8s %-8.8s Sends %-8.8s Recvs\n\
Local Remote Local Remote Xfered Per Per\n\
@@ -1711,19 +1711,19 @@
Segment\n\
Size (bytes)\n\
%6d\n";
-
-
+
+
float elapsed_time;
-
+
/* what we want is to have a buffer space that is at least one */
/* send-size greater than our send window. this will insure that we */
/* are never trying to re-use a buffer that may still be in the hands */
/* of the transport. This buffer will be malloc'd after we have found */
/* the size of the local senc socket buffer. We will want to deal */
/* with alignment and offset concerns as well. */
-
+
struct ring_elt *send_ring;
-
+
int len;
unsigned int nummessages = 0;
SOCKET send_socket;
@@ -1741,28 +1741,28 @@
#endif
double bytes_sent = 0.0;
-
+
float local_cpu_utilization;
float local_service_demand;
float remote_cpu_utilization;
float remote_service_demand;
double thruput;
-
+
struct addrinfo *remote_res;
struct addrinfo *local_res;
-
+
struct tcp_stream_request_struct *tcp_stream_request;
struct tcp_stream_response_struct *tcp_stream_response;
struct tcp_stream_results_struct *tcp_stream_result;
-
- tcp_stream_request =
+
+ tcp_stream_request =
(struct tcp_stream_request_struct *)netperf_request.content.test_specific_data;
tcp_stream_response =
(struct tcp_stream_response_struct *)netperf_response.content.test_specific_data;
- tcp_stream_result =
+ tcp_stream_result =
(struct tcp_stream_results_struct *)netperf_response.content.test_specific_data;
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
@@ -1772,7 +1772,7 @@
/* control socket, and since we want to be able to use different */
/* protocols and such, we are passed the name of the remote host and */
/* must turn that into the test specific addressing information. */
-
+
/* complete_addrinfos will either succede or exit the process */
complete_addrinfos(&remote_res,
&local_res,
@@ -1780,7 +1780,7 @@
SOCK_STREAM,
IPPROTO_TCP,
0);
-
+
if ( print_headers ) {
print_top_test_header("TCP STREAM TEST",local_res,remote_res);
}
@@ -1801,23 +1801,23 @@
/* initialize a few counters. we have to remember that we might be */
/* going through the loop more than once. */
-
+
nummessages = 0;
bytes_sent = 0.0;
times_up = 0;
-
+
/*set up the data socket */
send_socket = create_data_socket(local_res);
-
+
if (send_socket == INVALID_SOCKET){
perror("netperf: send_tcp_stream: tcp stream data socket");
exit(1);
}
-
+
if (debug) {
fprintf(where,"send_tcp_stream: send_socket obtained...\n");
}
-
+
/* at this point, we have either retrieved the socket buffer sizes, */
/* or have tried to set them, so now, we may want to set the send */
/* size based on that (because the user either did not use a -m */
@@ -1832,7 +1832,7 @@
send_size = 4096;
}
}
-
+
/* set-up the data buffer ring with the requested alignment and offset. */
/* note also that we have allocated a quantity */
/* of memory that is at least one send-size greater than our socket */
@@ -1845,7 +1845,7 @@
send_width = (lss_size/send_size) + 1;
if (send_width == 1) send_width++;
}
-
+
if (send_ring == NULL) {
/* only allocate the send ring once. this is a networking test, */
/* not a memory allocation test. this way, we do not need a */
@@ -1863,11 +1863,11 @@
/* calibrate_local_cpu will return rather quickly as it will have */
/* nothing to do. If local_cpu_rate is zero, then we will go through */
/* all the "normal" calibration stuff and return the rate back. */
-
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
-
+
if (!no_control) {
/* Tell the remote end to do a listen. The server alters the
socket paramters on the other side at this point, hence the
@@ -1877,7 +1877,7 @@
that no changes beyond the system's default should be
used. Alignment is the exception, it will default to 1, which
will be no alignment alterations. */
-
+
netperf_request.content.request_type = DO_TCP_STREAM;
tcp_stream_request->send_buf_size = rss_size_req;
tcp_stream_request->recv_buf_size = rsr_size_req;
@@ -1905,9 +1905,9 @@
fprintf(where,
"netperf: send_tcp_stream: requesting TCP stream test\n");
}
-
+
send_request();
-
+
/* The response from the remote will contain all of the relevant
socket parameters for this test type. We will put them back
into the variables here so they can be displayed if desired.
@@ -1918,9 +1918,9 @@
will grab the counter right after the accept call. This saves
the hassle of extra messages being sent for the TCP
tests. */
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
if (debug)
fprintf(where,"remote listen done.\n");
@@ -1929,12 +1929,12 @@
rem_nodelay = tcp_stream_response->no_delay;
remote_cpu_usage= tcp_stream_response->measure_cpu;
remote_cpu_rate = tcp_stream_response->cpu_rate;
-
+
/* we have to make sure that the server port number is in
network order */
set_port_number(remote_res,
(short)tcp_stream_response->data_port_number);
-
+
rem_rcvavoid = tcp_stream_response->so_rcvavoid;
rem_sndavoid = tcp_stream_response->so_sndavoid;
}
@@ -1945,7 +1945,7 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
}
@@ -1955,7 +1955,7 @@
#endif
/*Connect up to the remote port on the data socket */
- if (connect(send_socket,
+ if (connect(send_socket,
remote_res->ai_addr,
remote_res->ai_addrlen) == INVALID_SOCKET){
perror("netperf: send_tcp_stream: data socket connect failed");
@@ -1977,11 +1977,11 @@
/* have indicated a problem. I failed to see the value of the */
/* extra message after the accept on the remote. If it failed, */
/* we'll see it here. If it didn't, we might as well start pumping */
- /* data. */
-
+ /* data. */
+
/* Set-up the test end conditions. For a stream test, they can be */
/* either time or byte-count based. */
-
+
if (test_time) {
/* The user wanted to end the test after a period of time. */
times_up = 0;
@@ -1999,16 +1999,16 @@
bytes_remaining = test_bytes;
times_up = 1;
}
-
+
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
-
+
cpu_start(local_cpu_usage);
/* we only start the interval timer if we are using the
timer-timed intervals rather than the sit and spin ones. raj
- 2006-02-06 */
+ 2006-02-06 */
#if defined(WANT_INTERVALS)
INTERVALS_INIT();
#endif /* WANT_INTERVALS */
@@ -2020,23 +2020,23 @@
demo_first_timestamp();
}
#endif
-
+
/* We use an "OR" to control test execution. When the test is */
/* controlled by time, the byte count check will always return false. */
/* When the test is controlled by byte count, the time test will */
/* always return false. When the test is finished, the whole */
/* expression will go false and we will stop sending data. */
-
+
while ((!times_up) || (bytes_remaining > 0)) {
-
+
#ifdef DIRTY
access_buffer(send_ring->buffer_ptr,
send_size,
loc_dirty_count,
loc_clean_count);
#endif /* DIRTY */
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
/* timestamp just before we go into send and then again just
@@ -2068,22 +2068,22 @@
HIST_timestamp(&time_two);
HIST_add(time_hist,delta_micro(&time_one,&time_two));
}
-#endif /* WANT_HISTOGRAM */
+#endif /* WANT_HISTOGRAM */
#ifdef WANT_DEMO
demo_stream_interval(send_size);
-#endif
+#endif
#if defined(WANT_INTERVALS)
INTERVALS_WAIT();
#endif /* WANT_INTERVALS */
-
+
/* now we want to move our pointer to the next position in the */
/* data buffer...we may also want to wrap back to the "beginning" */
/* of the bufferspace, so we will mod the number of messages sent */
/* by the send width, and use that to calculate the offset to add */
/* to the base pointer. */
- nummessages++;
+ nummessages++;
send_ring = send_ring->next;
if (bytes_remaining) {
bytes_remaining -= send_size;
@@ -2092,7 +2092,7 @@
/* The test is over. Flush the buffers to the remote end. We do a */
/* graceful release to insure that all data has been taken by the */
- /* remote. */
+ /* remote. */
/* but first, if the verbosity is greater than 1, find-out what */
/* the TCP maximum segment_size was (if possible) */
@@ -2100,27 +2100,27 @@
tcp_mss = -1;
get_tcp_info(send_socket,&tcp_mss);
}
-
+
if (shutdown(send_socket,SHUT_WR) == SOCKET_ERROR && !times_up) {
perror("netperf: cannot shutdown tcp stream socket");
exit(1);
}
-
+
/* hang a recv() off the socket to block until the remote has */
/* brought all the data up into the application. it will do a */
/* shutdown to cause a FIN to be sent our way. We will assume that */
/* any exit from the recv() call is good... raj 4/93 */
-
+
recv(send_socket, send_ring->buffer_ptr, send_size, 0);
-
+
/* this call will always give us the elapsed time for the test, and */
/* will also store-away the necessaries for cpu utilization */
-
+
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being */
/* measured and how */
/* long did we really */
/* run? */
-
+
/* we are finished with the socket, so close it to prevent hitting */
/* the limit on maximum open files. */
@@ -2131,10 +2131,10 @@
calculated service demand and all those interesting
things. If it wasn't supposed to care, it will return obvious
values. */
-
+
recv_response();
if (!netperf_response.content.serv_errno) {
- if (debug)
+ if (debug)
fprintf(where,
"remote reporting results for %.2f seconds\n",
tcp_stream_result->elapsed_time);
@@ -2146,10 +2146,10 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
-
+
/* We now calculate what our thruput was for the test. In the
future, we may want to include a calculation of the thruput
measured by the remote, but it should be the case that for a
@@ -2159,7 +2159,7 @@
and if it was by bytes, the user may have specified a number
of bytes that wasn't a multiple of the send_size, so we
really didn't send what he asked for ;-) */
-
+
bytes_sent = ntohd(tcp_stream_result->bytes_received);
}
else {
@@ -2167,7 +2167,7 @@
}
thruput = calc_thruput(bytes_sent);
-
+
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu */
/* utilization for the system(s) */
@@ -2175,7 +2175,7 @@
/* there was no idle counter in the kernel(s). We need to make */
/* a note of this for the user's benefit...*/
if (local_cpu_usage) {
-
+
local_cpu_utilization = calc_cpu_util(0.0);
local_service_demand = calc_service_demand(bytes_sent,
0.0,
@@ -2186,9 +2186,9 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
if (remote_cpu_usage) {
-
+
remote_cpu_utilization = tcp_stream_result->cpu_util;
remote_service_demand = calc_service_demand(bytes_sent,
0.0,
@@ -2199,7 +2199,7 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
- }
+ }
else {
/* we were not measuring cpu, for the confidence stuff, we */
/* should make it -1.0 */
@@ -2212,7 +2212,7 @@
/* at this point, we want to calculate the confidence information. */
/* if debugging is on, calculate_confidence will print-out the */
/* parameters we pass it */
-
+
calculate_confidence(confidence_iteration,
elapsed_time,
thruput,
@@ -2220,8 +2220,8 @@
remote_cpu_utilization,
local_service_demand,
remote_service_demand);
-
-
+
+
confidence_iteration++;
}
@@ -2259,7 +2259,7 @@
if (local_cpu_usage || remote_cpu_usage) {
local_cpu_method = format_cpu_method(cpu_method);
remote_cpu_method = format_cpu_method(tcp_stream_result->cpu_method);
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -2267,7 +2267,7 @@
cpu_fmt_0,
local_service_demand,
local_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
else {
@@ -2275,7 +2275,7 @@
cpu_fmt_0,
remote_service_demand,
remote_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
break;
@@ -2288,7 +2288,7 @@
local_cpu_method,
remote_cpu_method);
}
-
+
fprintf(where,
cpu_fmt_1, /* the format string */
rsr_size, /* remote recvbuf size */
@@ -2300,20 +2300,20 @@
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand, /* remote service demand */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
}
else {
/* The tester did not wish to measure service demand. */
-
+
switch (verbosity) {
case 0:
fprintf(where,
tput_fmt_0,
thruput,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
case 1:
@@ -2328,27 +2328,27 @@
send_size, /* how large were the sends */
elapsed_time, /* how long did it take */
thruput, /* how fast did it go */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
if (verbosity > 1) {
/* The user wanted to know it all, so we will give it to him. */
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
/* this stuff needs to be worked-out in the presence of confidence */
/* intervals and multiple iterations of the test... raj 11/94 */
-
+
fprintf(where,
ksink_fmt,
"Bytes",
@@ -2373,7 +2373,7 @@
HIST_report(time_hist);
#endif /* WANT_HISTOGRAM */
}
-
+
}
@@ -2385,34 +2385,34 @@
output to the standard output. */
-void
+void
send_tcp_maerts(char remote_host[])
{
-
+
char *tput_title = "\
Recv Send Send \n\
Socket Socket Message Elapsed \n\
Size Size Size Time Throughput \n\
bytes bytes bytes secs. %s/sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f %s\n";
-
+
char *tput_fmt_1 =
"%6d %6d %6d %-6.2f %7.2f %s\n";
-
+
char *cpu_title = "\
Recv Send Send Utilization Service Demand\n\
Socket Socket Message Elapsed Recv Send Recv Send\n\
Size Size Size Time Throughput local remote local remote\n\
bytes bytes bytes secs. %-8.8s/s %% %c %% %c us/KB us/KB\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f %c %s\n";
char *cpu_fmt_1 =
"%6d %6d %6d %-6.2f %7.2f %-6.2f %-6.2f %-6.3f %-6.3f %s\n";
-
+
char *ksink_fmt = "\n\
Alignment Offset %-8.8s %-8.8s Recvs %-8.8s Sends\n\
Local Remote Local Remote Xfered Per Per\n\
@@ -2424,19 +2424,19 @@
Segment\n\
Size (bytes)\n\
%6d\n";
-
-
+
+
float elapsed_time;
-
+
/* what we want is to have a buffer space that is at least one */
/* recv-size greater than our recv window. this will insure that we */
/* are never trying to re-use a buffer that may still be in the hands */
/* of the transport. This buffer will be malloc'd after we have found */
/* the size of the local senc socket buffer. We will want to deal */
/* with alignment and offset concerns as well. */
-
+
struct ring_elt *recv_ring;
-
+
int len;
unsigned int nummessages = 0;
SOCKET recv_socket;
@@ -2462,21 +2462,21 @@
float remote_service_demand;
double thruput;
-
+
struct addrinfo *remote_res;
struct addrinfo *local_res;
-
+
struct tcp_maerts_request_struct *tcp_maerts_request;
struct tcp_maerts_response_struct *tcp_maerts_response;
struct tcp_maerts_results_struct *tcp_maerts_result;
-
- tcp_maerts_request =
+
+ tcp_maerts_request =
(struct tcp_maerts_request_struct *)netperf_request.content.test_specific_data;
tcp_maerts_response =
(struct tcp_maerts_response_struct *)netperf_response.content.test_specific_data;
- tcp_maerts_result =
+ tcp_maerts_result =
(struct tcp_maerts_results_struct *)netperf_response.content.test_specific_data;
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
@@ -2486,14 +2486,14 @@
/* control socket, and since we want to be able to use different */
/* protocols and such, we are passed the name of the remote host and */
/* must turn that into the test specific addressing information. */
-
+
complete_addrinfos(&remote_res,
&local_res,
remote_host,
SOCK_STREAM,
IPPROTO_TCP,
0);
-
+
if ( print_headers ) {
print_top_test_header("TCP MAERTS TEST",local_res,remote_res);
}
@@ -2514,19 +2514,19 @@
/* initialize a few counters. we have to remember that we might be */
/* going through the loop more than once. */
-
+
nummessages = 0;
bytes_sent = 0.0;
times_up = 0;
-
+
/*set up the data socket */
recv_socket = create_data_socket(local_res);
-
+
if (recv_socket == INVALID_SOCKET){
perror("netperf: send_tcp_maerts: tcp stream data socket");
exit(1);
}
-
+
if (debug) {
fprintf(where,"send_tcp_maerts: recv_socket obtained...\n");
}
@@ -2558,7 +2558,7 @@
recv_width = (lsr_size/recv_size) + 1;
if (recv_width == 1) recv_width++;
}
-
+
if (recv_ring == NULL) {
/* only allocate the recv ring once. this is a networking test, */
/* not a memory allocation test. this way, we do not need a */
@@ -2576,11 +2576,11 @@
/* calibrate_local_cpu will return rather quickly as it will have */
/* nothing to do. If local_cpu_rate is zero, then we will go through */
/* all the "normal" calibration stuff and return the rate back. */
-
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
-
+
if (!no_control) {
/* Tell the remote end to do a listen. The server alters the
socket paramters on the other side at this point, hence the
@@ -2618,9 +2618,9 @@
fprintf(where,
"netperf: send_tcp_maerts: requesting TCP maerts test\n");
}
-
+
send_request();
-
+
/* The response from the remote will contain all of the relevant
socket parameters for this test type. We will put them back
into the variables here so they can be displayed if desired.
@@ -2631,9 +2631,9 @@
will grab the counter right after the accept call. This saves
the hassle of extra messages being sent for the TCP
tests. */
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
if (debug)
fprintf(where,"remote listen done.\n");
@@ -2643,7 +2643,7 @@
remote_cpu_usage= tcp_maerts_response->measure_cpu;
remote_cpu_rate = tcp_maerts_response->cpu_rate;
send_size = tcp_maerts_response->send_size;
-
+
/* we have to make sure that the server port number is in
network order */
set_port_number(remote_res,
@@ -2658,7 +2658,7 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
}
@@ -2668,7 +2668,7 @@
#endif
/*Connect up to the remote port on the data socket */
- if (connect(recv_socket,
+ if (connect(recv_socket,
remote_res->ai_addr,
remote_res->ai_addrlen) == INVALID_SOCKET){
perror("netperf: send_tcp_maerts: data socket connect failed");
@@ -2690,11 +2690,11 @@
/* have indicated a problem. I failed to see the value of the */
/* extra message after the accept on the remote. If it failed, */
/* we'll see it here. If it didn't, we might as well start pumping */
- /* data. */
-
+ /* data. */
+
/* Set-up the test end conditions. For a maerts test, they can be */
/* either time or byte-count based. */
-
+
if (test_time) {
/* The user wanted to end the test after a period of time. */
times_up = 0;
@@ -2717,18 +2717,18 @@
}
}
else {
- /* The tester wanted to recv a number of bytes. we don't do that
+ /* The tester wanted to recv a number of bytes. we don't do that
in a TCP_MAERTS test. sorry. raj 2002-06-21 */
printf("netperf: send_tcp_maerts: test must be timed\n");
exit(1);
}
-
+
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
-
+
cpu_start(local_cpu_usage);
-
+
#ifdef WANT_INTERVALS
INTERVALS_INIT();
#endif /* WANT_INTERVALS */
@@ -2755,7 +2755,7 @@
HIST_timestamp(&time_one);
}
#endif /* WANT_HISTOGRAM */
-
+
while ((!times_up) && (len=recv(recv_socket,
recv_ring->buffer_ptr,
recv_size,
@@ -2767,7 +2767,7 @@
HIST_timestamp(&time_two);
HIST_add(time_hist,delta_micro(&time_one,&time_two));
}
-#endif /* WANT_HISTOGRAM */
+#endif /* WANT_HISTOGRAM */
#ifdef DIRTY
access_buffer(recv_ring->buffer_ptr,
@@ -2780,16 +2780,16 @@
demo_stream_interval(len);
#endif
-#ifdef WANT_INTERVALS
+#ifdef WANT_INTERVALS
INTERVALS_WAIT();
#endif /* WANT_INTERVALS */
-
+
/* now we want to move our pointer to the next position in the */
/* data buffer...we may also want to wrap back to the "beginning" */
/* of the bufferspace, so we will mod the number of messages sent */
/* by the recv width, and use that to calculate the offset to add */
/* to the base pointer. */
- nummessages++;
+ nummessages++;
recv_ring = recv_ring->next;
if (bytes_remaining) {
bytes_remaining -= len;
@@ -2804,7 +2804,7 @@
HIST_timestamp(&time_one);
}
#endif /* WANT_HISTOGRAM */
-
+
}
/* an EINTR is to be expected when this is a no_control test */
@@ -2813,13 +2813,13 @@
printf("len was %d\n",len);
exit(1);
}
-
+
/* if we get here, it must mean we had a recv return of 0 before
the watchdog timer expired, or the watchdog timer expired and
this was a no_control test */
/* The test is over. Flush the buffers to the remote end. We do a
- graceful release to tell the remote we have all the data. */
+ graceful release to tell the remote we have all the data. */
/* but first, if the verbosity is greater than 1, find-out what */
/* the TCP maximum segment_size was (if possible) */
@@ -2827,23 +2827,23 @@
tcp_mss = -1;
get_tcp_info(recv_socket,&tcp_mss);
}
-
+
if (shutdown(recv_socket,SHUT_WR) == SOCKET_ERROR) {
perror("netperf: cannot shutdown tcp maerts socket");
exit(1);
}
stop_timer();
-
+
/* this call will always give us the local elapsed time for the
test, and will also store-away the necessaries for cpu
- utilization */
-
+ utilization */
+
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being */
/* measured and how */
/* long did we really */
/* run? */
-
+
/* we are finished with the socket, so close it to prevent hitting */
/* the limit on maximum open files. */
@@ -2854,7 +2854,7 @@
calculated service demand and all those interesting
things. If it wasn't supposed to care, it will return obvious
values. */
-
+
recv_response();
if (!netperf_response.content.serv_errno) {
if (debug)
@@ -2867,10 +2867,10 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
-
+
/* We now calculate what our thruput was for the test. In the
future, we may want to include a calculation of the thruput
measured by the remote, but it should be the case that for a
@@ -2880,7 +2880,7 @@
and if it was by bytes, the user may have specified a number
of bytes that wasn't a multiple of the recv_size, so we
really didn't recv what he asked for ;-) */
-
+
bytes_sent = ntohd(tcp_maerts_result->bytes_sent);
}
else {
@@ -2897,7 +2897,7 @@
/* there was no idle counter in the kernel(s). We need to make */
/* a note of this for the user's benefit...*/
if (local_cpu_usage) {
-
+
local_cpu_utilization = calc_cpu_util(0.0);
local_service_demand = calc_service_demand(bytes_sent,
0.0,
@@ -2908,9 +2908,9 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
if (remote_cpu_usage) {
-
+
remote_cpu_utilization = tcp_maerts_result->cpu_util;
remote_service_demand = calc_service_demand(bytes_sent,
0.0,
@@ -2921,7 +2921,7 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
- }
+ }
else {
/* we were not measuring cpu, for the confidence stuff, we */
/* should make it -1.0 */
@@ -2942,8 +2942,8 @@
remote_cpu_utilization,
local_service_demand,
remote_service_demand);
-
-
+
+
confidence_iteration++;
}
@@ -2981,7 +2981,7 @@
if (local_cpu_usage || remote_cpu_usage) {
local_cpu_method = format_cpu_method(cpu_method);
remote_cpu_method = format_cpu_method(tcp_maerts_result->cpu_method);
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -2989,7 +2989,7 @@
cpu_fmt_0,
local_service_demand,
local_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
else {
@@ -2997,7 +2997,7 @@
cpu_fmt_0,
remote_service_demand,
remote_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
break;
@@ -3010,7 +3010,7 @@
local_cpu_method,
remote_cpu_method);
}
-
+
fprintf(where,
cpu_fmt_1, /* the format string */
rsr_size, /* remote recvbuf size */
@@ -3022,20 +3022,20 @@
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand, /* remote service demand */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
}
else {
/* The tester did not wish to measure service demand. */
-
+
switch (verbosity) {
case 0:
fprintf(where,
tput_fmt_0,
thruput,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
case 1:
@@ -3050,27 +3050,27 @@
send_size, /* how large were the recvs */
elapsed_time, /* how long did it take */
thruput, /* how fast did it go */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
if (verbosity > 1) {
/* The user wanted to know it all, so we will give it to him. */
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
/* this stuff needs to be worked-out in the presence of confidence */
/* intervals and multiple iterations of the test... raj 11/94 */
-
+
fprintf(where,
ksink_fmt,
"Bytes",
@@ -3095,7 +3095,7 @@
HIST_report(time_hist);
#endif /* WANT_HISTOGRAM */
}
-
+
}
#endif /* WANT_MIGRATION */
@@ -3104,10 +3104,10 @@
to be a TCP_STREAM test and report the TCP_MSS for the data
connection. No actual data is transferred. raj 2007-11-07
*/
-void
+void
send_tcp_mss(char remote_host[])
{
-
+
char *mss_title = "\
Maximum\n\
Segment\n\
@@ -3121,23 +3121,23 @@
struct addrinfo *remote_res;
struct addrinfo *local_res;
-
+
struct tcp_stream_request_struct *tcp_stream_request;
struct tcp_stream_response_struct *tcp_stream_response;
struct tcp_stream_results_struct *tcp_stream_result;
-
- tcp_stream_request =
+
+ tcp_stream_request =
(struct tcp_stream_request_struct *)netperf_request.content.test_specific_data;
tcp_stream_response =
(struct tcp_stream_response_struct *)netperf_response.content.test_specific_data;
- tcp_stream_result =
+ tcp_stream_result =
(struct tcp_stream_results_struct *)netperf_response.content.test_specific_data;
-
+
/* since we are now disconnected from the code that established the */
/* control socket, and since we want to be able to use different */
/* protocols and such, we are passed the name of the remote host and */
/* must turn that into the test specific addressing information. */
-
+
/* complete_addrinfos will either succede or exit the process */
complete_addrinfos(&remote_res,
&local_res,
@@ -3145,24 +3145,24 @@
SOCK_STREAM,
IPPROTO_TCP,
0);
-
+
if ( print_headers ) {
print_top_test_header("TCP MSS TEST",local_res,remote_res);
}
/*set up the data socket */
send_socket = create_data_socket(local_res);
-
+
if (send_socket == INVALID_SOCKET){
perror("netperf: send_tcp_stream: tcp stream data socket");
exit(1);
}
-
+
if (debug) {
fprintf(where,"send_tcp_stream: send_socket obtained...\n");
}
-
-
+
+
if (!no_control) {
/* Tell the remote end to do a listen. The server alters the
socket paramters on the other side at this point, hence the
@@ -3172,7 +3172,7 @@
that no changes beyond the system's default should be
used. Alignment is the exception, it will default to 1, which
will be no alignment alterations. */
-
+
netperf_request.content.request_type = DO_TCP_STREAM;
tcp_stream_request->send_buf_size = rss_size_req;
tcp_stream_request->recv_buf_size = rsr_size_req;
@@ -3200,9 +3200,9 @@
fprintf(where,
"netperf: send_tcp_mss: requesting TCP stream test\n");
}
-
+
send_request();
-
+
/* The response from the remote will contain all of the relevant
socket parameters for this test type. We will put them back
into the variables here so they can be displayed if desired.
@@ -3213,9 +3213,9 @@
will grab the counter right after the accept call. This saves
the hassle of extra messages being sent for the TCP
tests. */
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
if (debug)
fprintf(where,"remote listen done.\n");
@@ -3224,12 +3224,12 @@
rem_nodelay = tcp_stream_response->no_delay;
remote_cpu_usage= tcp_stream_response->measure_cpu;
remote_cpu_rate = tcp_stream_response->cpu_rate;
-
+
/* we have to make sure that the server port number is in
network order */
set_port_number(remote_res,
(short)tcp_stream_response->data_port_number);
-
+
rem_rcvavoid = tcp_stream_response->so_rcvavoid;
rem_sndavoid = tcp_stream_response->so_sndavoid;
}
@@ -3240,13 +3240,13 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
}
/*Connect up to the remote port on the data socket */
- if (connect(send_socket,
+ if (connect(send_socket,
remote_res->ai_addr,
remote_res->ai_addrlen) == INVALID_SOCKET){
perror("netperf: send_tcp_mss: data socket connect failed");
@@ -3257,20 +3257,20 @@
/* find-out what the TCP maximum segment_size was (if possible) */
tcp_mss = -1;
get_tcp_info(send_socket,&tcp_mss);
-
+
/* just go ahead and close the socket, the remote should figure it
out */
close(send_socket);
/* statistics? we don't need no stinking statistics */
-
+
switch (verbosity) {
case 0:
fprintf(where,
mss_fmt_0,
tcp_mss,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
case 1:
@@ -3281,12 +3281,12 @@
fprintf(where,
mss_fmt_0, /* the format string */
tcp_mss,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
-
+
}
@@ -4050,7 +4050,7 @@
-#if defined(HAVE_SENDFILE)
+#if defined(HAVE_SENDFILE)
#if defined(QUICK_SENDPATH)
@@ -4076,23 +4076,23 @@
system call - TCP_SENDFILE. It receives its parameters via global
variables from the shell and writes its output to the standard
output. Basically, this is the same test as the send_tcp_stream()
- logic and we even tell the remote to do a TCP_STREAM test since for
+ logic and we even tell the remote to do a TCP_STREAM test since for
all it knows, nothig is different. */
-void
+void
sendfile_tcp_stream(remote_host)
char remote_host[];
{
-
+
char *tput_title = "\
Recv Send Send \n\
Socket Socket Message Elapsed \n\
Size Size Size Time Throughput \n\
bytes bytes bytes secs. %s/sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f %s\n";
-
+
char *tput_fmt_1 =
"%6d %6d %6d %-6.2f %7.2f %s\n";
@@ -4120,16 +4120,16 @@
%6d\n";
float elapsed_time;
-
+
/* what we want is to have a buffer space that is at least one */
/* send-size greater than our send window. this will insure that we */
/* are never trying to re-use a buffer that may still be in the hands */
/* of the transport. This buffer will be malloc'd after we have found */
/* the size of the local senc socket buffer. We will want to deal */
/* with alignment and offset concerns as well. */
-
+
struct sendfile_ring_elt *send_ring;
-
+
int len;
unsigned int nummessages = 0;
SOCKET send_socket;
@@ -4140,14 +4140,14 @@
/* during a test... ;-) at some point, this should probably become a */
/* 64bit integral type, but those are not entirely common yet */
double bytes_sent = 0.0;
-
+
float local_cpu_utilization;
float local_service_demand;
float remote_cpu_utilization;
float remote_service_demand;
double thruput;
-
+
struct addrinfo *remote_res;
struct addrinfo *local_res;
struct sockaddr_in server;
@@ -4163,23 +4163,23 @@
off_t scratch_len; /* Darwin 9.x need a value-result parameter */
#endif
#if defined (__sun)
- size_t scratch_len; /* the sun sendfilev() needs a place to
+ size_t scratch_len; /* the sun sendfilev() needs a place to
tell us how many bytes were written,
even though it also returns the value */
sendfilevec_t sv;
#endif /* __sun */
-
+
struct tcp_stream_request_struct *tcp_stream_request;
struct tcp_stream_response_struct *tcp_stream_response;
struct tcp_stream_results_struct *tcp_stream_result;
- tcp_stream_request =
+ tcp_stream_request =
(struct tcp_stream_request_struct *)netperf_request.content.test_specific_data;
tcp_stream_response =
(struct tcp_stream_response_struct *)netperf_response.content.test_specific_data;
- tcp_stream_result =
+ tcp_stream_result =
(struct tcp_stream_results_struct *)netperf_response.content.test_specific_data;
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
@@ -4190,10 +4190,10 @@
/* control socket, and since we want to be able to use different */
/* protocols and such, we are passed the name of the remote host and */
/* must turn that into the test specific addressing information. */
-
+
bzero((char *)&server,
sizeof(server));
-
+
complete_addrinfos(&remote_res,
&local_res,
remote_host,
@@ -4215,7 +4215,7 @@
send_ring = NULL;
confidence_iteration = 1;
init_stat();
-
+
/* we have a great-big while loop which controls the number of times */
/* we run a particular test. this is for the calculation of a */
/* confidence interval (I really should have stayed awake during */
@@ -4225,14 +4225,14 @@
while (((confidence < 0) && (confidence_iteration < iteration_max)) ||
(confidence_iteration <= iteration_min)) {
-
+
/* initialize a few counters. we have to remember that we might be */
/* going through the loop more than once. */
-
+
nummessages = 0;
bytes_sent = 0.0;
times_up = 0;
-
+
/* set up the data socket */
send_socket = create_data_socket(local_res);
@@ -4240,11 +4240,11 @@
perror("netperf: sendfile_tcp_stream: tcp stream data socket");
exit(1);
}
-
+
if (debug) {
fprintf(where,"sendfile_tcp_stream: send_socket obtained...\n");
}
-
+
#if defined(TCP_CORK)
/* should this even be here?!? */
if (loc_tcpcork > 0) {
@@ -4262,9 +4262,9 @@
fprintf(where,"sendfile_tcp_stream: tcp_cork...\n");
}
}
-
-#endif /* TCP_CORK */
+#endif /* TCP_CORK */
+
/* at this point, we have either retrieved the socket buffer sizes, */
/* or have tried to set them, so now, we may want to set the send */
/* size based on that (because the user either did not use a -m */
@@ -4273,7 +4273,7 @@
/* particular reason, just arbitrary... */
/*check for file size/ min file size here? create file here/ back out???*/
-
+
if (send_size == 0) {
if (lss_size > 0) {
send_size = lss_size;
@@ -4282,7 +4282,7 @@
send_size = 4096;
}
}
-
+
/* set-up the data buffer ring with the requested alignment and
offset. note also that we have allocated a quantity of memory
that is at least one send-size greater than our socket buffer
@@ -4290,37 +4290,37 @@
allocated - this can be a bit of a problem when the send_size
is bigger than the socket size, so we must check... the user
may have wanted to explicitly set the "width" of our send
- buffers, we should respect that wish... */
+ buffers, we should respect that wish... */
/*sendring -> an offset index that will shift the starting point of the*/
/*section of the file sent throughout the file*/
-
+
if (send_width == 0) {
send_width = (lss_size/send_size) + 1;
if (send_width == 1) send_width++;
}
-
- if (send_ring == NULL) {
+ if (send_ring == NULL) {
+
/* only allocate the send ring once. this is a networking test,
not a memory allocation test. this way, we do not need a
deallocate_buffer_ring() routine, and I don't feel like
- writing one anyway :) raj 11/94 */
-
+ writing one anyway :) raj 11/94 */
+
send_ring = alloc_sendfile_buf_ring(send_width,
send_size,
local_send_align,
local_send_offset);
}
-
+
/* If the user has requested cpu utilization measurements, we must
calibrate the cpu(s). We will perform this task within the
tests themselves. If the user has specified the cpu rate, then
calibrate_local_cpu will return rather quickly as it will have
nothing to do. If local_cpu_rate is zero, then we will go
through all the "normal" calibration stuff and return the rate
- back. */
-
+ back. */
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
@@ -4332,7 +4332,7 @@
they will be passed as 0, which will indicate to the remote
that no changes beyond the system's default should be
used. Alignment is the exception, it will default to 1, which
- will be no alignment alterations. */
+ will be no alignment alterations. */
netperf_request.content.request_type = DO_TCP_STREAM;
tcp_stream_request->send_buf_size = rss_size_req;
@@ -4365,7 +4365,7 @@
fprintf(where,
"netperf: send_tcp_stream: requesting TCP stream test\n");
}
-
+
send_request();
/* The response from the remote will contain all of the relevant
@@ -4377,7 +4377,7 @@
value right after the connect returns. The remote will grab the
counter right after the accept call. This saves the hassle of
extra messages being sent for the TCP tests. */
-
+
recv_response();
if (!netperf_response.content.serv_errno) {
@@ -4402,7 +4402,7 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
@@ -4411,7 +4411,7 @@
#endif
/*Connect up to the remote port on the data socket */
- if (connect(send_socket,
+ if (connect(send_socket,
remote_res->ai_addr,
remote_res->ai_addrlen) == INVALID_SOCKET){
perror("netperf: send_tcp_stream: data socket connect failed");
@@ -4435,10 +4435,10 @@
extra message after the accept on the remote. If it failed,
we'll see it here. If it didn't, we might as well start pumping
data. */
-
+
/* Set-up the test end conditions. For a stream test, they can be */
/* either time or byte-count based. */
-
+
if (test_time) {
/* The user wanted to end the test after a period of time. */
times_up = 0;
@@ -4458,18 +4458,18 @@
bytes_remaining = test_bytes;
times_up = 1;
}
-
+
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
-
+
cpu_start(local_cpu_usage);
-
+
#ifdef WANT_INTERVALS
INTERVALS_INIT();
#endif /* WANT_INTERVALS */
-
+
/* before we start, initialize a few variables */
#ifdef WANT_DEMO
@@ -4483,12 +4483,12 @@
false. When the test is controlled by byte count, the time test
will always return false. When the test is finished, the whole
expression will go false and we will stop sending data. */
-
+
while ((!times_up) || (bytes_remaining > 0)) {
-
+
/* the sendfile_tcp_stream test does not support making the buffers
dirty. 08/2000 */
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
/* timestamp just before we go into sendfile() and then again
@@ -4497,11 +4497,11 @@
HIST_timestamp(&time_one);
}
#endif /* WANT_HISTOGRAM */
-
+
/* you can look at netlib.h for a description of the fields we
are passing to sendfile(). 08/2000 */
#ifdef QUICK_SENDPATH
- if ((len=sendpath(send_socket,
+ if ((len=sendpath(send_socket,
fill_file,
send_ring->offset,
send_ring->length,
@@ -4509,8 +4509,8 @@
send_ring->flags)) != send_size)
#elif defined(__linux)
scratch_offset = send_ring->offset;
- if ((len=sendfile(send_socket,
- send_ring->fildes,
+ if ((len=sendfile(send_socket,
+ send_ring->fildes,
&scratch_offset, /* modified after the call! */
send_ring->length)) != send_size)
#elif defined (__sun)
@@ -4524,8 +4524,8 @@
if ((len = sendfilev(send_socket, &sv, 1, &scratch_len)) != send_size)
#elif defined(__FreeBSD__)
/* so close to HP-UX and yet so far away... :) */
- if ((sendfile(send_ring->fildes,
- send_socket,
+ if ((sendfile(send_ring->fildes,
+ send_socket,
send_ring->offset,
send_ring->length,
NULL,
@@ -4542,8 +4542,8 @@
send_ring->flags) != 0) ||
(scratch_len != send_size))
#else /* original sendile HP-UX */
- if ((len=sendfile(send_socket,
- send_ring->fildes,
+ if ((len=sendfile(send_socket,
+ send_ring->fildes,
send_ring->offset,
send_ring->length,
send_ring->hdtrl,
@@ -4564,35 +4564,35 @@
fflush(stderr);
exit(1);
}
-
+
/* offset += len;*/
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
/* timestamp the exit from the send call and update the
histogram */
-
+
HIST_timestamp(&time_two);
HIST_add(time_hist,delta_micro(&time_one,&time_two));
}
-#endif /* WANT_HISTOGRAM */
-
+#endif /* WANT_HISTOGRAM */
+
#ifdef WANT_DEMO
demo_stream_interval(send_size);
-#endif
-
-#ifdef WANT_INTERVALS
+#endif
+
+#ifdef WANT_INTERVALS
INTERVALS_WAIT();
#endif /* WANT_INTERVALS */
-
+
/* now we want to move our pointer to the next position in the */
/* data buffer...we may also want to wrap back to the "beginning" */
/* of the bufferspace, so we will mod the number of messages sent */
/* by the send width, and use that to calculate the offset to add */
/* to the base pointer. */
- nummessages++;
- send_ring = send_ring->next;
+ nummessages++;
+ send_ring = send_ring->next;
if (bytes_remaining) {
bytes_remaining -= send_size;
}
@@ -4608,12 +4608,12 @@
tcp_mss = -1;
get_tcp_info(send_socket,&tcp_mss);
}
-
+
if (shutdown(send_socket,SHUT_WR) == SOCKET_ERROR) {
perror("netperf: cannot shutdown tcp stream socket");
exit(1);
}
-
+
/* hang a recv() off the socket to block until the remote has */
/* brought all the data up into the application. it will do a */
/* shutdown to cause a FIN to be sent our way. We will assume that */
@@ -4623,22 +4623,22 @@
scratch buffer from the send_ring to use for the
receive. however, since we "know" that the recv should be
returning zero bytes (not that we are making the checks we
- should) we can pass the address of the flags field. raj 08/2000
+ should) we can pass the address of the flags field. raj 08/2000
*/
recv(send_socket,
- &(send_ring->flags),
+ &(send_ring->flags),
sizeof(send_ring->flags),
0);
-
+
/* this call will always give us the elapsed time for the test, and */
/* will also store-away the necessaries for cpu utilization */
-
+
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being */
/* measured and how */
/* long did we really */
/* run? */
-
+
/* we are finished with the socket, so close it to prevent hitting */
/* the limit on maximum open files. */
@@ -4647,7 +4647,7 @@
/* Get the statistics from the remote end. The remote will have */
/* calculated service demand and all those interesting things. If it */
/* wasn't supposed to care, it will return obvious values. */
-
+
recv_response();
if (!netperf_response.content.serv_errno) {
@@ -4662,10 +4662,10 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
-
+
/* We now calculate what our thruput was for the test. In the future, */
/* we may want to include a calculation of the thruput measured by */
/* the remote, but it should be the case that for a TCP stream test, */
@@ -4674,11 +4674,11 @@
/* If it was time, we needed to, and if it was by bytes, the user may */
/* have specified a number of bytes that wasn't a multiple of the */
/* send_size, so we really didn't send what he asked for ;-) */
-
+
bytes_sent = ntohd(tcp_stream_result->bytes_received);
-
+
thruput = calc_thruput(bytes_sent);
-
+
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu */
@@ -4687,7 +4687,7 @@
/* there was no idle counter in the kernel(s). We need to make */
/* a note of this for the user's benefit...*/
if (local_cpu_usage) {
-
+
local_cpu_utilization = calc_cpu_util(0.0);
local_service_demand = calc_service_demand(bytes_sent,
0.0,
@@ -4698,9 +4698,9 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
if (remote_cpu_usage) {
-
+
remote_cpu_utilization = tcp_stream_result->cpu_util;
remote_service_demand = calc_service_demand(bytes_sent,
0.0,
@@ -4711,7 +4711,7 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
- }
+ }
else {
/* we were not measuring cpu, for the confidence stuff, we */
/* should make it -1.0 */
@@ -4724,7 +4724,7 @@
/* at this point, we want to calculate the confidence information. */
/* if debugging is on, calculate_confidence will print-out the */
/* parameters we pass it */
-
+
calculate_confidence(confidence_iteration,
elapsed_time,
thruput,
@@ -4732,7 +4732,7 @@
remote_cpu_utilization,
local_service_demand,
remote_service_demand);
-
+
confidence_iteration++;
}
@@ -4770,7 +4770,7 @@
if (local_cpu_usage || remote_cpu_usage) {
local_cpu_method = format_cpu_method(cpu_method);
remote_cpu_method = format_cpu_method(tcp_stream_result->cpu_method);
-
+
switch (verbosity) {
case 0:
@@ -4779,7 +4779,7 @@
cpu_fmt_0,
local_service_demand,
local_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
@@ -4788,7 +4788,7 @@
cpu_fmt_0,
remote_service_demand,
remote_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
@@ -4803,7 +4803,7 @@
local_cpu_method,
remote_cpu_method);
}
-
+
fprintf(where,
cpu_fmt_1, /* the format string */
rsr_size, /* remote recvbuf size */
@@ -4815,7 +4815,7 @@
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand, /* remote service demand */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
@@ -4824,15 +4824,15 @@
else {
/* The tester did not wish to measure service demand. */
-
+
switch (verbosity) {
-
+
case 0:
fprintf(where,
tput_fmt_0,
thruput,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
@@ -4850,7 +4850,7 @@
send_size, /* how large were the sends */
elapsed_time, /* how long did it take */
thruput, /* how fast did it go */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
@@ -4861,17 +4861,17 @@
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
if (verbosity > 1) {
/* The user wanted to know it all, so we will give it to him. */
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
/* this stuff needs to be worked-out in the presence of confidence */
/* intervals and multiple iterations of the test... raj 11/94 */
-
+
fprintf(where,
ksink_fmt,
"Bytes",
@@ -4911,7 +4911,7 @@
void
recv_tcp_stream()
{
-
+
struct sockaddr_storage myaddr_in, peeraddr_in;
SOCKET s_listen,s_data;
netperf_socklen_t addrlen;
@@ -4919,7 +4919,7 @@
unsigned int receive_calls;
float elapsed_time;
double bytes_received;
-
+
struct ring_elt *recv_ring;
struct addrinfo *local_res;
@@ -4934,25 +4934,25 @@
struct tcp_stream_request_struct *tcp_stream_request;
struct tcp_stream_response_struct *tcp_stream_response;
struct tcp_stream_results_struct *tcp_stream_results;
-
+
#ifdef DO_SELECT
FD_ZERO(&readfds);
timeout.tv_sec = 1;
timeout.tv_usec = 0;
#endif /* DO_SELECT */
- tcp_stream_request =
+ tcp_stream_request =
(struct tcp_stream_request_struct *)netperf_request.content.test_specific_data;
- tcp_stream_response =
+ tcp_stream_response =
(struct tcp_stream_response_struct *)netperf_response.content.test_specific_data;
- tcp_stream_results =
+ tcp_stream_results =
(struct tcp_stream_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_tcp_stream: entered...\n");
fflush(where);
}
-
+
/* We want to set-up the listen socket with all the desired */
/* parameters and then let the initiator know that all is ready. If */
/* socket size defaults are to be used, then the initiator will have */
@@ -4960,27 +4960,27 @@
/* send-back what they are. If that information cannot be determined, */
/* then we send-back -1's for the sizes. If things go wrong for any */
/* reason, we will drop back ten yards and punt. */
-
+
/* If anything goes wrong, we want the remote to know about it. It */
/* would be best if the error that the remote reports to the user is */
/* the actual error we encountered, rather than some bogus unexpected */
/* response type message. */
-
+
if (debug) {
fprintf(where,"recv_tcp_stream: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = TCP_STREAM_RESPONSE;
-
+
if (debug) {
fprintf(where,"recv_tcp_stream: the response type is set...\n");
fflush(where);
}
-
+
/* We now alter the message_ptr variable to be at the desired */
/* alignment with the desired offset. */
-
+
if (debug) {
fprintf(where,"recv_tcp_stream: requested alignment of %d\n",
tcp_stream_request->recv_alignment);
@@ -5011,20 +5011,20 @@
0);
s_listen = create_data_socket(local_res);
-
+
if (s_listen == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
exit(1);
}
-
+
#ifdef WIN32
/* The test timer can fire during operations on the listening socket,
so to make the start_timer below work we have to move
it to close s_listen while we are blocked on accept. */
win_kludge_socket2 = s_listen;
#endif
-
+
/* what sort of sizes did we end-up with? */
if (tcp_stream_request->receive_size == 0) {
if (lsr_size > 0) {
@@ -5037,7 +5037,7 @@
else {
recv_size = tcp_stream_request->receive_size;
}
-
+
/* we want to set-up our recv_ring in a manner analagous to what we */
/* do on the sending side. this is more for the sake of symmetry */
/* than for the needs of say copy avoidance, but it might also be */
@@ -5059,53 +5059,53 @@
fprintf(where,"recv_tcp_stream: receive alignment and offset set...\n");
fflush(where);
}
-
+
/* Now, let's set-up the socket to listen for connections */
if (listen(s_listen, 5) == SOCKET_ERROR) {
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
-
+
exit(1);
}
-
-
+
+
/* now get the port number assigned by the system */
addrlen = sizeof(myaddr_in);
- if (getsockname(s_listen,
+ if (getsockname(s_listen,
(struct sockaddr *)&myaddr_in,
&addrlen) == SOCKET_ERROR){
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
-
+
exit(1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is */
/* returned to the sender also implicitly telling the sender that the */
/* socket buffer sizing has been done. */
-
- tcp_stream_response->data_port_number =
+
+ tcp_stream_response->data_port_number =
(int) ntohs(((struct sockaddr_in *)&myaddr_in)->sin_port);
netperf_response.content.serv_errno = 0;
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a -1 to */
/* the initiator. */
-
+
tcp_stream_response->cpu_rate = (float)0.0; /* assume no cpu */
if (tcp_stream_request->measure_cpu) {
tcp_stream_response->measure_cpu = 1;
- tcp_stream_response->cpu_rate =
+ tcp_stream_response->cpu_rate =
calibrate_local_cpu(tcp_stream_request->cpu_rate);
}
else {
tcp_stream_response->measure_cpu = 0;
}
-
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
tcp_stream_response->send_buf_size = lss_size;
@@ -5116,9 +5116,9 @@
tcp_stream_response->receive_size = recv_size;
send_response();
-
+
addrlen = sizeof(peeraddr_in);
-
+
if ((s_data=accept(s_listen,
(struct sockaddr *)&peeraddr_in,
&addrlen)) == INVALID_SOCKET) {
@@ -5150,15 +5150,15 @@
kludge_socket_options(s_data);
#endif /* KLUDGE_SOCKET_OPTIONS */
-
+
/* Now it's time to start receiving data on the connection. We will */
/* first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(tcp_stream_request->measure_cpu);
-
+
/* The loop will exit when the sender does a shutdown, which will */
/* return a length of zero */
-
+
/* there used to be an #ifdef DIRTY call to access_buffer() here,
but we have switched from accessing the buffer before the recv()
call to accessing the buffer after the recv() call. The
@@ -5202,7 +5202,7 @@
#endif /* DO_SELECT */
}
-
+
/* perform a shutdown to signal the sender that */
/* we have received all the data sent. raj 4/93 */
@@ -5211,11 +5211,11 @@
send_response();
exit(1);
}
-
+
cpu_stop(tcp_stream_request->measure_cpu,&elapsed_time);
-
+
/* send the results to the sender */
-
+
if (debug) {
fprintf(where,
"recv_tcp_stream: got %g bytes\n",
@@ -5225,18 +5225,18 @@
receive_calls);
fflush(where);
}
-
+
tcp_stream_results->bytes_received = htond(bytes_received);
tcp_stream_results->elapsed_time = elapsed_time;
tcp_stream_results->recv_calls = receive_calls;
-
+
tcp_stream_results->cpu_method = cpu_method;
tcp_stream_results->num_cpus = lib_num_loc_cpus;
-
+
if (tcp_stream_request->measure_cpu) {
tcp_stream_results->cpu_util = calc_cpu_util(0.0);
};
-
+
if (debug) {
fprintf(where,
"recv_tcp_stream: test complete, sending results.\n");
@@ -5260,12 +5260,12 @@
/* This is the server-side routine for the tcp maerts test. It is
implemented as one routine. I could break things-out somewhat, but
- didn't feel it was necessary. */
+ didn't feel it was necessary. */
void
recv_tcp_maerts()
{
-
+
struct sockaddr_storage myaddr_in, peeraddr_in;
struct addrinfo *local_res;
char local_name[BUFSIZ];
@@ -5277,25 +5277,25 @@
unsigned int send_calls;
float elapsed_time;
double bytes_sent = 0.0 ;
-
+
struct ring_elt *send_ring;
struct tcp_maerts_request_struct *tcp_maerts_request;
struct tcp_maerts_response_struct *tcp_maerts_response;
struct tcp_maerts_results_struct *tcp_maerts_results;
-
- tcp_maerts_request =
+
+ tcp_maerts_request =
(struct tcp_maerts_request_struct *)netperf_request.content.test_specific_data;
- tcp_maerts_response =
+ tcp_maerts_response =
(struct tcp_maerts_response_struct *)netperf_response.content.test_specific_data;
- tcp_maerts_results =
+ tcp_maerts_results =
(struct tcp_maerts_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_tcp_maerts: entered...\n");
fflush(where);
}
-
+
/* We want to set-up the listen socket with all the desired
parameters and then let the initiator know that all is ready. If
socket size defaults are to be used, then the initiator will have
@@ -5303,27 +5303,27 @@
send-back what they are. If that information cannot be
determined, then we send-back -1's for the sizes. If things go
wrong for any reason, we will drop back ten yards and punt. */
-
+
/* If anything goes wrong, we want the remote to know about it. It
would be best if the error that the remote reports to the user is
the actual error we encountered, rather than some bogus
unexpected response type message. */
-
+
if (debug) {
fprintf(where,"recv_tcp_maerts: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = TCP_MAERTS_RESPONSE;
-
+
if (debug) {
fprintf(where,"recv_tcp_maerts: the response type is set...\n");
fflush(where);
}
-
+
/* We now alter the message_ptr variable to be at the desired */
/* alignment with the desired offset. */
-
+
if (debug) {
fprintf(where,"recv_tcp_maerts: requested alignment of %d\n",
tcp_maerts_request->send_alignment);
@@ -5331,12 +5331,12 @@
}
/* Grab a socket to listen on, and then listen on it. */
-
+
if (debug) {
fprintf(where,"recv_tcp_maerts: grabbing a socket...\n");
fflush(where);
}
-
+
/* create_data_socket expects to find some things in the global */
/* variables, so set the globals based on the values in the request. */
/* once the socket has been created, we will set the response values */
@@ -5361,13 +5361,13 @@
0);
s_listen = create_data_socket(local_res);
-
+
if (s_listen == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
exit(1);
}
-
+
#ifdef WIN32
/* The test timer can fire during operations on the listening socket,
so to make the start_timer below work we have to move
@@ -5375,7 +5375,7 @@
win_kludge_socket2 = s_listen;
#endif
-
+
/* what sort of sizes did we end-up with? */
if (tcp_maerts_request->send_size == 0) {
if (lss_size > 0) {
@@ -5388,7 +5388,7 @@
else {
send_size = tcp_maerts_request->send_size;
}
-
+
/* we want to set-up our recv_ring in a manner analagous to what we */
/* do on the recving side. this is more for the sake of symmetry */
/* than for the needs of say copy avoidance, but it might also be */
@@ -5410,53 +5410,53 @@
fprintf(where,"recv_tcp_maerts: receive alignment and offset set...\n");
fflush(where);
}
-
+
/* Now, let's set-up the socket to listen for connections */
if (listen(s_listen, 5) == SOCKET_ERROR) {
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
-
+
exit(1);
}
-
-
+
+
/* now get the port number assigned by the system */
addrlen = sizeof(myaddr_in);
- if (getsockname(s_listen,
+ if (getsockname(s_listen,
(struct sockaddr *)&myaddr_in,
&addrlen) == SOCKET_ERROR){
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
-
+
exit(1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is */
/* returned to the sender also implicitly telling the sender that the */
/* socket buffer sizing has been done. */
-
- tcp_maerts_response->data_port_number =
+
+ tcp_maerts_response->data_port_number =
(int) ntohs(((struct sockaddr_in *)&myaddr_in)->sin_port);
netperf_response.content.serv_errno = 0;
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a -1 to */
/* the initiator. */
-
+
tcp_maerts_response->cpu_rate = (float)0.0; /* assume no cpu */
if (tcp_maerts_request->measure_cpu) {
tcp_maerts_response->measure_cpu = 1;
- tcp_maerts_response->cpu_rate =
+ tcp_maerts_response->cpu_rate =
calibrate_local_cpu(tcp_maerts_request->cpu_rate);
}
else {
tcp_maerts_response->measure_cpu = 0;
}
-
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
tcp_maerts_response->send_buf_size = lss_size;
@@ -5467,7 +5467,7 @@
tcp_maerts_response->send_size = send_size;
send_response();
-
+
addrlen = sizeof(peeraddr_in);
/* we will start the timer before the accept() to be somewhat
@@ -5478,10 +5478,10 @@
/* Now it's time to start receiving data on the connection. We will
first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(tcp_maerts_request->measure_cpu);
-
+
if ((s_data=accept(s_listen,
(struct sockaddr *)&peeraddr_in,
&addrlen)) == INVALID_SOCKET) {
@@ -5502,7 +5502,7 @@
#endif /* WIN32 */
#ifdef KLUDGE_SOCKET_OPTIONS
-
+
/* this is for those systems which *INCORRECTLY* fail to pass
attributes across an accept() call. Including this goes against
my better judgement :( raj 11/95 */
@@ -5510,10 +5510,10 @@
kludge_socket_options(s_data);
#endif /* KLUDGE_SOCKET_OPTIONS */
-
+
/* The loop will exit when the sender does a shutdown, which will */
/* return a length of zero */
-
+
bytes_sent = 0.0;
send_calls = 0;
@@ -5555,7 +5555,7 @@
send_ring = send_ring->next;
}
-
+
/* perform a shutdown to signal the sender that */
/* we have received all the data sent. raj 4/93 */
@@ -5569,14 +5569,14 @@
brought all the data up into the application. it will do a
shutdown to cause a FIN to be sent our way. We will assume that
any exit from the recv() call is good... raj 4/93 */
-
+
recv(s_data, send_ring->buffer_ptr, send_size, 0);
-
-
+
+
cpu_stop(tcp_maerts_request->measure_cpu,&elapsed_time);
-
+
/* send the results to the sender */
-
+
if (debug) {
fprintf(where,
"recv_tcp_maerts: got %g bytes\n",
@@ -5586,15 +5586,15 @@
send_calls);
fflush(where);
}
-
+
tcp_maerts_results->bytes_sent = htond(bytes_sent);
tcp_maerts_results->elapsed_time = elapsed_time;
tcp_maerts_results->send_calls = send_calls;
-
+
if (tcp_maerts_request->measure_cpu) {
tcp_maerts_results->cpu_util = calc_cpu_util(0.0);
};
-
+
if (debug) {
fprintf(where,
"recv_tcp_maerts: test complete, sending results.\n");
@@ -5607,7 +5607,7 @@
len);
fflush(where);
}
-
+
tcp_maerts_results->cpu_method = cpu_method;
tcp_maerts_results->num_cpus = lib_num_loc_cpus;
send_response();
@@ -5625,7 +5625,7 @@
void
send_tcp_rr(char remote_host[])
{
-
+
char *tput_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans.\n\
@@ -5640,12 +5640,12 @@
char *tput_fmt_0 =
"%7.2f %s\n";
-
+
char *tput_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %7.2f %s\n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *cpu_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem\n\
@@ -5663,26 +5663,26 @@
Socket Size Request Resp. Elapsed Latency CPU CPU S.dem S.dem\n\
Send Recv Size Size Time usecs local remote local remote\n\
bytes bytes bytes bytes secs. per tran %% %c %% %c us/Tr us/Tr\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f %c %s\n";
-
+
char *cpu_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f %s\n";
-
+
char *cpu_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *ksink_fmt = "\
Alignment Offset RoundTrip Trans Throughput\n\
Local Remote Local Remote Latency Rate %-8.8s/s\n\
Send Recv Send Recv usec/Tran per sec Outbound Inbound\n\
%5d %5d %5d %5d %-6.3f %-6.3f %-6.3f %-6.3f\n";
-
-
+
+
int timed_out = 0;
float elapsed_time;
-
+
int len;
char *temp_message_ptr;
int nummessages;
@@ -5692,16 +5692,16 @@
struct ring_elt *send_ring;
struct ring_elt *recv_ring;
-
+
int rsp_bytes_left;
int rsp_bytes_recvd;
-
+
float local_cpu_utilization;
float local_service_demand;
float remote_cpu_utilization;
float remote_service_demand;
double thruput;
-
+
struct addrinfo *local_res;
struct addrinfo *remote_res;
@@ -5734,13 +5734,13 @@
send */
#endif
- tcp_rr_request =
+ tcp_rr_request =
(struct tcp_rr_request_struct *)netperf_request.content.test_specific_data;
tcp_rr_response=
(struct tcp_rr_response_struct *)netperf_response.content.test_specific_data;
tcp_rr_result =
(struct tcp_rr_results_struct *)netperf_response.content.test_specific_data;
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
@@ -5762,9 +5762,9 @@
if ( print_headers ) {
print_top_test_header("TCP REQUEST/RESPONSE TEST",local_res,remote_res);
}
-
+
/* initialize a few counters */
-
+
send_ring = NULL;
recv_ring = NULL;
confidence_iteration = 1;
@@ -5804,7 +5804,7 @@
if (send_width == 0) send_width = 1;
if (recv_width == 0) recv_width = 1;
-
+
if (send_ring == NULL) {
send_ring = allocate_buffer_ring(send_width,
req_size,
@@ -5818,30 +5818,30 @@
local_recv_align,
local_recv_offset);
}
-
+
/*set up the data socket */
send_socket = create_data_socket(local_res);
-
+
if (send_socket == INVALID_SOCKET){
perror("netperf: send_tcp_rr: tcp stream data socket");
exit(1);
}
-
+
if (debug) {
fprintf(where,"send_tcp_rr: send_socket obtained...\n");
}
-
+
/* If the user has requested cpu utilization measurements, we must */
/* calibrate the cpu(s). We will perform this task within the tests */
/* themselves. If the user has specified the cpu rate, then */
/* calibrate_local_cpu will return rather quickly as it will have */
/* nothing to do. If local_cpu_rate is zero, then we will go through */
/* all the "normal" calibration stuff and return the rate back.*/
-
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
-
+
if (!no_control) {
/* Tell the remote end to do a listen. The server alters the
socket paramters on the other side at this point, hence the
@@ -5851,7 +5851,7 @@
that no changes beyond the system's default should be
used. Alignment is the exception, it will default to 8, which
will be no alignment alterations. */
-
+
netperf_request.content.request_type = DO_TCP_RR;
tcp_rr_request->recv_buf_size = rsr_size_req;
tcp_rr_request->send_buf_size = rss_size_req;
@@ -5874,13 +5874,13 @@
}
tcp_rr_request->port = atoi(remote_data_port);
tcp_rr_request->ipfamily = af_to_nf(remote_res->ai_family);
-
+
if (debug > 1) {
fprintf(where,"netperf: send_tcp_rr: requesting TCP rr test\n");
}
-
+
send_request();
-
+
/* The response from the remote will contain all of the relevant
socket parameters for this test type. We will put them back
into the variables here so they can be displayed if desired.
@@ -5891,9 +5891,9 @@
will grab the counter right after the accept call. This saves
the hassle of extra messages being sent for the TCP
tests. */
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
if (debug)
fprintf(where,"remote listen done.\n");
@@ -5912,7 +5912,7 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
}
@@ -5922,14 +5922,14 @@
#endif
/*Connect up to the remote port on the data socket */
- if (connect(send_socket,
+ if (connect(send_socket,
remote_res->ai_addr,
remote_res->ai_addrlen) == INVALID_SOCKET){
perror("netperf: data socket connect failed");
-
+
exit(1);
}
-
+
#ifdef WIN32
/* this is used so the timer thread can close the socket out from */
/* under us, which to date is the easiest/cleanest/least */
@@ -5945,10 +5945,10 @@
/* indicated a problem. I failed to see the value of the extra */
/* message after the accept on the remote. If it failed, we'll see it */
/* here. If it didn't, we might as well start pumping data. */
-
+
/* Set-up the test end conditions. For a request/response test, they */
/* can be either time or transaction based. */
-
+
if (test_time) {
/* The user wanted to end the test after a period of time. */
times_up = 0;
@@ -5960,17 +5960,17 @@
trans_remaining = test_bytes;
times_up = 1;
}
-
+
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
-
+
cpu_start(local_cpu_usage);
#ifdef WANT_INTERVALS
INTERVALS_INIT();
#endif /* WANT_INTERVALS */
-
+
/* We use an "OR" to control test execution. When the test is */
/* controlled by time, the byte count check will always return false. */
/* When the test is controlled by byte count, the time test will */
@@ -6023,7 +6023,7 @@
}
#endif /* WANT_FIRST_BURST */
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
/* timestamp just before our call to send, and then again just
@@ -6034,7 +6034,7 @@
HIST_timestamp(&time_one);
}
#endif /* WANT_HISTOGRAM */
-
+
if ((len = send(send_socket,
send_ring->buffer_ptr,
req_size,
@@ -6072,9 +6072,9 @@
}
rsp_bytes_left -= rsp_bytes_recvd;
temp_message_ptr += rsp_bytes_recvd;
- }
+ }
recv_ring = recv_ring->next;
-
+
#ifdef WANT_FIRST_BURST
/* so, since we've gotten a response back, update the
bookkeeping accordingly. there is one less request
@@ -6096,7 +6096,7 @@
/* another call to break. */
break;
}
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
HIST_timestamp(&time_two);
@@ -6108,15 +6108,15 @@
demo_rr_interval(1);
#endif
-#ifdef WANT_INTERVALS
+#ifdef WANT_INTERVALS
INTERVALS_WAIT();
#endif /* WANT_INTERVALS */
-
- nummessages++;
+
+ nummessages++;
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug > 3) {
if ((nummessages % 100) == 0) {
fprintf(where,
@@ -6133,19 +6133,19 @@
when they were being controlled by time. So, I have replaced
this shutdown call with a call to close that can be found later
in the procedure. */
-
+
/* this call will always give us the elapsed time for the test,
and will also store-away the necessaries for cpu utilization */
-
+
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being */
/* measured? how long */
/* did we really run? */
-
+
if (!no_control) {
/* Get the statistics from the remote end. The remote will have
calculated CPU utilization. If it wasn't supposed to care, it
- will return obvious values. */
-
+ will return obvious values. */
+
recv_response();
if (!netperf_response.content.serv_errno) {
if (debug)
@@ -6160,12 +6160,12 @@
exit(1);
}
}
-
+
/* We now calculate what our "throughput" was for the test. */
-
+
bytes_xferd = (req_size * nummessages) + (rsp_size * nummessages);
thruput = nummessages/elapsed_time;
-
+
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu
utilization for the system(s) Of course, some of the
@@ -6186,7 +6186,7 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
if (remote_cpu_usage) {
remote_cpu_utilization = tcp_rr_result->cpu_util;
/* since calc_service demand is doing ms/Kunit we will
@@ -6201,7 +6201,7 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
-
+
}
else {
/* we were not measuring cpu, for the confidence stuff, we */
@@ -6215,7 +6215,7 @@
/* at this point, we want to calculate the confidence information.
if debugging is on, calculate_confidence will print-out the
parameters we pass it */
-
+
calculate_confidence(confidence_iteration,
elapsed_time,
thruput,
@@ -6223,8 +6223,8 @@
remote_cpu_utilization,
local_service_demand,
remote_service_demand);
-
-
+
+
confidence_iteration++;
/* we are now done with the socket, so close it */
@@ -6258,7 +6258,7 @@
if (local_cpu_usage || remote_cpu_usage) {
local_cpu_method = format_cpu_method(cpu_method);
remote_cpu_method = format_cpu_method(tcp_rr_result->cpu_method);
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -6266,7 +6266,7 @@
cpu_fmt_0,
local_service_demand,
local_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
else {
@@ -6274,7 +6274,7 @@
cpu_fmt_0,
remote_service_demand,
remote_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
break;
@@ -6293,7 +6293,7 @@
format_units(),
local_cpu_method,
remote_cpu_method);
- }
+ }
}
fprintf(where,
@@ -6303,14 +6303,14 @@
req_size, /* how large were the requests */
rsp_size, /* guess */
elapsed_time, /* how long was the test */
- ('x' == libfmt) ? thruput :
+ ('x' == libfmt) ? thruput :
calc_thruput_interval_omni(thruput * (req_size+rsp_size),
1.0),
local_cpu_utilization, /* local cpu */
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand, /* remote service demand */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
fprintf(where,
cpu_fmt_1_line_2,
@@ -6321,7 +6321,7 @@
}
else {
/* The tester did not wish to measure service demand. */
-
+
switch (verbosity) {
case 0:
fprintf(where,
@@ -6329,7 +6329,7 @@
('x' == libfmt) ? thruput :
calc_thruput_interval_omni(thruput * (req_size+rsp_size),
1.0),
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
case 1:
@@ -6355,26 +6355,26 @@
calc_thruput_interval_omni with an elapsed time of
1.0 s to get it converted to [kmg]bits/s or
[KMG]Bytes/s */
- ('x' == libfmt) ? thruput :
+ ('x' == libfmt) ? thruput :
calc_thruput_interval_omni(thruput * (req_size+rsp_size),
1.0),
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
fprintf(where,
tput_fmt_1_line_2,
rss_size, /* remote recvbuf size */
rsr_size);
-
+
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
/* how to handle the verbose information in the presence of */
/* confidence intervals is yet to be determined... raj 11/94 */
if (verbosity > 1) {
@@ -6406,7 +6406,7 @@
outstanding at any one time. otherwise we will
underreport the latency of individual
transactions. learned from saf by raj 2007-06-08 */
- (((double)1.0/thruput)*(double)1000000.0) *
+ (((double)1.0/thruput)*(double)1000000.0) *
(double) (1 + ((first_burst_size > 0) ? first_burst_size : 0)),
thruput,
calc_thruput_interval_omni(thruput * (double)req_size,1.0),
@@ -6419,7 +6419,7 @@
#endif /* WANT_HISTOGRAM */
}
-
+
}
#endif /* WANT_MIGRATION */
@@ -6427,10 +6427,10 @@
/*
* Linux has this odd behavior where if the socket buffers are larger than
* a device's txqueuelen, the kernel will silently drop transmits which would
- * not fit into the tx queue, and not pass an ENOBUFS error back to the
+ * not fit into the tx queue, and not pass an ENOBUFS error back to the
* application. As a result, a UDP stream test can report absurd transmit
- * bandwidths (like 20Gb/s on a 1GbE NIC). This behavior can be avoided if
- * you request extended error reporting on the socket. This is done by
+ * bandwidths (like 20Gb/s on a 1GbE NIC). This behavior can be avoided if
+ * you request extended error reporting on the socket. This is done by
* setting the IP_RECVERR socket option at the IP level.
*/
static void
@@ -6468,45 +6468,45 @@
Socket Message Elapsed Messages \n\
Size Size Time Okay Errors Throughput\n\
bytes bytes secs # # %s/sec\n\n";
-
+
char *tput_fmt_0 =
"%7.2f\n";
-
+
char *tput_fmt_1 = "\
%6d %6d %-7.2f %7d %6d %7.2f\n\
%6d %-7.2f %7d %7.2f\n\n";
-
-
+
+
char *cpu_title = "\
Socket Message Elapsed Messages CPU Service\n\
Size Size Time Okay Errors Throughput Util Demand\n\
bytes bytes secs # # %s/sec %% %c%c us/KB\n\n";
-
+
char *cpu_fmt_0 =
"%6.2f %c\n";
-
+
char *cpu_fmt_1 = "\
%6d %6d %-7.2f %7d %6d %7.1f %-6.2f %-6.3f\n\
%6d %-7.2f %7d %7.1f %-6.2f %-6.3f\n\n";
-
+
unsigned int messages_recvd;
unsigned int messages_sent;
unsigned int failed_sends;
- float elapsed_time,
+ float elapsed_time,
local_cpu_utilization,
remote_cpu_utilization;
-
+
float local_service_demand, remote_service_demand;
double local_thruput, remote_thruput;
double bytes_sent;
double bytes_recvd;
-
-
+
+
int len;
struct ring_elt *send_ring;
SOCKET data_socket;
-
+
unsigned int sum_messages_sent;
unsigned int sum_messages_recvd;
unsigned int sum_failed_sends;
@@ -6514,18 +6514,18 @@
struct addrinfo *local_res;
struct addrinfo *remote_res;
-
+
struct udp_stream_request_struct *udp_stream_request;
struct udp_stream_response_struct *udp_stream_response;
struct udp_stream_results_struct *udp_stream_results;
-
- udp_stream_request =
+
+ udp_stream_request =
(struct udp_stream_request_struct *)netperf_request.content.test_specific_data;
- udp_stream_response =
+ udp_stream_response =
(struct udp_stream_response_struct *)netperf_response.content.test_specific_data;
- udp_stream_results =
+ udp_stream_results =
(struct udp_stream_results_struct *)netperf_response.content.test_specific_data;
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
@@ -6536,7 +6536,7 @@
/* control socket, and since we want to be able to use different */
/* protocols and such, we are passed the name of the remote host and */
/* must turn that into the test specific addressing information. */
-
+
complete_addrinfos(&remote_res,
&local_res,
remote_host,
@@ -6565,22 +6565,22 @@
while (((confidence < 0) && (confidence_iteration < iteration_max)) ||
(confidence_iteration <= iteration_min)) {
-
+
/* initialize a few counters. we have to remember that we might be */
/* going through the loop more than once. */
messages_sent = 0;
messages_recvd = 0;
failed_sends = 0;
times_up = 0;
-
+
/*set up the data socket */
data_socket = create_data_socket(local_res);
-
+
if (data_socket == INVALID_SOCKET){
perror("udp_send: data socket");
exit(1);
}
-
+
/* now, we want to see if we need to set the send_size */
if (send_size == 0) {
if (lss_size > 0) {
@@ -6590,39 +6590,39 @@
send_size = 4096;
}
}
-
-
+
+
/* set-up the data buffer with the requested alignment and offset, */
/* most of the numbers here are just a hack to pick something nice */
/* and big in an attempt to never try to send a buffer a second time */
/* before it leaves the node...unless the user set the width */
/* explicitly. */
if (send_width == 0) send_width = 32;
-
+
if (send_ring == NULL ) {
send_ring = allocate_buffer_ring(send_width,
send_size,
local_send_align,
local_send_offset);
}
-
-
+
+
/* if the user supplied a cpu rate, this call will complete rather */
/* quickly, otherwise, the cpu rate will be retured to us for */
/* possible display. The Library will keep it's own copy of this data */
/* for use elsewhere. We will only display it. (Does that make it */
/* "opaque" to us?) */
-
+
if (local_cpu_usage)
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
-
+
if (!no_control) {
/* Tell the remote end to set up the data connection. The server
sends back the port number and alters the socket parameters
there. Of course this is a datagram service so no connection
is actually set up, the server just sets up the socket and
binds it. */
-
+
netperf_request.content.request_type = DO_UDP_STREAM;
udp_stream_request->recv_buf_size = rsr_size_req;
udp_stream_request->message_size = send_size;
@@ -6636,11 +6636,11 @@
udp_stream_request->so_sndavoid = rem_sndavoid;
udp_stream_request->port = atoi(remote_data_port);
udp_stream_request->ipfamily = af_to_nf(remote_res->ai_family);
-
+
send_request();
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
if (debug)
fprintf(where,"send_udp_stream: remote data connection done.\n");
@@ -6650,14 +6650,14 @@
perror("send_udp_stream: error on remote");
exit(1);
}
-
+
/* Place the port number returned by the remote into the sockaddr */
/* structure so our sends can be sent to the correct place. Also get */
/* some of the returned socket buffer information for user display. */
-
+
/* make sure that port numbers are in the proper order */
set_port_number(remote_res,(short)udp_stream_response->data_port_number);
-
+
rsr_size = udp_stream_response->recv_buf_size;
rss_size = udp_stream_response->send_buf_size;
remote_cpu_rate = udp_stream_response->cpu_rate;
@@ -6673,7 +6673,7 @@
/* that we can be informed of certain things, but am not sure */
/* yet...also, this is the way I would expect a client to behave */
/* when talking to a server */
- if (local_connected) {
+ if (local_connected) {
if (connect(data_socket,
remote_res->ai_addr,
remote_res->ai_addrlen) == INVALID_SOCKET){
@@ -6688,7 +6688,7 @@
#if defined (__linux)
enable_enobufs(data_socket);
#endif
-
+
#ifdef WIN32
/* this is used so the timer thread can close the socket out from */
/* under us, which to date is the easiest/cleanest/least */
@@ -6704,7 +6704,7 @@
/* test controlled by a byte count as well, but since UDP is not */
/* reliable, that could prove difficult. so, in the meantime, we */
/* only allow a UDP_STREAM test to be a timed test. */
-
+
if (test_time) {
times_up = 0;
start_timer(test_time);
@@ -6713,11 +6713,11 @@
fprintf(where,"Sorry, UDP_STREAM tests must be timed.\n");
fflush(where);
}
-
+
/* Get the start count for the idle counter and the start time */
-
+
cpu_start(local_cpu_usage);
-
+
#ifdef WANT_INTERVALS
INTERVALS_INIT();
#endif /* WANT_INTERVALS */
@@ -6736,7 +6736,7 @@
/* then starts again, we would end the test too soon. something to */
/* think about... */
while (!times_up) {
-
+
#ifdef DIRTY
/* we want to dirty some number of consecutive integers in the buffer */
/* we are about to send. we may also want to bring some number of */
@@ -6748,14 +6748,14 @@
loc_dirty_count,
loc_clean_count);
#endif /* DIRTY */
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
HIST_timestamp(&time_one);
}
#endif /* WANT_HISTOGRAM */
-
- if (local_connected) {
+
+ if (local_connected) {
len = send(data_socket,
send_ring->buffer_ptr,
send_size,
@@ -6770,7 +6770,7 @@
}
if (len != send_size) {
- if ((len >= 0) ||
+ if ((len >= 0) ||
SOCKET_EINTR(len))
break;
if (errno == ENOBUFS) {
@@ -6780,14 +6780,14 @@
perror("udp_send: data send error");
exit(1);
}
- messages_sent++;
-
+ messages_sent++;
+
/* now we want to move our pointer to the next position in the */
/* data buffer... */
-
+
send_ring = send_ring->next;
-
-
+
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
/* get the second timestamp */
@@ -6800,21 +6800,21 @@
demo_stream_interval(send_size);
#endif
-#ifdef WANT_INTERVALS
+#ifdef WANT_INTERVALS
INTERVALS_WAIT();
#endif /* WANT_INTERVALS */
-
+
}
-
+
/* This is a timed test, so the remote will be returning to us after */
/* a time. We should not need to send any "strange" messages to tell */
/* the remote that the test is completed, unless we decide to add a */
/* number of messages to the test. */
-
+
/* the test is over, so get stats and stuff */
- cpu_stop(local_cpu_usage,
+ cpu_stop(local_cpu_usage,
&elapsed_time);
-
+
if (!no_control) {
/* Get the statistics from the remote end */
recv_response();
@@ -6839,14 +6839,14 @@
bytes_sent = (double) send_size * (double) messages_sent;
local_thruput = calc_thruput(bytes_sent);
-
-
+
+
/* we asume that the remote ran for as long as we did */
-
+
remote_thruput = calc_thruput(bytes_recvd);
-
+
/* print the results for this socket and message size */
-
+
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu */
/* utilization for the system(s) We pass zeros for the local */
@@ -6866,7 +6866,7 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
/* The local calculations could use variables being kept by */
/* the local netlib routines. The remote calcuations need to */
/* have a few things passed to them. */
@@ -6890,11 +6890,11 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
-
+
/* at this point, we want to calculate the confidence information. */
/* if debugging is on, calculate_confidence will print-out the */
/* parameters we pass it */
-
+
calculate_confidence(confidence_iteration,
elapsed_time,
remote_thruput,
@@ -6902,7 +6902,7 @@
remote_cpu_utilization,
local_service_demand,
remote_service_demand);
-
+
/* since the routine calculate_confidence is rather generic, and */
/* we have a few other parms of interest, we will do a little work */
/* here to caclulate their average. */
@@ -6910,7 +6910,7 @@
sum_messages_recvd += messages_recvd;
sum_failed_sends += failed_sends;
sum_local_thruput += local_thruput;
-
+
confidence_iteration++;
/* this datapoint is done, so we don't need the socket any longer */
@@ -6942,8 +6942,8 @@
/* of greater than 1, we will display a veritable plethora of */
/* background information from outside of this block as it it */
/* not cpu_measurement specific... */
-
-
+
+
if (confidence < 0) {
/* we did not hit confidence, but were we asked to look for it? */
if (iteration_max > 1) {
@@ -6954,7 +6954,7 @@
if (local_cpu_usage || remote_cpu_usage) {
local_cpu_method = format_cpu_method(cpu_method);
remote_cpu_method = format_cpu_method(udp_stream_results->cpu_method);
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -7061,26 +7061,26 @@
int len = 0;
unsigned int bytes_received = 0;
float elapsed_time;
-
+
int message_size;
unsigned int messages_recvd = 0;
-
+
struct udp_stream_request_struct *udp_stream_request;
struct udp_stream_response_struct *udp_stream_response;
struct udp_stream_results_struct *udp_stream_results;
-
- udp_stream_request =
+
+ udp_stream_request =
(struct udp_stream_request_struct *)netperf_request.content.test_specific_data;
- udp_stream_response =
+ udp_stream_response =
(struct udp_stream_response_struct *)netperf_response.content.test_specific_data;
- udp_stream_results =
+ udp_stream_results =
(struct udp_stream_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_udp_stream: entered...\n");
fflush(where);
}
-
+
/* We want to set-up the listen socket with all the desired */
/* parameters and then let the initiator know that all is ready. If */
/* socket size defaults are to be used, then the initiator will have */
@@ -7088,27 +7088,27 @@
/* send-back what they are. If that information cannot be determined, */
/* then we send-back -1's for the sizes. If things go wrong for any */
/* reason, we will drop back ten yards and punt. */
-
+
/* If anything goes wrong, we want the remote to know about it. It */
/* would be best if the error that the remote reports to the user is */
/* the actual error we encountered, rather than some bogus unexpected */
/* response type message. */
-
+
if (debug > 1) {
fprintf(where,"recv_udp_stream: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = UDP_STREAM_RESPONSE;
-
+
if (debug > 2) {
fprintf(where,"recv_udp_stream: the response type is set...\n");
fflush(where);
}
-
+
/* We now alter the message_ptr variable to be at the desired */
/* alignment with the desired offset. */
-
+
if (debug > 1) {
fprintf(where,"recv_udp_stream: requested alignment of %d\n",
udp_stream_request->recv_alignment);
@@ -7126,9 +7126,9 @@
fprintf(where,"recv_udp_stream: receive alignment and offset set...\n");
fflush(where);
}
-
+
/* Grab a socket to listen on, and then listen on it. */
-
+
if (debug > 1) {
fprintf(where,"recv_udp_stream: grabbing a socket...\n");
fflush(where);
@@ -7157,7 +7157,7 @@
0);
s_data = create_data_socket(local_res);
-
+
if (s_data == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
@@ -7165,33 +7165,33 @@
}
udp_stream_response->test_length = udp_stream_request->test_length;
-
+
/* now get the port number assigned by the system */
addrlen = sizeof(myaddr_in);
- if (getsockname(s_data,
+ if (getsockname(s_data,
(struct sockaddr *)&myaddr_in,
&addrlen) == SOCKET_ERROR){
netperf_response.content.serv_errno = errno;
close(s_data);
send_response();
-
+
exit(1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is */
/* returned to the sender also implicitly telling the sender that the */
/* socket buffer sizing has been done. */
-
- udp_stream_response->data_port_number =
+
+ udp_stream_response->data_port_number =
(int) ntohs(((struct sockaddr_in *)&myaddr_in)->sin_port);
netperf_response.content.serv_errno = 0;
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a -1 to */
/* the initiator. */
-
+
udp_stream_response->cpu_rate = (float)0.0; /* assume no cpu */
udp_stream_response->measure_cpu = 0;
if (udp_stream_request->measure_cpu) {
@@ -7200,13 +7200,13 @@
/* "real" calibration. Otherwise, all it will really do is */
/* store it away... */
udp_stream_response->measure_cpu = 1;
- udp_stream_response->cpu_rate =
+ udp_stream_response->cpu_rate =
calibrate_local_cpu(udp_stream_request->cpu_rate);
}
-
+
message_size = udp_stream_request->message_size;
test_time = udp_stream_request->test_length;
-
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
udp_stream_response->send_buf_size = lss_size;
@@ -7215,12 +7215,12 @@
udp_stream_response->so_sndavoid = loc_sndavoid;
send_response();
-
+
/* Now it's time to start receiving data on the connection. We will */
/* first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(udp_stream_request->measure_cpu);
-
+
#ifdef WIN32
/* this is used so the timer thread can close the socket out from */
/* under us, which to date is the easiest/cleanest/least */
@@ -7230,10 +7230,10 @@
/* and such would be appreciated raj 1/96 */
win_kludge_socket = s_data;
#endif /* WIN32 */
-
+
/* The loop will exit when the timer pops, or if we happen to recv a */
/* message of less than send_size bytes... */
-
+
times_up = 0;
start_timer(test_time + PAD_TIME);
@@ -7246,7 +7246,7 @@
/* We "connect" up to the remote post to allow us to use the recv */
/* call instead of the recvfrom call. Presumeably, this is a little */
/* simpler, and a little more efficient. */
-
+
if (local_connected) {
/* Receive the first message using recvfrom to find the remote address */
@@ -7280,7 +7280,7 @@
fflush(where);
}
}
-
+
while (!times_up) {
if(local_connected) {
len = recv(s_data,
@@ -7290,10 +7290,10 @@
} else {
len = recvfrom(s_data,
recv_ring->buffer_ptr,
- message_size,
+ message_size,
0,0,0);
}
-
+
if (len != message_size) {
if ((len == SOCKET_ERROR) && !SOCKET_EINTR(len)) {
netperf_response.content.serv_errno = errno;
@@ -7305,19 +7305,19 @@
messages_recvd++;
recv_ring = recv_ring->next;
}
-
+
if (debug) {
fprintf(where,"recv_udp_stream: got %d messages.\n",messages_recvd);
fflush(where);
}
-
-
+
+
/* The loop now exits due timer or < send_size bytes received. in */
/* reality, we only really support a timed UDP_STREAM test. raj */
/* 12/95 */
-
+
cpu_stop(udp_stream_request->measure_cpu,&elapsed_time);
-
+
if (times_up) {
/* we ended on a timer, subtract the PAD_TIME */
elapsed_time -= (float)PAD_TIME;
@@ -7325,25 +7325,25 @@
else {
stop_timer();
}
-
+
if (debug) {
fprintf(where,"recv_udp_stream: test ended in %f seconds.\n",elapsed_time);
fflush(where);
}
-
-
+
+
/* We will count the "off" message that got us out of the loop */
bytes_received = (messages_recvd * message_size) + len;
-
+
/* send the results to the sender */
-
+
if (debug) {
fprintf(where,
"recv_udp_stream: got %d bytes\n",
bytes_received);
fflush(where);
}
-
+
netperf_response.content.response_type = UDP_STREAM_RESULTS;
udp_stream_results->bytes_received = bytes_received;
udp_stream_results->messages_recvd = messages_recvd;
@@ -7356,13 +7356,13 @@
else {
udp_stream_results->cpu_util = (float) -1.0;
}
-
+
if (debug > 1) {
fprintf(where,
"recv_udp_stream: test complete, sending results.\n");
fflush(where);
}
-
+
send_response();
close(s_data);
@@ -7373,7 +7373,7 @@
void
send_udp_rr(char remote_host[])
{
-
+
char *tput_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans.\n\
@@ -7385,16 +7385,16 @@
Socket Size Request Resp. Elapsed \n\
Send Recv Size Size Time Throughput \n\
bytes Bytes bytes bytes secs. %s/sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f %s\n";
-
+
char *tput_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %7.2f %s\n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *cpu_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem\n\
@@ -7406,18 +7406,18 @@
Socket Size Request Resp. Elapsed Tput CPU CPU S.dem S.dem\n\
Send Recv Size Size Time %-8.8s local remote local remote\n\
bytes bytes bytes bytes secs. per sec %% %c %% %c us/Tr us/Tr\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f %c %s\n";
-
+
char *cpu_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f %s\n";
-
+
char *cpu_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
float elapsed_time;
-
+
struct ring_elt *send_ring;
struct ring_elt *recv_ring;
@@ -7426,18 +7426,18 @@
SOCKET send_socket;
int trans_remaining;
int bytes_xferd;
-
+
int rsp_bytes_recvd;
-
+
float local_cpu_utilization;
float local_service_demand;
float remote_cpu_utilization;
float remote_service_demand;
double thruput;
-
+
struct addrinfo *local_res;
struct addrinfo *remote_res;
-
+
struct udp_rr_request_struct *udp_rr_request;
struct udp_rr_response_struct *udp_rr_response;
struct udp_rr_results_struct *udp_rr_result;
@@ -7448,18 +7448,18 @@
(struct udp_rr_response_struct *)netperf_response.content.test_specific_data;
udp_rr_result =
(struct udp_rr_results_struct *)netperf_response.content.test_specific_data;
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
}
#endif
-
+
/* since we are now disconnected from the code that established the */
/* control socket, and since we want to be able to use different */
/* protocols and such, we are passed the name of the remote host and */
/* must turn that into the test specific addressing information. */
-
+
complete_addrinfos(&remote_res,
&local_res,
remote_host,
@@ -7472,7 +7472,7 @@
}
/* initialize a few counters */
-
+
send_ring = NULL;
recv_ring = NULL;
nummessages = 0;
@@ -7490,43 +7490,43 @@
while (((confidence < 0) && (confidence_iteration < iteration_max)) ||
(confidence_iteration <= iteration_min)) {
-
+
nummessages = 0;
bytes_xferd = 0;
times_up = 0;
trans_remaining = 0;
-
+
/* set-up the data buffers with the requested alignment and offset */
-
+
if (send_width == 0) send_width = 1;
if (recv_width == 0) recv_width = 1;
-
+
if (send_ring == NULL) {
send_ring = allocate_buffer_ring(send_width,
req_size,
local_send_align,
local_send_offset);
}
-
+
if (recv_ring == NULL) {
recv_ring = allocate_buffer_ring(recv_width,
rsp_size,
local_recv_align,
local_recv_offset);
}
-
+
/*set up the data socket */
send_socket = create_data_socket(local_res);
-
+
if (send_socket == INVALID_SOCKET){
perror("netperf: send_udp_rr: udp rr data socket");
exit(1);
}
-
+
if (debug) {
fprintf(where,"send_udp_rr: send_socket obtained...\n");
}
-
+
/* If the user has requested cpu utilization measurements, we must */
/* calibrate the cpu(s). We will perform this task within the tests */
/* themselves. If the user has specified the cpu rate, then */
@@ -7535,11 +7535,11 @@
/* all the "normal" calibration stuff and return the rate back. If */
/* there is no idle counter in the kernel idle loop, the */
/* local_cpu_rate will be set to -1. */
-
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
-
+
if (!no_control) {
/* Tell the remote end to do a listen. The server alters the
socket paramters on the other side at this point, hence the
@@ -7549,7 +7549,7 @@
that no changes beyond the system's default should be
used. Alignment is the exception, it will default to 8, which
will be no alignment alterations. */
-
+
netperf_request.content.request_type = DO_UDP_RR;
udp_rr_request->recv_buf_size = rsr_size_req;
udp_rr_request->send_buf_size = rss_size_req;
@@ -7571,13 +7571,13 @@
}
udp_rr_request->port = atoi(remote_data_port);
udp_rr_request->ipfamily = af_to_nf(remote_res->ai_family);
-
+
if (debug > 1) {
fprintf(where,"netperf: send_udp_rr: requesting UDP r/r test\n");
}
-
+
send_request();
-
+
/* The response from the remote will contain all of the relevant
socket parameters for this test type. We will put them back
into the variables here so they can be displayed if desired.
@@ -7588,9 +7588,9 @@
will grab the counter right after the accept call. This saves
the hassle of extra messages being sent for the UDP
tests. */
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
if (debug)
fprintf(where,"remote listen done.\n");
@@ -7621,8 +7621,8 @@
/* does make a performance difference as we may not have to do as */
/* many routing lookups, however, I expect that a client would */
/* behave this way. raj 1/94 */
-
- if ( connect(send_socket,
+
+ if ( connect(send_socket,
remote_res->ai_addr,
remote_res->ai_addrlen) == INVALID_SOCKET ) {
perror("netperf: data socket connect failed");
@@ -7638,13 +7638,13 @@
/* and such would be appreciated raj 1/96 */
win_kludge_socket = send_socket;
#endif /* WIN32 */
-
+
/* Data Socket set-up is finished. If there were problems, either the */
/* connect would have failed, or the previous response would have */
/* indicated a problem. I failed to see the value of the extra */
/* message after the accept on the remote. If it failed, we'll see it */
/* here. If it didn't, we might as well start pumping data. */
-
+
/* Set-up the test end conditions. For a request/response test, they */
/* can be either time or transaction based. */
@@ -7659,23 +7659,23 @@
trans_remaining = test_bytes;
times_up = 1;
}
-
+
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
-
+
cpu_start(local_cpu_usage);
#ifdef WANT_DEMO
if (demo_mode) {
demo_first_timestamp();
}
-#endif
+#endif
#ifdef WANT_INTERVALS
INTERVALS_INIT();
#endif /* WANT_INTERVALS */
-
+
/* We use an "OR" to control test execution. When the test is */
/* controlled by time, the byte count check will always return */
/* false. When the test is controlled by byte count, the time test */
@@ -7722,9 +7722,9 @@
exit(1);
}
send_ring = send_ring->next;
-
+
/* receive the response. with UDP we will get it all, or nothing */
-
+
if((rsp_bytes_recvd=recv(send_socket,
recv_ring->buffer_ptr,
rsp_size,
@@ -7738,7 +7738,7 @@
exit(1);
}
recv_ring = recv_ring->next;
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
HIST_timestamp(&time_two);
@@ -7757,41 +7757,41 @@
demo_rr_interval(1);
#endif
-#ifdef WANT_INTERVALS
+#ifdef WANT_INTERVALS
INTERVALS_WAIT();
#endif /* WANT_INTERVALS */
-
- nummessages++;
+
+ nummessages++;
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug > 3) {
if ((nummessages % 100) == 0) {
fprintf(where,"Transaction %d completed\n",nummessages);
fflush(where);
}
}
-
+
}
-
+
/* for some strange reason, I used to call shutdown on the UDP */
/* data socket here. I'm not sure why, because it would not have */
/* any effect... raj 11/94 */
-
+
/* this call will always give us the elapsed time for the test, and */
/* will also store-away the necessaries for cpu utilization */
-
+
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being */
/* measured? how long */
/* did we really run? */
-
+
if (!no_control) {
/* Get the statistics from the remote end. The remote will have
calculated service demand and all those interesting
things. If it wasn't supposed to care, it will return obvious
values. */
-
+
recv_response();
if (!netperf_response.content.serv_errno) {
if (debug)
@@ -7814,10 +7814,10 @@
/* UDP rr test, that the two numbers should be *very* close... */
/* We calculate bytes_sent regardless of the way the test length */
/* was controlled. */
-
+
bytes_xferd = (req_size * nummessages) + (rsp_size * nummessages);
thruput = nummessages / elapsed_time;
-
+
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu */
@@ -7829,11 +7829,11 @@
if (local_cpu_usage) {
local_cpu_utilization = calc_cpu_util(0.0);
-
+
/* since calc_service demand is doing ms/Kunit we will */
/* multiply the number of transaction by 1024 to get */
/* "good" numbers */
-
+
local_service_demand = calc_service_demand((double) nummessages*1024,
0.0,
0.0,
@@ -7843,14 +7843,14 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
if (remote_cpu_usage) {
remote_cpu_utilization = udp_rr_result->cpu_util;
-
+
/* since calc_service demand is doing ms/Kunit we will */
/* multiply the number of transaction by 1024 to get */
/* "good" numbers */
-
+
remote_service_demand = calc_service_demand((double) nummessages*1024,
0.0,
remote_cpu_utilization,
@@ -7869,11 +7869,11 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
-
+
/* at this point, we want to calculate the confidence information. */
/* if debugging is on, calculate_confidence will print-out the */
/* parameters we pass it */
-
+
calculate_confidence(confidence_iteration,
elapsed_time,
thruput,
@@ -7881,10 +7881,10 @@
remote_cpu_utilization,
local_service_demand,
remote_service_demand);
-
-
+
+
confidence_iteration++;
-
+
/* we are done with the socket */
close(send_socket);
}
@@ -7897,7 +7897,7 @@
&remote_cpu_utilization,
&local_service_demand,
&remote_service_demand);
-
+
/* We are now ready to print all the information. If the user */
/* has specified zero-level verbosity, we will just print the */
/* local service demand, or the remote service demand. If the */
@@ -7906,18 +7906,18 @@
/* of greater than 1, we will display a veritable plethora of */
/* background information from outside of this block as it it */
/* not cpu_measurement specific... */
-
+
if (confidence < 0) {
/* we did not hit confidence, but were we asked to look for it? */
if (iteration_max > 1) {
display_confidence();
}
}
-
+
if (local_cpu_usage || remote_cpu_usage) {
local_cpu_method = format_cpu_method(cpu_method);
remote_cpu_method = format_cpu_method(udp_rr_result->cpu_method);
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -7956,7 +7956,7 @@
remote_cpu_method);
}
}
-
+
fprintf(where,
cpu_fmt_1_line_1, /* the format string */
lss_size, /* local sendbuf size */
@@ -7964,14 +7964,14 @@
req_size, /* how large were the requests */
rsp_size, /* guess */
elapsed_time, /* how long was the test */
- ('x' == libfmt) ? thruput :
+ ('x' == libfmt) ? thruput :
calc_thruput_interval_omni(thruput * (req_size+rsp_size),
1.0),
local_cpu_utilization, /* local cpu */
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand, /* remote service demand */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
fprintf(where,
cpu_fmt_1_line_2,
@@ -7989,7 +7989,7 @@
('x' == libfmt) ? thruput :
calc_thruput_interval_omni(thruput * (req_size+rsp_size),
1.0),
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
case 1:
@@ -7999,7 +7999,7 @@
('x' == libfmt) ? tput_title : tput_title_band,
format_units());
}
-
+
fprintf(where,
tput_fmt_1_line_1, /* the format string */
lss_size,
@@ -8007,16 +8007,16 @@
req_size, /* how large were the requests */
rsp_size, /* how large were the responses */
elapsed_time, /* how long did it take */
- ('x' == libfmt) ? thruput :
+ ('x' == libfmt) ? thruput :
calc_thruput_interval_omni(thruput * (req_size+rsp_size),
1.0),
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
fprintf(where,
tput_fmt_1_line_2,
rss_size, /* remote recvbuf size */
rsr_size);
-
+
break;
}
}
@@ -8027,7 +8027,7 @@
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
/* how to handle the verbose information in the presence of */
/* confidence intervals is yet to be determined... raj 11/94 */
@@ -8036,7 +8036,7 @@
/* This information will include as much as we can find about */
/* UDP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
#ifdef WANT_HISTOGRAM
fprintf(where,"\nHistogram of request/reponse times.\n");
fflush(where);
@@ -8051,7 +8051,7 @@
void
recv_udp_rr()
{
-
+
struct ring_elt *recv_ring;
struct ring_elt *send_ring;
@@ -8060,7 +8060,7 @@
char port_buffer[PORTBUFSIZE];
struct sockaddr_storage myaddr_in;
- struct sockaddr_storage peeraddr;
+ struct sockaddr_storage peeraddr;
SOCKET s_data;
netperf_socklen_t addrlen;
int trans_received;
@@ -8068,23 +8068,23 @@
int request_bytes_recvd;
int response_bytes_sent;
float elapsed_time;
-
+
struct udp_rr_request_struct *udp_rr_request;
struct udp_rr_response_struct *udp_rr_response;
struct udp_rr_results_struct *udp_rr_results;
-
- udp_rr_request =
+
+ udp_rr_request =
(struct udp_rr_request_struct *)netperf_request.content.test_specific_data;
- udp_rr_response =
+ udp_rr_response =
(struct udp_rr_response_struct *)netperf_response.content.test_specific_data;
- udp_rr_results =
+ udp_rr_results =
(struct udp_rr_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_udp_rr: entered...\n");
fflush(where);
}
-
+
/* We want to set-up the listen socket with all the desired */
/* parameters and then let the initiator know that all is ready. If */
/* socket size defaults are to be used, then the initiator will have */
@@ -8092,27 +8092,27 @@
/* send-back what they are. If that information cannot be determined, */
/* then we send-back -1's for the sizes. If things go wrong for any */
/* reason, we will drop back ten yards and punt. */
-
+
/* If anything goes wrong, we want the remote to know about it. It */
/* would be best if the error that the remote reports to the user is */
/* the actual error we encountered, rather than some bogus unexpected */
/* response type message. */
-
+
if (debug) {
fprintf(where,"recv_udp_rr: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = UDP_RR_RESPONSE;
-
+
if (debug) {
fprintf(where,"recv_udp_rr: the response type is set...\n");
fflush(where);
}
-
+
/* We now alter the message_ptr variables to be at the desired */
/* alignments with the desired offsets. */
-
+
if (debug) {
fprintf(where,"recv_udp_rr: requested recv alignment of %d offset %d\n",
udp_rr_request->recv_alignment,
@@ -8140,15 +8140,15 @@
fprintf(where,"recv_udp_rr: receive alignment and offset set...\n");
fflush(where);
}
-
+
/* Grab a socket to listen on, and then listen on it. */
-
+
if (debug) {
fprintf(where,"recv_udp_rr: grabbing a socket...\n");
fflush(where);
}
-
+
/* create_data_socket expects to find some things in the global */
/* variables, so set the globals based on the values in the request. */
/* once the socket has been created, we will set the response values */
@@ -8170,71 +8170,71 @@
SOCK_DGRAM,
IPPROTO_UDP,
0);
-
+
s_data = create_data_socket(local_res);
-
+
if (s_data == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
-
+
exit(1);
}
-
+
/* now get the port number assigned by the system */
addrlen = sizeof(myaddr_in);
- if (getsockname(s_data,
+ if (getsockname(s_data,
(struct sockaddr *)&myaddr_in,
&addrlen) == SOCKET_ERROR){
netperf_response.content.serv_errno = errno;
close(s_data);
send_response();
-
+
exit(1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is */
/* returned to the sender also implicitly telling the sender that the */
/* socket buffer sizing has been done. */
-
- udp_rr_response->data_port_number =
+
+ udp_rr_response->data_port_number =
(int) ntohs(((struct sockaddr_in *)&myaddr_in)->sin_port);
netperf_response.content.serv_errno = 0;
-
+
if (debug) {
fprintf(where,
"recv port number %d\n",
((struct sockaddr_in *)&myaddr_in)->sin_port);
fflush(where);
}
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a 0.0 to */
/* the initiator. */
-
+
udp_rr_response->cpu_rate = (float)0.0; /* assume no cpu */
udp_rr_response->measure_cpu = 0;
if (udp_rr_request->measure_cpu) {
udp_rr_response->measure_cpu = 1;
udp_rr_response->cpu_rate = calibrate_local_cpu(udp_rr_request->cpu_rate);
}
-
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
udp_rr_response->send_buf_size = lss_size;
udp_rr_response->recv_buf_size = lsr_size;
udp_rr_response->so_rcvavoid = loc_rcvavoid;
udp_rr_response->so_sndavoid = loc_sndavoid;
-
+
send_response();
-
-
+
+
/* Now it's time to start receiving data on the connection. We will */
/* first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(udp_rr_request->measure_cpu);
-
+
#ifdef WIN32
/* this is used so the timer thread can close the socket out from */
/* under us, which to date is the easiest/cleanest/least */
@@ -8244,7 +8244,7 @@
/* and such would be appreciated raj 1/96 */
win_kludge_socket = s_data;
#endif /* WIN32 */
-
+
if (udp_rr_request->test_length > 0) {
times_up = 0;
trans_remaining = 0;
@@ -8255,13 +8255,13 @@
trans_remaining = udp_rr_request->test_length * -1;
}
- addrlen = sizeof(peeraddr);
+ addrlen = sizeof(peeraddr);
bzero((char *)&peeraddr, addrlen);
-
+
trans_received = 0;
while ((!times_up) || (trans_remaining > 0)) {
-
+
/* receive the request from the other side */
if ((request_bytes_recvd = recvfrom(s_data,
recv_ring->buffer_ptr,
@@ -8286,7 +8286,7 @@
udp_rr_request->response_size,
0,
(struct sockaddr *)&peeraddr,
- addrlen)) !=
+ addrlen)) !=
udp_rr_request->response_size) {
if ( SOCKET_EINTR(response_bytes_sent) )
{
@@ -8298,27 +8298,27 @@
exit(1);
}
send_ring = send_ring->next;
-
+
trans_received++;
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug) {
fprintf(where,
"recv_udp_rr: Transaction %d complete.\n",
trans_received);
fflush(where);
}
-
+
}
-
-
+
+
/* The loop now exits due to timeout or transaction count being */
/* reached */
-
+
cpu_stop(udp_rr_request->measure_cpu,&elapsed_time);
-
+
if (times_up) {
/* we ended the test by time, which was at least 2 seconds */
/* longer than we wanted to run. so, we want to subtract */
@@ -8326,16 +8326,16 @@
elapsed_time -= PAD_TIME;
}
/* send the results to the sender */
-
+
if (debug) {
fprintf(where,
"recv_udp_rr: got %d transactions\n",
trans_received);
fflush(where);
}
-
- udp_rr_results->bytes_received = (trans_received *
- (udp_rr_request->request_size +
+
+ udp_rr_results->bytes_received = (trans_received *
+ (udp_rr_request->request_size +
udp_rr_request->response_size));
udp_rr_results->trans_received = trans_received;
udp_rr_results->elapsed_time = elapsed_time;
@@ -8344,13 +8344,13 @@
if (udp_rr_request->measure_cpu) {
udp_rr_results->cpu_util = calc_cpu_util(elapsed_time);
}
-
+
if (debug) {
fprintf(where,
"recv_udp_rr: test complete, sending results.\n");
fflush(where);
}
-
+
send_response();
/* we are done with the socket now */
@@ -8364,7 +8364,7 @@
void
recv_tcp_rr()
{
-
+
struct ring_elt *send_ring;
struct ring_elt *recv_ring;
@@ -8385,23 +8385,23 @@
int timed_out = 0;
int sock_closed = 0;
float elapsed_time;
-
+
struct tcp_rr_request_struct *tcp_rr_request;
struct tcp_rr_response_struct *tcp_rr_response;
struct tcp_rr_results_struct *tcp_rr_results;
-
- tcp_rr_request =
+
+ tcp_rr_request =
(struct tcp_rr_request_struct *)netperf_request.content.test_specific_data;
tcp_rr_response =
(struct tcp_rr_response_struct *)netperf_response.content.test_specific_data;
tcp_rr_results =
(struct tcp_rr_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_tcp_rr: entered...\n");
fflush(where);
}
-
+
/* We want to set-up the listen socket with all the desired */
/* parameters and then let the initiator know that all is ready. If */
/* socket size defaults are to be used, then the initiator will have */
@@ -8409,24 +8409,24 @@
/* send-back what they are. If that information cannot be determined, */
/* then we send-back -1's for the sizes. If things go wrong for any */
/* reason, we will drop back ten yards and punt. */
-
+
/* If anything goes wrong, we want the remote to know about it. It */
/* would be best if the error that the remote reports to the user is */
/* the actual error we encountered, rather than some bogus unexpected */
/* response type message. */
-
+
if (debug) {
fprintf(where,"recv_tcp_rr: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = TCP_RR_RESPONSE;
-
+
if (debug) {
fprintf(where,"recv_tcp_rr: the response type is set...\n");
fflush(where);
}
-
+
/* allocate the recv and send rings with the requested alignments */
/* and offsets. raj 7/94 */
if (debug) {
@@ -8453,9 +8453,9 @@
tcp_rr_request->recv_alignment,
tcp_rr_request->recv_offset);
-
+
/* Grab a socket to listen on, and then listen on it. */
-
+
if (debug) {
fprintf(where,"recv_tcp_rr: grabbing a socket...\n");
fflush(where);
@@ -8485,15 +8485,15 @@
0);
s_listen = create_data_socket(local_res);
-
+
if (s_listen == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
-
+
exit(1);
}
-
-
+
+
#ifdef WIN32
/* The test timer can fire during operations on the listening socket,
so to make the start_timer below work we have to move
@@ -8501,43 +8501,43 @@
win_kludge_socket2 = s_listen;
#endif
-
+
/* Now, let's set-up the socket to listen for connections */
if (listen(s_listen, 5) == SOCKET_ERROR) {
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
-
+
exit(1);
}
-
-
+
+
/* now get the port number assigned by the system */
addrlen = sizeof(myaddr_in);
if (getsockname(s_listen,
- (struct sockaddr *)&myaddr_in,
+ (struct sockaddr *)&myaddr_in,
&addrlen) == SOCKET_ERROR) {
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
-
+
exit(1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is */
/* returned to the sender also implicitly telling the sender that the */
/* socket buffer sizing has been done. */
-
- tcp_rr_response->data_port_number =
+
+ tcp_rr_response->data_port_number =
(int) ntohs(((struct sockaddr_in *)&myaddr_in)->sin_port);
netperf_response.content.serv_errno = 0;
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a 0.0 to */
/* the initiator. */
-
+
tcp_rr_response->cpu_rate = (float)0.0; /* assume no cpu */
tcp_rr_response->measure_cpu = 0;
@@ -8545,8 +8545,8 @@
tcp_rr_response->measure_cpu = 1;
tcp_rr_response->cpu_rate = calibrate_local_cpu(tcp_rr_request->cpu_rate);
}
-
-
+
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
tcp_rr_response->send_buf_size = lss_size;
@@ -8556,18 +8556,18 @@
tcp_rr_response->so_sndavoid = loc_sndavoid;
tcp_rr_response->test_length = tcp_rr_request->test_length;
send_response();
-
+
addrlen = sizeof(peeraddr_in);
-
+
if ((s_data = accept(s_listen,
(struct sockaddr *)&peeraddr_in,
&addrlen)) == INVALID_SOCKET) {
/* Let's just punt. The remote will be given some information */
close(s_listen);
-
+
exit(1);
}
-
+
#ifdef KLUDGE_SOCKET_OPTIONS
/* this is for those systems which *INCORRECTLY* fail to pass */
/* attributes across an accept() call. Including this goes against */
@@ -8592,15 +8592,15 @@
fprintf(where,"recv_tcp_rr: accept completes on the data connection.\n");
fflush(where);
}
-
+
/* Now it's time to start receiving data on the connection. We will */
/* first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(tcp_rr_request->measure_cpu);
-
+
/* The loop will exit when we hit the end of the test time, or when */
/* we have exchanged the requested number of transactions. */
-
+
if (tcp_rr_request->test_length > 0) {
times_up = 0;
trans_remaining = 0;
@@ -8612,7 +8612,7 @@
}
trans_received = 0;
-
+
while ((!times_up) || (trans_remaining > 0)) {
temp_message_ptr = recv_ring->buffer_ptr;
request_bytes_remaining = tcp_rr_request->request_size;
@@ -8653,10 +8653,10 @@
if (debug) {
fprintf(where,"yo5\n");
fflush(where);
- }
+ }
break;
}
-
+
/* Now, send the response to the remote */
if((bytes_sent=send(s_data,
send_ring->buffer_ptr,
@@ -8666,14 +8666,14 @@
/* the test timer has popped */
timed_out = 1;
fprintf(where,"yo6\n");
- fflush(where);
+ fflush(where);
break;
}
netperf_response.content.serv_errno = 992;
send_response();
exit(1);
}
-
+
send_ring = send_ring->next;
trans_received++;
@@ -8681,13 +8681,13 @@
trans_remaining--;
}
}
-
-
+
+
/* The loop now exits due to timeout or transaction count being */
/* reached */
-
+
cpu_stop(tcp_rr_request->measure_cpu,&elapsed_time);
-
+
stop_timer();
if (timed_out) {
@@ -8698,16 +8698,16 @@
}
/* send the results to the sender */
-
+
if (debug) {
fprintf(where,
"recv_tcp_rr: got %d transactions\n",
trans_received);
fflush(where);
}
-
- tcp_rr_results->bytes_received = (trans_received *
- (tcp_rr_request->request_size +
+
+ tcp_rr_results->bytes_received = (trans_received *
+ (tcp_rr_request->request_size +
tcp_rr_request->response_size));
tcp_rr_results->trans_received = trans_received;
tcp_rr_results->elapsed_time = elapsed_time;
@@ -8716,19 +8716,19 @@
if (tcp_rr_request->measure_cpu) {
tcp_rr_results->cpu_util = calc_cpu_util(elapsed_time);
}
-
+
if (debug) {
fprintf(where,
"recv_tcp_rr: test complete, sending results.\n");
fflush(where);
}
-
+
/* we are now done with the sockets */
close(s_data);
close(s_listen);
send_response();
-
+
}
@@ -8745,7 +8745,7 @@
/* variable equal to the output of this test. We ignore any rates */
/* that may have been specified. In fact, we ignore all of the */
/* command line args! */
-
+
fprintf(where,
"%g",
calibrate_local_cpu(0.0));
@@ -8756,7 +8756,7 @@
(lib_num_loc_cpus > 1) ? "are" : "is",
lib_num_loc_cpus,
(lib_num_loc_cpus > 1) ? "cpus" : "cpu");
-
+
/* we need the cpu_start, cpu_stop in the looper case to kill the */
/* child proceses raj 4/95 */
@@ -8765,7 +8765,7 @@
cpu_stop(1,&dummy);
#endif /* USE_LOOPER */
-}
+}
void
rem_cpu_rate()
@@ -8773,11 +8773,11 @@
/* this test is much like the local variant, except that it works for */
/* the remote system, so in this case, we do pay attention to the */
/* value of the '-H' command line argument. */
-
+
fprintf(where,
"%g",
calibrate_remote_cpu());
-
+
if (verbosity > 1)
fprintf(where,
"\nThere %s %d remote %s\n",
@@ -8799,46 +8799,46 @@
void
send_tcp_conn_rr(char remote_host[])
{
-
+
char *tput_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans.\n\
Send Recv Size Size Time Rate \n\
bytes Bytes bytes bytes secs. per sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f\n";
-
+
char *tput_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %7.2f \n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *cpu_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem\n\
Send Recv Size Size Time Rate local remote local remote\n\
bytes bytes bytes bytes secs. per sec %% %% us/Tr us/Tr\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f\n";
-
+
char *cpu_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f\n";
-
+
char *cpu_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *ksink_fmt = "\n\
Alignment Offset\n\
Local Remote Local Remote\n\
Send Recv Send Recv\n\
%5d %5d %5d %5d\n";
-
-
+
+
int timed_out = 0;
float elapsed_time;
-
+
int len;
struct ring_elt *send_ring;
struct ring_elt *recv_ring;
@@ -8849,13 +8849,13 @@
double bytes_xferd;
int rsp_bytes_left;
int rsp_bytes_recvd;
-
+
float local_cpu_utilization;
float local_service_demand;
float remote_cpu_utilization;
float remote_service_demand;
double thruput;
-
+
struct addrinfo *local_res;
struct addrinfo *remote_res;
@@ -8865,15 +8865,15 @@
struct tcp_conn_rr_request_struct *tcp_conn_rr_request;
struct tcp_conn_rr_response_struct *tcp_conn_rr_response;
struct tcp_conn_rr_results_struct *tcp_conn_rr_result;
-
- tcp_conn_rr_request =
+
+ tcp_conn_rr_request =
(struct tcp_conn_rr_request_struct *)netperf_request.content.test_specific_data;
- tcp_conn_rr_response =
+ tcp_conn_rr_response =
(struct tcp_conn_rr_response_struct *)netperf_response.content.test_specific_data;
tcp_conn_rr_result =
(struct tcp_conn_rr_results_struct *)netperf_response.content.test_specific_data;
-
-
+
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
@@ -8884,7 +8884,7 @@
/* control socket, and since we want to be able to use different */
/* protocols and such, we are passed the name of the remote host and */
/* must turn that into the test specific addressing information. */
-
+
complete_addrinfos(&remote_res,
&local_res,
remote_host,
@@ -8895,13 +8895,13 @@
if ( print_headers ) {
print_top_test_header("TCP Connect/Request/Response TEST",local_res,remote_res);
}
-
+
/* initialize a few counters */
-
+
nummessages = 0;
bytes_xferd = 0.0;
times_up = 0;
-
+
/* set-up the data buffers with the requested alignment and offset */
if (send_width == 0) send_width = 1;
if (recv_width == 0) recv_width = 1;
@@ -8920,20 +8920,20 @@
if (debug) {
fprintf(where,"send_tcp_conn_rr: send_socket obtained...\n");
}
-
+
/* If the user has requested cpu utilization measurements, we must */
/* calibrate the cpu(s). We will perform this task within the tests */
/* themselves. If the user has specified the cpu rate, then */
/* calibrate_local_cpu will return rather quickly as it will have */
/* nothing to do. If local_cpu_rate is zero, then we will go through */
/* all the "normal" calibration stuff and return the rate back.*/
-
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
if (!no_control) {
-
+
/* Tell the remote end to do a listen. The server alters the
socket paramters on the other side at this point, hence the
reason for all the values being passed in the setup message. If
@@ -8942,7 +8942,7 @@
beyond the system's default should be used. Alignment is the
exception, it will default to 8, which will be no alignment
alterations. */
-
+
netperf_request.content.request_type = DO_TCP_CRR;
tcp_conn_rr_request->recv_buf_size = rsr_size_req;
tcp_conn_rr_request->send_buf_size = rss_size_req;
@@ -8965,13 +8965,13 @@
}
tcp_conn_rr_request->port = atoi(remote_data_port);
tcp_conn_rr_request->ipfamily = af_to_nf(remote_res->ai_family);
-
+
if (debug > 1) {
fprintf(where,"netperf: send_tcp_conn_rr: requesting TCP crr test\n");
}
-
+
send_request();
-
+
/* The response from the remote will contain all of the relevant
socket parameters for this test type. We will put them back
into the variables here so they can be displayed if desired.
@@ -8981,9 +8981,9 @@
value right after the connect returns. The remote will grab the
counter right after the accept call. This saves the hassle of
extra messages being sent for the TCP tests. */
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
rsr_size = tcp_conn_rr_response->recv_buf_size;
rss_size = tcp_conn_rr_response->send_buf_size;
@@ -8993,7 +8993,7 @@
/* make sure that port numbers are in network order */
set_port_number(remote_res,
(unsigned short)tcp_conn_rr_response->data_port_number);
-
+
if (debug) {
fprintf(where,"remote listen done.\n");
fprintf(where,"remote port is %u\n",get_port_number(remote_res));
@@ -9018,7 +9018,7 @@
/* client_port_max for our initial port number */
srand(getpid());
if (client_port_max - client_port_min) {
- myport = client_port_min +
+ myport = client_port_min +
(rand() % (client_port_max - client_port_min));
}
else {
@@ -9028,7 +9028,7 @@
myport--;
/* Set-up the test end conditions. For a request/response test, they */
/* can be either time or transaction based. */
-
+
if (test_time) {
/* The user wanted to end the test after a period of time. */
times_up = 0;
@@ -9040,12 +9040,12 @@
trans_remaining = test_bytes;
times_up = 1;
}
-
+
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
-
+
cpu_start(local_cpu_usage);
#ifdef WANT_DEMO
@@ -9053,7 +9053,7 @@
demo_first_timestamp();
}
#endif
-
+
/* We use an "OR" to control test execution. When the test is */
/* controlled by time, the byte count check will always return false. */
/* When the test is controlled by byte count, the time test will */
@@ -9104,7 +9104,7 @@
/* set up the data socket */
set_port_number(local_res, (unsigned short)myport);
send_socket = create_data_socket(local_res);
-
+
if (send_socket == INVALID_SOCKET) {
perror("netperf: send_tcp_conn_rr: tcp stream data socket");
exit(1);
@@ -9115,7 +9115,7 @@
create_data_socket routine. */
/* Connect up to the remote port on the data socket */
- if ((ret = connect(send_socket,
+ if ((ret = connect(send_socket,
remote_res->ai_addr,
remote_res->ai_addrlen)) == INVALID_SOCKET){
if (SOCKET_EINTR(ret))
@@ -9218,7 +9218,7 @@
ifdef VMWARE_UW. raj 2008-07-25 */
if (sp_bytes_recvd < 0 && errno == ECONNRESET) {
rsp_bytes_recvd = 0;
- }
+ }
#endif /* VMWARE_UW */
if (rsp_bytes_recvd == 0) {
@@ -9237,11 +9237,11 @@
demo_rr_interval(1);
#endif
- nummessages++;
+ nummessages++;
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug > 3) {
fprintf(where,
"Transaction %d completed on local port %d\n",
@@ -9264,21 +9264,21 @@
perror("send_tcp_conn_rr: data recv error");
exit(1);
}
-
+
}
-
+
/* this call will always give us the elapsed time for the test, and */
/* will also store-away the necessaries for cpu utilization */
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being measured? */
/* how long did we really run? */
-
+
if (!no_control) {
/* Get the statistics from the remote end. The remote will have
calculated service demand and all those interesting things. If
it wasn't supposed to care, it will return obvious values. */
-
+
recv_response();
if (!netperf_response.content.serv_errno) {
if (debug)
@@ -9291,7 +9291,7 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
}
@@ -9306,11 +9306,11 @@
/* send_size, so we really didn't send what he asked for ;-) We use */
/* Kbytes/s as the units of thruput for a TCP stream test, where K = */
/* 1024. A future enhancement *might* be to choose from a couple of */
- /* unit selections. */
-
+ /* unit selections. */
+
bytes_xferd = (req_size * nummessages) + (rsp_size * nummessages);
thruput = calc_thruput(bytes_xferd);
-
+
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu */
/* utilization for the system(s) */
@@ -9338,7 +9338,7 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
if (remote_cpu_usage) {
if (remote_cpu_rate == 0.0) {
fprintf(where,
@@ -9360,7 +9360,7 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
-
+
/* We are now ready to print all the information. If the user */
/* has specified zero-level verbosity, we will just print the */
/* local service demand, or the remote service demand. If the */
@@ -9369,7 +9369,7 @@
/* of greater than 1, we will display a veritable plethora of */
/* background information from outside of this block as it it */
/* not cpu_measurement specific... */
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -9392,7 +9392,7 @@
local_cpu_method,
remote_cpu_method);
}
-
+
fprintf(where,
cpu_fmt_1_line_1, /* the format string */
lss_size, /* local sendbuf size */
@@ -9438,23 +9438,23 @@
tput_fmt_1_line_2,
rss_size, /* remote recvbuf size */
rsr_size);
-
+
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
if (verbosity > 1) {
/* The user wanted to know it all, so we will give it to him. */
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
fprintf(where,
ksink_fmt,
local_send_align,
@@ -9469,14 +9469,14 @@
#endif /* WANT_HISTOGRAM */
}
-
+
}
#endif /* WANT_MIGRATION */
void
recv_tcp_conn_rr()
{
-
+
char *message;
struct addrinfo *local_res;
char local_name[BUFSIZ];
@@ -9495,23 +9495,23 @@
int request_bytes_remaining;
int timed_out = 0;
float elapsed_time;
-
+
struct tcp_conn_rr_request_struct *tcp_conn_rr_request;
struct tcp_conn_rr_response_struct *tcp_conn_rr_response;
struct tcp_conn_rr_results_struct *tcp_conn_rr_results;
-
- tcp_conn_rr_request =
+
+ tcp_conn_rr_request =
(struct tcp_conn_rr_request_struct *)netperf_request.content.test_specific_data;
- tcp_conn_rr_response =
+ tcp_conn_rr_response =
(struct tcp_conn_rr_response_struct *)netperf_response.content.test_specific_data;
- tcp_conn_rr_results =
+ tcp_conn_rr_results =
(struct tcp_conn_rr_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_tcp_conn_rr: entered...\n");
fflush(where);
}
-
+
/* We want to set-up the listen socket with all the desired */
/* parameters and then let the initiator know that all is ready. If */
/* socket size defaults are to be used, then the initiator will have */
@@ -9519,19 +9519,19 @@
/* send-back what they are. If that information cannot be determined, */
/* then we send-back -1's for the sizes. If things go wrong for any */
/* reason, we will drop back ten yards and punt. */
-
+
/* If anything goes wrong, we want the remote to know about it. It */
/* would be best if the error that the remote reports to the user is */
/* the actual error we encountered, rather than some bogus unexpected */
/* response type message. */
-
+
if (debug) {
fprintf(where,"recv_tcp_conn_rr: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = TCP_CRR_RESPONSE;
-
+
if (debug) {
fprintf(where,"recv_tcp_conn_rr: the response type is set...\n");
fflush(where);
@@ -9543,10 +9543,10 @@
printf("malloc(%d) failed!\n", DATABUFFERLEN);
exit(1);
}
-
+
/* We now alter the message_ptr variables to be at the desired */
/* alignments with the desired offsets. */
-
+
if (debug) {
fprintf(where,
"recv_tcp_conn_rr: requested recv alignment of %d offset %d\n",
@@ -9560,16 +9560,16 @@
}
recv_message_ptr = ALIGN_BUFFER(message, tcp_conn_rr_request->recv_alignment, tcp_conn_rr_request->recv_offset);
-
+
send_message_ptr = ALIGN_BUFFER(message, tcp_conn_rr_request->send_alignment, tcp_conn_rr_request->send_offset);
-
+
if (debug) {
fprintf(where,"recv_tcp_conn_rr: receive alignment and offset set...\n");
fflush(where);
}
-
+
/* Grab a socket to listen on, and then listen on it. */
-
+
if (debug) {
fprintf(where,"recv_tcp_conn_rr: grabbing a socket...\n");
fflush(where);
@@ -9584,7 +9584,7 @@
loc_nodelay = tcp_conn_rr_request->no_delay;
loc_rcvavoid = tcp_conn_rr_request->so_rcvavoid;
loc_sndavoid = tcp_conn_rr_request->so_sndavoid;
-
+
set_hostname_and_port(local_name,
port_buffer,
nf_to_af(tcp_conn_rr_request->ipfamily),
@@ -9599,7 +9599,7 @@
0);
s_listen = create_data_socket(local_res);
-
+
if (s_listen == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
@@ -9629,7 +9629,7 @@
}
exit(1);
}
-
+
/* now get the port number assigned by the system */
addrlen = sizeof(myaddr_in);
if (getsockname(s_listen,
@@ -9644,12 +9644,12 @@
}
exit(1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is */
/* returned to the sender also implicitly telling the sender that the */
/* socket buffer sizing has been done. */
-
- tcp_conn_rr_response->data_port_number =
+
+ tcp_conn_rr_response->data_port_number =
(int) ntohs(((struct sockaddr_in *)&myaddr_in)->sin_port);
if (debug) {
fprintf(where,"telling the remote to call me at %d\n",
@@ -9657,22 +9657,22 @@
fflush(where);
}
netperf_response.content.serv_errno = 0;
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a 0.0 to */
/* the initiator. */
-
+
tcp_conn_rr_response->cpu_rate = (float)0.0; /* assume no cpu */
if (tcp_conn_rr_request->measure_cpu) {
tcp_conn_rr_response->measure_cpu = 1;
- tcp_conn_rr_response->cpu_rate =
+ tcp_conn_rr_response->cpu_rate =
calibrate_local_cpu(tcp_conn_rr_request->cpu_rate);
}
-
-
+
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
tcp_conn_rr_response->send_buf_size = lss_size;
@@ -9682,17 +9682,17 @@
tcp_conn_rr_response->so_sndavoid = loc_sndavoid;
send_response();
-
+
addrlen = sizeof(peeraddr_in);
-
+
/* Now it's time to start receiving data on the connection. We will */
/* first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(tcp_conn_rr_request->measure_cpu);
-
+
/* The loop will exit when the sender does a shutdown, which will */
/* return a length of zero */
-
+
if (tcp_conn_rr_request->test_length > 0) {
times_up = 0;
trans_remaining = 0;
@@ -9702,14 +9702,14 @@
times_up = 1;
trans_remaining = tcp_conn_rr_request->test_length * -1;
}
-
+
trans_received = 0;
while ((!times_up) || (trans_remaining > 0)) {
/* accept a connection from the remote */
#ifdef WIN32
- /* The test timer will probably fire during this accept,
+ /* The test timer will probably fire during this accept,
so to make the start_timer above work we have to move
it to close s_listen while we are blocked on accept. */
win_kludge_socket = s_listen;
@@ -9725,7 +9725,7 @@
fprintf(where,"recv_tcp_conn_rr: accept: errno = %d\n",errno);
fflush(where);
close(s_listen);
-
+
exit(1);
}
@@ -9733,7 +9733,7 @@
fprintf(where,"recv_tcp_conn_rr: accepted data connection.\n");
fflush(where);
}
-
+
#ifdef WIN32
/* this is used so the timer thread can close the socket out from */
/* under us, which to date is the easiest/cleanest/least */
@@ -9748,14 +9748,14 @@
/* this is for those systems which *INCORRECTLY* fail to pass */
/* attributes across an accept() call. Including this goes against */
/* my better judgement :( raj 11/95 */
-
+
kludge_socket_options(s_data);
#endif /* KLUDGE_SOCKET_OPTIONS */
-
+
temp_message_ptr = recv_message_ptr;
request_bytes_remaining = tcp_conn_rr_request->request_size;
-
+
/* receive the request from the other side */
while (!times_up && (request_bytes_remaining > 0)) {
if((request_bytes_recvd=recv(s_data,
@@ -9778,21 +9778,21 @@
}
else {
/* for some reason the remote closed the connection on
- * us and that is unexpected so we should just close the
+ * us and that is unexpected so we should just close the
* socket and move-on. for that we will use an evil goto
* neener neener raj 20090622 */
goto bail;
}
}
-
+
if (timed_out) {
/* we hit the end of the test based on time - lets */
/* bail out of here now... */
fprintf(where,"yo5\n");
- fflush(where);
+ fflush(where);
break;
}
-
+
/* Now, send the response to the remote */
if((bytes_sent=send(s_data,
send_message_ptr,
@@ -9802,19 +9802,19 @@
/* the test timer has popped */
timed_out = 1;
fprintf(where,"yo6\n");
- fflush(where);
+ fflush(where);
break;
}
netperf_response.content.serv_errno = 99;
send_response();
exit(1);
}
-
+
trans_received++;
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug) {
fprintf(where,
"recv_tcp_conn_rr: Transaction %d complete\n",
@@ -9842,13 +9842,13 @@
#endif /* TCP_CRR_SHUTDOWN */
}
-
-
+
+
/* The loop now exits due to timeout or transaction count being */
/* reached */
-
+
cpu_stop(tcp_conn_rr_request->measure_cpu,&elapsed_time);
-
+
if (timed_out) {
/* we ended the test by time, which was at least 2 seconds */
/* longer than we wanted to run. so, we want to subtract */
@@ -9856,31 +9856,31 @@
elapsed_time -= PAD_TIME;
}
/* send the results to the sender */
-
+
if (debug) {
fprintf(where,
"recv_tcp_conn_rr: got %d transactions\n",
trans_received);
fflush(where);
}
-
- tcp_conn_rr_results->bytes_received = (trans_received *
- (tcp_conn_rr_request->request_size +
+
+ tcp_conn_rr_results->bytes_received = (trans_received *
+ (tcp_conn_rr_request->request_size +
tcp_conn_rr_request->response_size));
tcp_conn_rr_results->trans_received = trans_received;
tcp_conn_rr_results->elapsed_time = elapsed_time;
if (tcp_conn_rr_request->measure_cpu) {
tcp_conn_rr_results->cpu_util = calc_cpu_util(elapsed_time);
}
-
+
if (debug) {
fprintf(where,
"recv_tcp_conn_rr: test complete, sending results.\n");
fflush(where);
}
-
+
send_response();
-
+
}
@@ -9893,50 +9893,50 @@
/* it will also look (can look) much like the communication pattern */
/* of http for www access. */
-int
+int
send_tcp_tran_rr(char remote_host[])
{
-
+
char *tput_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans.\n\
Send Recv Size Size Time Rate \n\
bytes Bytes bytes bytes secs. per sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f\n";
-
+
char *tput_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %7.2f \n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *cpu_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem\n\
Send Recv Size Size Time Rate local remote local remote\n\
bytes bytes bytes bytes secs. per sec %% %% us/Tr us/Tr\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f\n";
-
+
char *cpu_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f\n";
-
+
char *cpu_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *ksink_fmt = "\n\
Alignment Offset\n\
Local Remote Local Remote\n\
Send Recv Send Recv\n\
%5d %5d %5d %5d\n";
-
-
+
+
int one = 1;
int timed_out = 0;
float elapsed_time;
-
+
int len;
struct ring_elt *send_ring;
struct ring_elt *recv_ring;
@@ -9948,13 +9948,13 @@
int sock_opt_len = sizeof(int);
int rsp_bytes_left;
int rsp_bytes_recvd;
-
+
float local_cpu_utilization;
float local_service_demand;
float remote_cpu_utilization;
float remote_service_demand;
double thruput;
-
+
struct hostent *hp;
struct sockaddr_in server;
struct sockaddr_in *myaddr;
@@ -9964,15 +9964,15 @@
struct tcp_tran_rr_request_struct *tcp_tran_rr_request;
struct tcp_tran_rr_response_struct *tcp_tran_rr_response;
struct tcp_tran_rr_results_struct *tcp_tran_rr_result;
-
- tcp_tran_rr_request =
+
+ tcp_tran_rr_request =
(struct tcp_tran_rr_request_struct *)netperf_request.content.test_specific_data;
- tcp_tran_rr_response =
+ tcp_tran_rr_response =
(struct tcp_tran_rr_response_struct *)netperf_response.content.test_specific_data;
tcp_tran_rr_result =
(struct tcp_tran_rr_results_struct *)netperf_response.content.test_specific_data;
-
-
+
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
@@ -9983,7 +9983,7 @@
/* control socket, and since we want to be able to use different */
/* protocols and such, we are passed the name of the remote host and */
/* must turn that into the test specific addressing information. */
-
+
myaddr = (struct sockaddr_storage *)malloc(sizeof(struct sockaddr_storage));
if (myaddr == NULL) {
printf("malloc(%d) failed!\n", sizeof(struct sockaddr_storage));
@@ -10006,13 +10006,13 @@
if ( print_headers ) {
print_top_test_header("TCP Transactional/Request/Response TEST",local_res,remote_res);
}
-
+
/* initialize a few counters */
-
+
nummessages = 0;
bytes_xferd = 0.0;
times_up = 0;
-
+
/* set-up the data buffers with the requested alignment and offset */
if (send_width == 0) send_width = 1;
if (recv_width == 0) recv_width = 1;
@@ -10031,18 +10031,18 @@
if (debug) {
fprintf(where,"send_tcp_tran_rr: send_socket obtained...\n");
}
-
+
/* If the user has requested cpu utilization measurements, we must */
/* calibrate the cpu(s). We will perform this task within the tests */
/* themselves. If the user has specified the cpu rate, then */
/* calibrate_local_cpu will return rather quickly as it will have */
/* nothing to do. If local_cpu_rate is zero, then we will go through */
/* all the "normal" calibration stuff and return the rate back.*/
-
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
-
+
/* Tell the remote end to do a listen. The server alters the socket */
/* paramters on the other side at this point, hence the reason for */
/* all the values being passed in the setup message. If the user did */
@@ -10050,7 +10050,7 @@
/* will indicate to the remote that no changes beyond the system's */
/* default should be used. Alignment is the exception, it will */
/* default to 8, which will be no alignment alterations. */
-
+
netperf_request.content.request_type = DO_TCP_TRR;
tcp_tran_rr_request->recv_buf_size = rsr_size_req;
tcp_tran_rr_request->send_buf_size = rss_size_req;
@@ -10077,9 +10077,9 @@
if (debug > 1) {
fprintf(where,"netperf: send_tcp_tran_rr: requesting TCP_TRR test\n");
}
-
+
send_request();
-
+
/* The response from the remote will contain all of the relevant */
/* socket parameters for this test type. We will put them back into */
/* the variables here so they can be displayed if desired. The */
@@ -10089,9 +10089,9 @@
/* after the connect returns. The remote will grab the counter right */
/* after the accept call. This saves the hassle of extra messages */
/* being sent for the TCP tests. */
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
rsr_size = tcp_tran_rr_response->recv_buf_size;
rss_size = tcp_tran_rr_response->send_buf_size;
@@ -10122,7 +10122,7 @@
/* same, then just set to _min */
if (client_port_max - client_port_min) {
srand(getpid());
- myport = client_port_min +
+ myport = client_port_min +
(rand() % (client_port_max - client_port_min));
}
else {
@@ -10132,10 +10132,10 @@
/* there will be a ++ before the first call to bind, so subtract one */
myport--;
myaddr->sin_port = htons((unsigned short)myport);
-
+
/* Set-up the test end conditions. For a request/response test, they */
/* can be either time or transaction based. */
-
+
if (test_time) {
/* The user wanted to end the test after a period of time. */
times_up = 0;
@@ -10147,13 +10147,13 @@
trans_remaining = test_bytes;
times_up = 1;
}
-
+
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
-
+
cpu_start(local_cpu_usage);
-
+
/* We use an "OR" to control test execution. When the test is */
/* controlled by time, the byte count check will always return false. */
/* When the test is controlled by byte count, the time test will */
@@ -10179,7 +10179,7 @@
/* all depends on "reality of programming." keeping it this way is */
/* a bit more conservative I imagine - raj 3/95 */
send_socket = create_data_socket(local_res);
-
+
if (send_socket == INVALID_SOCKET) {
perror("netperf: send_tcp_tran_rr: tcp stream data socket");
exit(1);
@@ -10257,7 +10257,7 @@
if((len=sendto(send_socket,
send_ring->buffer_ptr,
req_size,
- MSG_EOF,
+ MSG_EOF,
(struct sockaddr *)&server,
sizeof(server))) != req_size) {
if (SOCKET_EINTR(len))
@@ -10291,7 +10291,7 @@
}
rsp_bytes_left -= rsp_bytes_recvd;
temp_message_ptr += rsp_bytes_recvd;
- }
+ }
recv_ring = recv_ring->next;
if (timed_out) {
@@ -10309,11 +10309,11 @@
}
#endif /* WANT_HISTOGRAM */
- nummessages++;
+ nummessages++;
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug > 3) {
fprintf(where,
"Transaction %d completed on local port %d\n",
@@ -10324,17 +10324,17 @@
}
-
+
/* this call will always give us the elapsed time for the test, and */
/* will also store-away the necessaries for cpu utilization */
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being measured? */
/* how long did we really run? */
-
+
/* Get the statistics from the remote end. The remote will have */
/* calculated service demand and all those interesting things. If it */
/* wasn't supposed to care, it will return obvious values. */
-
+
recv_response();
if (!netperf_response.content.serv_errno) {
if (debug)
@@ -10349,7 +10349,7 @@
fflush(where);
exit(1);
}
-
+
/* We now calculate what our thruput was for the test. In the future, */
/* we may want to include a calculation of the thruput measured by */
/* the remote, but it should be the case that for a TCP stream test, */
@@ -10360,11 +10360,11 @@
/* send_size, so we really didn't send what he asked for ;-) We use */
/* Kbytes/s as the units of thruput for a TCP stream test, where K = */
/* 1024. A future enhancement *might* be to choose from a couple of */
- /* unit selections. */
-
+ /* unit selections. */
+
bytes_xferd = (req_size * nummessages) + (rsp_size * nummessages);
thruput = calc_thruput(bytes_xferd);
-
+
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu */
/* utilization for the system(s) */
@@ -10390,7 +10390,7 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
if (remote_cpu_usage) {
if (remote_cpu_rate == 0.0) {
fprintf(where,"DANGER DANGER DANGER DANGER DANGER DANGER DANGER!\n");
@@ -10410,7 +10410,7 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
-
+
/* We are now ready to print all the information. If the user */
/* has specified zero-level verbosity, we will just print the */
/* local service demand, or the remote service demand. If the */
@@ -10419,7 +10419,7 @@
/* of greater than 1, we will display a veritable plethora of */
/* background information from outside of this block as it it */
/* not cpu_measurement specific... */
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -10442,7 +10442,7 @@
local_cpu_method,
remote_cpu_method);
}
-
+
fprintf(where,
cpu_fmt_1_line_1, /* the format string */
lss_size, /* local sendbuf size */
@@ -10488,23 +10488,23 @@
tput_fmt_1_line_2,
rss_size, /* remote recvbuf size */
rsr_size);
-
+
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
if (verbosity > 1) {
/* The user wanted to know it all, so we will give it to him. */
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
fprintf(where,
ksink_fmt,
local_send_align,
@@ -10519,14 +10519,14 @@
#endif /* WANT_HISTOGRAM */
}
-
+
}
-int
+int
recv_tcp_tran_rr()
{
-
+
char *message;
struct sockaddr_in myaddr_in,
peeraddr_in;
@@ -10544,23 +10544,23 @@
int request_bytes_remaining;
int timed_out = 0;
float elapsed_time;
-
+
struct tcp_tran_rr_request_struct *tcp_tran_rr_request;
struct tcp_tran_rr_response_struct *tcp_tran_rr_response;
struct tcp_tran_rr_results_struct *tcp_tran_rr_results;
-
- tcp_tran_rr_request =
+
+ tcp_tran_rr_request =
(struct tcp_tran_rr_request_struct *)netperf_request.content.test_specific_data;
- tcp_tran_rr_response =
+ tcp_tran_rr_response =
(struct tcp_tran_rr_response_struct *)netperf_response.content.test_specific_data;
- tcp_tran_rr_results =
+ tcp_tran_rr_results =
(struct tcp_tran_rr_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_tcp_tran_rr: entered...\n");
fflush(where);
}
-
+
/* We want to set-up the listen socket with all the desired */
/* parameters and then let the initiator know that all is ready. If */
/* socket size defaults are to be used, then the initiator will have */
@@ -10568,19 +10568,19 @@
/* send-back what they are. If that information cannot be determined, */
/* then we send-back -1's for the sizes. If things go wrong for any */
/* reason, we will drop back ten yards and punt. */
-
+
/* If anything goes wrong, we want the remote to know about it. It */
/* would be best if the error that the remote reports to the user is */
/* the actual error we encountered, rather than some bogus unexpected */
/* response type message. */
-
+
if (debug) {
fprintf(where,"recv_tcp_tran_rr: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = TCP_TRR_RESPONSE;
-
+
if (debug) {
fprintf(where,"recv_tcp_tran_rr: the response type is set...\n");
fflush(where);
@@ -10592,10 +10592,10 @@
printf("malloc(%d) failed!\n", DATABUFFERLEN);
exit(1);
}
-
+
/* We now alter the message_ptr variables to be at the desired */
/* alignments with the desired offsets. */
-
+
if (debug) {
fprintf(where,
"recv_tcp_tran_rr: requested recv alignment of %d offset %d\n",
@@ -10609,27 +10609,27 @@
}
recv_message_ptr = ALIGN_BUFFER(message, tcp_tran_rr_request->recv_alignment, tcp_tran_rr_request->recv_offset);
-
+
send_message_ptr = ALIGN_BUFFER(message, tcp_tran_rr_request->send_alignment, tcp_tran_rr_request->send_offset);
-
+
if (debug) {
fprintf(where,"recv_tcp_tran_rr: receive alignment and offset set...\n");
fflush(where);
}
-
+
/* Let's clear-out our sockaddr for the sake of cleanlines. Then we */
/* can put in OUR values !-) At some point, we may want to nail this */
/* socket to a particular network-level address, but for now, */
/* INADDR_ANY should be just fine. */
-
+
bzero((char *)&myaddr_in,
sizeof(myaddr_in));
myaddr_in.sin_family = AF_INET;
myaddr_in.sin_addr.s_addr = INADDR_ANY;
myaddr_in.sin_port = htons((unsigned short)tcp_tran_rr_request->port);
-
+
/* Grab a socket to listen on, and then listen on it. */
-
+
if (debug) {
fprintf(where,"recv_tcp_tran_rr: grabbing a socket...\n");
fflush(where);
@@ -10644,7 +10644,7 @@
loc_nodelay = tcp_tran_rr_request->no_delay;
loc_rcvavoid = tcp_tran_rr_request->so_rcvavoid;
loc_sndavoid = tcp_tran_rr_request->so_sndavoid;
-
+
set_hostname_and_port(local_name,
port_buffer,
nf_to_af(tcp_tran_rr_request->ipfamily),
@@ -10659,7 +10659,7 @@
0);
s_listen = create_data_socket(local_res);
-
+
if (s_listen == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
@@ -10683,7 +10683,7 @@
/* nail this socket to a specific IP address in a multi-homed, */
/* multi-connection situation, but for now, we'll ignore the issue */
/* and concentrate on single connection testing. */
-
+
if (bind(s_listen,
(struct sockaddr *)&myaddr_in,
sizeof(myaddr_in)) == SOCKET_ERROR) {
@@ -10701,7 +10701,7 @@
/* this might want to be a parm to the test raj 3/95 */
if (setsockopt(s_listen,
IPPROTO_TCP,
- TCP_NOPUSH,
+ TCP_NOPUSH,
(const char *)&NoPush,
sizeof(int)) == SOCKET_ERROR) {
fprintf(where,
@@ -10724,7 +10724,7 @@
}
exit(1);
}
-
+
/* now get the port number assigned by the system */
addrlen = sizeof(myaddr_in);
if (getsockname(s_listen,
@@ -10739,11 +10739,11 @@
}
exit(1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is */
/* returned to the sender also implicitly telling the sender that the */
/* socket buffer sizing has been done. */
-
+
tcp_tran_rr_response->data_port_number = (int) ntohs(myaddr_in.sin_port);
if (debug) {
fprintf(where,"telling the remote to call me at %d\n",
@@ -10751,22 +10751,22 @@
fflush(where);
}
netperf_response.content.serv_errno = 0;
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a 0.0 to */
/* the initiator. */
-
+
tcp_tran_rr_response->cpu_rate = 0.0; /* assume no cpu */
if (tcp_tran_rr_request->measure_cpu) {
tcp_tran_rr_response->measure_cpu = 1;
- tcp_tran_rr_response->cpu_rate =
+ tcp_tran_rr_response->cpu_rate =
calibrate_local_cpu(tcp_tran_rr_request->cpu_rate);
}
-
-
+
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
tcp_tran_rr_response->send_buf_size = lss_size;
@@ -10776,17 +10776,17 @@
tcp_tran_rr_response->so_sndavoid = loc_sndavoid;
send_response();
-
+
addrlen = sizeof(peeraddr_in);
-
+
/* Now it's time to start receiving data on the connection. We will */
/* first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(tcp_tran_rr_request->measure_cpu);
-
+
/* The loop will exit when the sender does a shutdown, which will */
/* return a length of zero */
-
+
if (tcp_tran_rr_request->test_length > 0) {
times_up = 0;
trans_remaining = 0;
@@ -10796,7 +10796,7 @@
times_up = 1;
trans_remaining = tcp_tran_rr_request->test_length * -1;
}
-
+
trans_received = 0;
while ((!times_up) || (trans_remaining > 0)) {
@@ -10813,15 +10813,15 @@
fprintf(where,"recv_tcp_tran_rr: accept: errno = %d\n",errno);
fflush(where);
close(s_listen);
-
+
exit(1);
}
-
+
if (debug) {
fprintf(where,"recv_tcp_tran_rr: accepted data connection.\n");
fflush(where);
}
-
+
#ifdef WIN32
/* this is used so the timer thread can close the socket out from */
/* under us, which to date is the easiest/cleanest/least */
@@ -10840,10 +10840,10 @@
kludge_socket_options(s_data);
#endif /* KLUDGE_SOCKET_OPTIONS */
-
+
temp_message_ptr = recv_message_ptr;
request_bytes_remaining = tcp_tran_rr_request->request_size;
-
+
/* receive the request from the other side. we can just receive */
/* until we get zero bytes, but that would be a slight structure */
/* change in the code, with minimal perfomance effects. If */
@@ -10870,15 +10870,15 @@
temp_message_ptr += request_bytes_recvd;
}
}
-
+
if (timed_out) {
/* we hit the end of the test based on time - lets */
/* bail out of here now... */
fprintf(where,"yo5\n");
- fflush(where);
+ fflush(where);
break;
}
-
+
/* Now, send the response to the remote we can use sendto here to */
/* help remind people that this is an rfc 1644 style of test */
if((bytes_sent=sendto(s_data,
@@ -10891,19 +10891,19 @@
/* the test timer has popped */
timed_out = 1;
fprintf(where,"yo6\n");
- fflush(where);
+ fflush(where);
break;
}
netperf_response.content.serv_errno = 99;
send_response();
exit(1);
}
-
+
trans_received++;
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug) {
fprintf(where,
"recv_tcp_tran_rr: Transaction %d complete\n",
@@ -10917,13 +10917,13 @@
close(s_data);
}
-
-
+
+
/* The loop now exits due to timeout or transaction count being */
/* reached */
-
+
cpu_stop(tcp_tran_rr_request->measure_cpu,&elapsed_time);
-
+
if (timed_out) {
/* we ended the test by time, which was at least 2 seconds */
/* longer than we wanted to run. so, we want to subtract */
@@ -10931,31 +10931,31 @@
elapsed_time -= PAD_TIME;
}
/* send the results to the sender */
-
+
if (debug) {
fprintf(where,
"recv_tcp_tran_rr: got %d transactions\n",
trans_received);
fflush(where);
}
-
- tcp_tran_rr_results->bytes_received = (trans_received *
- (tcp_tran_rr_request->request_size +
+
+ tcp_tran_rr_results->bytes_received = (trans_received *
+ (tcp_tran_rr_request->request_size +
tcp_tran_rr_request->response_size));
tcp_tran_rr_results->trans_received = trans_received;
tcp_tran_rr_results->elapsed_time = elapsed_time;
if (tcp_tran_rr_request->measure_cpu) {
tcp_tran_rr_results->cpu_util = calc_cpu_util(elapsed_time);
}
-
+
if (debug) {
fprintf(where,
"recv_tcp_tran_rr: test complete, sending results.\n");
fflush(where);
}
-
+
send_response();
-
+
}
#endif /* DO_1644 */
@@ -10966,46 +10966,46 @@
void
send_tcp_nbrr(char remote_host[])
{
-
+
char *tput_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans.\n\
Send Recv Size Size Time Rate \n\
bytes Bytes bytes bytes secs. per sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f\n";
-
+
char *tput_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %7.2f \n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *cpu_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem\n\
Send Recv Size Size Time Rate local remote local remote\n\
bytes bytes bytes bytes secs. per sec %% %c %% %c us/Tr us/Tr\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f %c\n";
-
+
char *cpu_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f\n";
-
+
char *cpu_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *ksink_fmt = "\
Alignment Offset\n\
Local Remote Local Remote\n\
Send Recv Send Recv\n\
%5d %5d %5d %5d\n";
-
-
+
+
int timed_out = 0;
float elapsed_time;
-
+
int len;
char *temp_message_ptr;
int nummessages;
@@ -11015,20 +11015,20 @@
struct ring_elt *send_ring;
struct ring_elt *recv_ring;
-
+
int rsp_bytes_left;
int rsp_bytes_recvd;
-
+
float local_cpu_utilization;
float local_service_demand;
float remote_cpu_utilization;
float remote_service_demand;
double thruput;
-
+
struct hostent *hp;
struct sockaddr_storage server;
unsigned int addr;
-
+
struct tcp_rr_request_struct *tcp_rr_request;
struct tcp_rr_response_struct *tcp_rr_response;
struct tcp_rr_results_struct *tcp_rr_result;
@@ -11036,13 +11036,13 @@
struct addrinfo *remote_res;
struct addrinfo *local_res;
- tcp_rr_request =
+ tcp_rr_request =
(struct tcp_rr_request_struct *)netperf_request.content.test_specific_data;
tcp_rr_response=
(struct tcp_rr_response_struct *)netperf_response.content.test_specific_data;
tcp_rr_result =
(struct tcp_rr_results_struct *)netperf_response.content.test_specific_data;
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
@@ -11056,7 +11056,7 @@
bzero((char *)&server,
sizeof(server));
-
+
complete_addrinfos(&remote_res,
&local_res,
remote_host,
@@ -11067,9 +11067,9 @@
if ( print_headers ) {
print_top_test_header("TCP Non-Blocking REQUEST/RESPONSE TEST",local_res,remote_res);
}
-
+
/* initialize a few counters */
-
+
send_ring = NULL;
recv_ring = NULL;
confidence_iteration = 1;
@@ -11100,7 +11100,7 @@
if (send_width == 0) send_width = 1;
if (recv_width == 0) recv_width = 1;
-
+
if (send_ring == NULL) {
send_ring = allocate_buffer_ring(send_width,
req_size,
@@ -11114,30 +11114,30 @@
local_recv_align,
local_recv_offset);
}
-
+
/*set up the data socket */
send_socket = create_data_socket(local_res);
-
+
if (send_socket == INVALID_SOCKET){
perror("netperf: send_tcp_nbrr: tcp stream data socket");
exit(1);
}
-
+
if (debug) {
fprintf(where,"send_tcp_nbrr: send_socket obtained...\n");
}
-
+
/* If the user has requested cpu utilization measurements, we must */
/* calibrate the cpu(s). We will perform this task within the tests */
/* themselves. If the user has specified the cpu rate, then */
/* calibrate_local_cpu will return rather quickly as it will have */
/* nothing to do. If local_cpu_rate is zero, then we will go through */
/* all the "normal" calibration stuff and return the rate back.*/
-
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
-
+
/* Tell the remote end to do a listen. The server alters the socket */
/* paramters on the other side at this point, hence the reason for */
/* all the values being passed in the setup message. If the user did */
@@ -11145,7 +11145,7 @@
/* will indicate to the remote that no changes beyond the system's */
/* default should be used. Alignment is the exception, it will */
/* default to 8, which will be no alignment alterations. */
-
+
netperf_request.content.request_type = DO_TCP_NBRR;
tcp_rr_request->recv_buf_size = rsr_size_req;
tcp_rr_request->send_buf_size = rss_size_req;
@@ -11166,13 +11166,13 @@
else {
tcp_rr_request->test_length = test_trans * -1;
}
-
+
if (debug > 1) {
fprintf(where,"netperf: send_tcp_nbrr: requesting TCP rr test\n");
}
-
+
send_request();
-
+
/* The response from the remote will contain all of the relevant */
/* socket parameters for this test type. We will put them back into */
/* the variables here so they can be displayed if desired. The */
@@ -11182,9 +11182,9 @@
/* after the connect returns. The remote will grab the counter right*/
/* after the accept call. This saves the hassle of extra messages */
/* being sent for the TCP tests. */
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
if (debug)
fprintf(where,"remote listen done.\n");
@@ -11206,16 +11206,16 @@
fflush(where);
exit(1);
}
-
+
/*Connect up to the remote port on the data socket */
- if (connect(send_socket,
+ if (connect(send_socket,
remote_res->ai_addr,
remote_res->ai_addrlen) == INVALID_SOCKET){
perror("netperf: data socket connect failed");
-
+
exit(1);
}
-
+
/* now that we are connected, mark the socket as non-blocking */
if (!set_nonblock(send_socket)) {
perror("netperf: set_nonblock");
@@ -11237,10 +11237,10 @@
/* indicated a problem. I failed to see the value of the extra */
/* message after the accept on the remote. If it failed, we'll see it */
/* here. If it didn't, we might as well start pumping data. */
-
+
/* Set-up the test end conditions. For a request/response test, they */
/* can be either time or transaction based. */
-
+
if (test_time) {
/* The user wanted to end the test after a period of time. */
times_up = 0;
@@ -11252,17 +11252,17 @@
trans_remaining = test_bytes;
times_up = 1;
}
-
+
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
-
+
cpu_start(local_cpu_usage);
#ifdef WANT_INTERVALS
INTERVALS_INIT();
#endif /* WANT_INTERVALS */
-
+
/* We use an "OR" to control test execution. When the test is */
/* controlled by time, the byte count check will always return false. */
/* When the test is controlled by byte count, the time test will */
@@ -11275,7 +11275,7 @@
while ((!times_up) || (trans_remaining > 0)) {
/* send the request. we assume that if we use a blocking socket, */
/* the request will be sent at one shot. */
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
/* timestamp just before our call to send, and then again just */
@@ -11301,7 +11301,7 @@
exit(1);
}
send_ring = send_ring->next;
-
+
/* receive the response. since we are using non-blocking I/O, we */
/* will "spin" on the recvs */
rsp_bytes_left = rsp_size;
@@ -11330,30 +11330,30 @@
}
rsp_bytes_left -= rsp_bytes_recvd;
temp_message_ptr += rsp_bytes_recvd;
- }
+ }
recv_ring = recv_ring->next;
-
+
if (timed_out) {
/* we may have been in a nested while loop - we need */
/* another call to break. */
break;
}
-
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
HIST_timestamp(&time_two);
HIST_add(time_hist,delta_micro(&time_one,&time_two));
}
#endif /* WANT_HISTOGRAM */
-#ifdef WANT_INTERVALS
+#ifdef WANT_INTERVALS
INTERVALS_WAIT();
#endif /* WANT_INTERVALS */
-
- nummessages++;
+
+ nummessages++;
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug > 3) {
if ((nummessages % 100) == 0) {
fprintf(where,
@@ -11370,18 +11370,18 @@
/* they were being controlled by time. So, I have replaced this */
/* shutdown call with a call to close that can be found later in the */
/* procedure. */
-
+
/* this call will always give us the elapsed time for the test, and */
/* will also store-away the necessaries for cpu utilization */
-
+
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being */
/* measured? how long */
/* did we really run? */
-
+
/* Get the statistics from the remote end. The remote will have */
/* calculated service demand and all those interesting things. If it */
/* wasn't supposed to care, it will return obvious values. */
-
+
recv_response();
if (!netperf_response.content.serv_errno) {
if (debug)
@@ -11394,15 +11394,15 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
-
+
/* We now calculate what our thruput was for the test. */
-
+
bytes_xferd = (req_size * nummessages) + (rsp_size * nummessages);
thruput = nummessages/elapsed_time;
-
+
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu */
/* utilization for the system(s) */
@@ -11423,7 +11423,7 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
if (remote_cpu_usage) {
remote_cpu_utilization = tcp_rr_result->cpu_util;
/* since calc_service demand is doing ms/Kunit we will */
@@ -11438,7 +11438,7 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
-
+
}
else {
/* we were not measuring cpu, for the confidence stuff, we */
@@ -11452,7 +11452,7 @@
/* at this point, we want to calculate the confidence information. */
/* if debugging is on, calculate_confidence will print-out the */
/* parameters we pass it */
-
+
calculate_confidence(confidence_iteration,
elapsed_time,
thruput,
@@ -11460,8 +11460,8 @@
remote_cpu_utilization,
local_service_demand,
remote_service_demand);
-
-
+
+
confidence_iteration++;
/* we are now done with the socket, so close it */
@@ -11495,7 +11495,7 @@
if (local_cpu_usage || remote_cpu_usage) {
local_cpu_method = format_cpu_method(cpu_method);
remote_cpu_method = format_cpu_method(tcp_rr_result->cpu_method);
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -11541,7 +11541,7 @@
}
else {
/* The tester did not wish to measure service demand. */
-
+
switch (verbosity) {
case 0:
fprintf(where,
@@ -11566,17 +11566,17 @@
tput_fmt_1_line_2,
rss_size, /* remote recvbuf size */
rsr_size);
-
+
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
/* how to handle the verbose information in the presence of */
/* confidence intervals is yet to be determined... raj 11/94 */
if (verbosity > 1) {
@@ -11584,7 +11584,7 @@
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
fprintf(where,
ksink_fmt,
local_send_align,
@@ -11599,15 +11599,15 @@
#endif /* WANT_HISTOGRAM */
}
-
+
}
/* this routine implements the receive (netserver) side of a TCP_RR */
/* test */
-void
+void
recv_tcp_nbrr()
{
-
+
struct ring_elt *send_ring;
struct ring_elt *recv_ring;
@@ -11627,23 +11627,23 @@
struct addrinfo *local_res;
char local_name[BUFSIZ];
char port_buffer[PORTBUFSIZE];
-
+
struct tcp_rr_request_struct *tcp_rr_request;
struct tcp_rr_response_struct *tcp_rr_response;
struct tcp_rr_results_struct *tcp_rr_results;
-
- tcp_rr_request =
+
+ tcp_rr_request =
(struct tcp_rr_request_struct *)netperf_request.content.test_specific_data;
tcp_rr_response =
(struct tcp_rr_response_struct *)netperf_response.content.test_specific_data;
tcp_rr_results =
(struct tcp_rr_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_tcp_nbrr: entered...\n");
fflush(where);
}
-
+
/* We want to set-up the listen socket with all the desired */
/* parameters and then let the initiator know that all is ready. If */
/* socket size defaults are to be used, then the initiator will have */
@@ -11651,24 +11651,24 @@
/* send-back what they are. If that information cannot be determined, */
/* then we send-back -1's for the sizes. If things go wrong for any */
/* reason, we will drop back ten yards and punt. */
-
+
/* If anything goes wrong, we want the remote to know about it. It */
/* would be best if the error that the remote reports to the user is */
/* the actual error we encountered, rather than some bogus unexpected */
/* response type message. */
-
+
if (debug) {
fprintf(where,"recv_tcp_nbrr: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = TCP_RR_RESPONSE;
-
+
if (debug) {
fprintf(where,"recv_tcp_nbrr: the response type is set...\n");
fflush(where);
}
-
+
/* allocate the recv and send rings with the requested alignments */
/* and offsets. raj 7/94 */
if (debug) {
@@ -11695,20 +11695,20 @@
tcp_rr_request->recv_alignment,
tcp_rr_request->recv_offset);
-
+
/* Let's clear-out our sockaddr for the sake of cleanlines. Then we */
/* can put in OUR values !-) At some point, we may want to nail this */
/* socket to a particular network-level address, but for now, */
/* INADDR_ANY should be just fine. */
-
+
bzero((char *)&myaddr_in,
sizeof(myaddr_in));
myaddr_in.sin_family = AF_INET;
myaddr_in.sin_addr.s_addr = INADDR_ANY;
myaddr_in.sin_port = htons((unsigned short)tcp_rr_request->port);
-
+
/* Grab a socket to listen on, and then listen on it. */
-
+
if (debug) {
fprintf(where,"recv_tcp_nbrr: grabbing a socket...\n");
fflush(where);
@@ -11723,7 +11723,7 @@
loc_nodelay = tcp_rr_request->no_delay;
loc_rcvavoid = tcp_rr_request->so_rcvavoid;
loc_sndavoid = tcp_rr_request->so_sndavoid;
-
+
set_hostname_and_port(local_name,
port_buffer,
nf_to_af(tcp_rr_request->ipfamily),
@@ -11738,40 +11738,40 @@
0);
s_listen = create_data_socket(local_res);
-
+
if (s_listen == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
-
+
exit(1);
}
-
+
/* Let's get an address assigned to this socket so we can tell the */
/* initiator how to reach the data socket. There may be a desire to */
/* nail this socket to a specific IP address in a multi-homed, */
/* multi-connection situation, but for now, we'll ignore the issue */
/* and concentrate on single connection testing. */
-
+
if (bind(s_listen,
(struct sockaddr *)&myaddr_in,
sizeof(myaddr_in)) == SOCKET_ERROR) {
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
-
+
exit(1);
}
-
+
/* Now, let's set-up the socket to listen for connections */
if (listen(s_listen, 5) == SOCKET_ERROR) {
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
-
+
exit(1);
}
-
-
+
+
/* now get the port number assigned by the system */
addrlen = sizeof(myaddr_in);
if (getsockname(s_listen,
@@ -11779,23 +11779,23 @@
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
-
+
exit(1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is */
/* returned to the sender also implicitly telling the sender that the */
/* socket buffer sizing has been done. */
-
+
tcp_rr_response->data_port_number = (int) ntohs(myaddr_in.sin_port);
netperf_response.content.serv_errno = 0;
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a 0.0 to */
/* the initiator. */
-
+
tcp_rr_response->cpu_rate = 0.0; /* assume no cpu */
tcp_rr_response->measure_cpu = 0;
@@ -11803,8 +11803,8 @@
tcp_rr_response->measure_cpu = 1;
tcp_rr_response->cpu_rate = calibrate_local_cpu(tcp_rr_request->cpu_rate);
}
-
-
+
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
tcp_rr_response->send_buf_size = lss_size;
@@ -11814,9 +11814,9 @@
tcp_rr_response->so_sndavoid = loc_sndavoid;
tcp_rr_response->test_length = tcp_rr_request->test_length;
send_response();
-
+
addrlen = sizeof(peeraddr_in);
-
+
if ((s_data = accept(s_listen,
(struct sockaddr *)&peeraddr_in,
&addrlen)) == INVALID_SOCKET) {
@@ -11824,7 +11824,7 @@
close(s_listen);
exit(1);
}
-
+
if (debug) {
fprintf(where,"recv_tcp_nbrr: accept completes on the data connection.\n");
fflush(where);
@@ -11838,17 +11838,17 @@
kludge_socket_options(s_data);
#endif /* KLUDGE_SOCKET_OPTIONS */
-
+
/* now that we are connected, mark the socket as non-blocking */
if (!set_nonblock(s_data)) {
close(s_data);
exit(1);
}
-
+
/* Now it's time to start receiving data on the connection. We will */
/* first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(tcp_rr_request->measure_cpu);
#ifdef WIN32
@@ -11860,10 +11860,10 @@
/* and such would be appreciated raj 1/96 */
win_kludge_socket = s_data;
#endif /* WIN32 */
-
+
/* The loop will exit when the sender does a shutdown, which will */
/* return a length of zero */
-
+
if (tcp_rr_request->test_length > 0) {
times_up = 0;
trans_remaining = 0;
@@ -11875,7 +11875,7 @@
}
trans_received = 0;
-
+
while ((!times_up) || (trans_remaining > 0)) {
temp_message_ptr = recv_ring->buffer_ptr;
request_bytes_remaining = tcp_rr_request->request_size;
@@ -11918,10 +11918,10 @@
/* we hit the end of the test based on time - lets */
/* bail out of here now... */
fprintf(where,"yo5\n");
- fflush(where);
+ fflush(where);
break;
}
-
+
/* Now, send the response to the remote */
if((bytes_sent=send(s_data,
send_ring->buffer_ptr,
@@ -11931,14 +11931,14 @@
/* the test timer has popped */
timed_out = 1;
fprintf(where,"yo6\n");
- fflush(where);
+ fflush(where);
break;
}
netperf_response.content.serv_errno = 992;
send_response();
exit(1);
}
-
+
send_ring = send_ring->next;
trans_received++;
@@ -11946,13 +11946,13 @@
trans_remaining--;
}
}
-
-
+
+
/* The loop now exits due to timeout or transaction count being */
/* reached */
-
+
cpu_stop(tcp_rr_request->measure_cpu,&elapsed_time);
-
+
stop_timer();
if (timed_out) {
@@ -11963,16 +11963,16 @@
}
/* send the results to the sender */
-
+
if (debug) {
fprintf(where,
"recv_tcp_nbrr: got %d transactions\n",
trans_received);
fflush(where);
}
-
- tcp_rr_results->bytes_received = (trans_received *
- (tcp_rr_request->request_size +
+
+ tcp_rr_results->bytes_received = (trans_received *
+ (tcp_rr_request->request_size +
tcp_rr_request->response_size));
tcp_rr_results->trans_received = trans_received;
tcp_rr_results->elapsed_time = elapsed_time;
@@ -11981,18 +11981,18 @@
if (tcp_rr_request->measure_cpu) {
tcp_rr_results->cpu_util = calc_cpu_util(elapsed_time);
}
-
+
if (debug) {
fprintf(where,
"recv_tcp_nbrr: test complete, sending results.\n");
fflush(where);
}
-
+
/* we are done with the socket, free it */
close(s_data);
send_response();
-
+
}
#endif /* DO_NBRR */
@@ -12009,46 +12009,46 @@
void
send_tcp_cc(char remote_host[])
{
-
+
char *tput_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans.\n\
Send Recv Size Size Time Rate \n\
bytes Bytes bytes bytes secs. per sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f\n";
-
+
char *tput_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %7.2f \n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *cpu_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem\n\
Send Recv Size Size Time Rate local remote local remote\n\
bytes bytes bytes bytes secs. per sec %% %% us/Tr us/Tr\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f\n";
-
+
char *cpu_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f\n";
-
+
char *cpu_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *ksink_fmt = "\n\
Alignment Offset\n\
Local Remote Local Remote\n\
Send Recv Send Recv\n\
%5d %5d %5d %5d\n";
-
-
+
+
int timed_out = 0;
float elapsed_time;
-
+
char temp_message_ptr[1];
int nummessages;
SOCKET send_socket;
@@ -12056,13 +12056,13 @@
double bytes_xferd;
int rsp_bytes_left = 1;
int rsp_bytes_recvd;
-
+
float local_cpu_utilization;
float local_service_demand;
float remote_cpu_utilization;
float remote_service_demand;
double thruput;
-
+
struct addrinfo *local_res;
struct addrinfo *remote_res;
@@ -12072,15 +12072,15 @@
struct tcp_cc_request_struct *tcp_cc_request;
struct tcp_cc_response_struct *tcp_cc_response;
struct tcp_cc_results_struct *tcp_cc_result;
-
- tcp_cc_request =
+
+ tcp_cc_request =
(struct tcp_cc_request_struct *)netperf_request.content.test_specific_data;
- tcp_cc_response =
+ tcp_cc_response =
(struct tcp_cc_response_struct *)netperf_response.content.test_specific_data;
tcp_cc_result =
(struct tcp_cc_results_struct *)netperf_response.content.test_specific_data;
-
-
+
+
#ifdef WANT_HISTOGRAM
if (verbosity > 1) {
time_hist = HIST_new();
@@ -12091,7 +12091,7 @@
/* control socket, and since we want to be able to use different */
/* protocols and such, we are passed the name of the remote host and */
/* must turn that into the test specific addressing information. */
-
+
complete_addrinfos(&remote_res,
&local_res,
remote_host,
@@ -12102,31 +12102,31 @@
if ( print_headers ) {
print_top_test_header("TCP Connect/Close TEST",local_res,remote_res);
}
-
+
/* initialize a few counters */
-
+
nummessages = 0;
bytes_xferd = 0.0;
times_up = 0;
-
+
/* since there are no data buffers in this test, we need no send or */
/* recv rings */
if (debug) {
fprintf(where,"send_tcp_cc: send_socket obtained...\n");
}
-
+
/* If the user has requested cpu utilization measurements, we must */
/* calibrate the cpu(s). We will perform this task within the tests */
/* themselves. If the user has specified the cpu rate, then */
/* calibrate_local_cpu will return rather quickly as it will have */
/* nothing to do. If local_cpu_rate is zero, then we will go through */
/* all the "normal" calibration stuff and return the rate back.*/
-
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
-
+
/* Tell the remote end to do a listen. The server alters the socket */
/* paramters on the other side at this point, hence the reason for */
/* all the values being passed in the setup message. If the user did */
@@ -12134,7 +12134,7 @@
/* will indicate to the remote that no changes beyond the system's */
/* default should be used. Alignment is the exception, it will */
/* default to 8, which will be no alignment alterations. */
-
+
netperf_request.content.request_type = DO_TCP_CC;
tcp_cc_request->recv_buf_size = rsr_size_req;
tcp_cc_request->send_buf_size = rss_size_req;
@@ -12161,9 +12161,9 @@
if (debug > 1) {
fprintf(where,"netperf: send_tcp_cc: requesting TCP crr test\n");
}
-
+
send_request();
-
+
/* The response from the remote will contain all of the relevant */
/* socket parameters for this test type. We will put them back into */
/* the variables here so they can be displayed if desired. The */
@@ -12173,9 +12173,9 @@
/* after the connect returns. The remote will grab the counter right */
/* after the accept call. This saves the hassle of extra messages */
/* being sent for the TCP tests. */
-
+
recv_response();
-
+
if (!netperf_response.content.serv_errno) {
rsr_size = tcp_cc_response->recv_buf_size;
rss_size = tcp_cc_response->send_buf_size;
@@ -12204,12 +12204,12 @@
#ifdef WANT_DEMO
demo_rr_setup(100);
#endif
-
+
/* pick a nice random spot between client_port_min and */
/* client_port_max for our initial port number */
srand(getpid());
if (client_port_max - client_port_min) {
- myport = client_port_min +
+ myport = client_port_min +
(rand() % (client_port_max - client_port_min));
}
else {
@@ -12217,10 +12217,10 @@
}
/* there will be a ++ before the first call to bind, so subtract one */
myport--;
-
+
/* Set-up the test end conditions. For a request/response test, they */
/* can be either time or transaction based. */
-
+
if (test_time) {
/* The user wanted to end the test after a period of time. */
times_up = 0;
@@ -12232,11 +12232,11 @@
trans_remaining = test_bytes;
times_up = 1;
}
-
+
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
-
+
cpu_start(local_cpu_usage);
#ifdef WANT_DEMO
@@ -12314,7 +12314,7 @@
taken care of by create_data_socket(). raj 2005-02-08 */
/* Connect up to the remote port on the data socket */
- if ((ret = connect(send_socket,
+ if ((ret = connect(send_socket,
remote_res->ai_addr,
remote_res->ai_addrlen)) == INVALID_SOCKET){
if (SOCKET_EINTR(ret))
@@ -12355,11 +12355,11 @@
demo_rr_interval(1);
#endif
- nummessages++;
+ nummessages++;
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug > 3) {
fprintf(where,
"Transaction %d completed on local port %u\n",
@@ -12382,20 +12382,20 @@
perror("send_tcp_cc: data recv error");
exit(1);
}
-
+
}
-
+
/* this call will always give us the elapsed time for the test, and */
/* will also store-away the necessaries for cpu utilization */
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being measured? */
/* how long did we really run? */
-
+
/* Get the statistics from the remote end. The remote will have */
/* calculated service demand and all those interesting things. If it */
/* wasn't supposed to care, it will return obvious values. */
-
+
recv_response();
if (!netperf_response.content.serv_errno) {
if (debug)
@@ -12408,10 +12408,10 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(1);
}
-
+
/* We now calculate what our thruput was for the test. In the future, */
/* we may want to include a calculation of the thruput measured by */
/* the remote, but it should be the case that for a TCP stream test, */
@@ -12422,11 +12422,11 @@
/* send_size, so we really didn't send what he asked for ;-) We use */
/* Kbytes/s as the units of thruput for a TCP stream test, where K = */
/* 1024. A future enhancement *might* be to choose from a couple of */
- /* unit selections. */
-
+ /* unit selections. */
+
bytes_xferd = (req_size * nummessages) + (rsp_size * nummessages);
thruput = calc_thruput(bytes_xferd);
-
+
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu */
/* utilization for the system(s) */
@@ -12452,7 +12452,7 @@
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
-
+
if (remote_cpu_usage) {
if (remote_cpu_rate == 0.0) {
fprintf(where,"DANGER DANGER DANGER DANGER DANGER DANGER DANGER!\n");
@@ -12472,7 +12472,7 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
-
+
/* We are now ready to print all the information. If the user */
/* has specified zero-level verbosity, we will just print the */
/* local service demand, or the remote service demand. If the */
@@ -12481,7 +12481,7 @@
/* of greater than 1, we will display a veritable plethora of */
/* background information from outside of this block as it it */
/* not cpu_measurement specific... */
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -12504,7 +12504,7 @@
local_cpu_method,
remote_cpu_method);
}
-
+
fprintf(where,
cpu_fmt_1_line_1, /* the format string */
lss_size, /* local sendbuf size */
@@ -12550,23 +12550,23 @@
tput_fmt_1_line_2,
rss_size, /* remote recvbuf size */
rsr_size);
-
+
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
if (verbosity > 1) {
/* The user wanted to know it all, so we will give it to him. */
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
fprintf(where,
ksink_fmt,
local_send_align,
@@ -12581,14 +12581,14 @@
#endif /* WANT_HISTOGRAM */
}
-
+
}
void
recv_tcp_cc()
{
-
+
char *message;
struct addrinfo *local_res;
@@ -12604,23 +12604,23 @@
int trans_remaining;
int timed_out = 0;
float elapsed_time;
-
+
struct tcp_cc_request_struct *tcp_cc_request;
struct tcp_cc_response_struct *tcp_cc_response;
struct tcp_cc_results_struct *tcp_cc_results;
-
- tcp_cc_request =
+
+ tcp_cc_request =
(struct tcp_cc_request_struct *)netperf_request.content.test_specific_data;
- tcp_cc_response =
+ tcp_cc_response =
(struct tcp_cc_response_struct *)netperf_response.content.test_specific_data;
- tcp_cc_results =
+ tcp_cc_results =
(struct tcp_cc_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_tcp_cc: entered...\n");
fflush(where);
}
-
+
/* We want to set-up the listen socket with all the desired */
/* parameters and then let the initiator know that all is ready. If */
/* socket size defaults are to be used, then the initiator will have */
@@ -12628,19 +12628,19 @@
/* send-back what they are. If that information cannot be determined, */
/* then we send-back -1's for the sizes. If things go wrong for any */
/* reason, we will drop back ten yards and punt. */
-
+
/* If anything goes wrong, we want the remote to know about it. It */
/* would be best if the error that the remote reports to the user is */
/* the actual error we encountered, rather than some bogus unexpected */
/* response type message. */
-
+
if (debug) {
fprintf(where,"recv_tcp_cc: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = TCP_CC_RESPONSE;
-
+
if (debug) {
fprintf(where,"recv_tcp_cc: the response type is set...\n");
fflush(where);
@@ -12652,10 +12652,10 @@
printf("malloc(%d) failed!\n", DATABUFFERLEN);
exit(1);
}
-
+
/* We now alter the message_ptr variables to be at the desired */
/* alignments with the desired offsets. */
-
+
if (debug) {
fprintf(where,
"recv_tcp_cc: requested recv alignment of %d offset %d\n",
@@ -12669,16 +12669,16 @@
}
recv_message_ptr = ALIGN_BUFFER(message, tcp_cc_request->recv_alignment, tcp_cc_request->recv_offset);
-
+
send_message_ptr = ALIGN_BUFFER(message, tcp_cc_request->send_alignment, tcp_cc_request->send_offset);
if (debug) {
fprintf(where,"recv_tcp_cc: receive alignment and offset set...\n");
fflush(where);
}
-
+
/* Grab a socket to listen on, and then listen on it. */
-
+
if (debug) {
fprintf(where,"recv_tcp_cc: grabbing a socket...\n");
fflush(where);
@@ -12708,7 +12708,7 @@
0);
s_listen = create_data_socket(local_res);
-
+
if (s_listen == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
@@ -12738,7 +12738,7 @@
}
exit(1);
}
-
+
/* now get the port number assigned by the system */
addrlen = sizeof(myaddr_in);
if (getsockname(s_listen,
@@ -12753,12 +12753,12 @@
}
exit(1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is */
/* returned to the sender also implicitly telling the sender that the */
/* socket buffer sizing has been done. */
-
- tcp_cc_response->data_port_number =
+
+ tcp_cc_response->data_port_number =
(int) ntohs(((struct sockaddr_in *)&myaddr_in)->sin_port);
if (debug) {
fprintf(where,"telling the remote to call me at %d\n",
@@ -12766,22 +12766,22 @@
fflush(where);
}
netperf_response.content.serv_errno = 0;
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a 0.0 to */
/* the initiator. */
-
+
tcp_cc_response->cpu_rate = (float)0.0; /* assume no cpu */
if (tcp_cc_request->measure_cpu) {
tcp_cc_response->measure_cpu = 1;
- tcp_cc_response->cpu_rate =
+ tcp_cc_response->cpu_rate =
calibrate_local_cpu(tcp_cc_request->cpu_rate);
}
-
-
+
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
tcp_cc_response->send_buf_size = lss_size;
@@ -12791,17 +12791,17 @@
tcp_cc_response->so_sndavoid = loc_sndavoid;
send_response();
-
+
addrlen = sizeof(peeraddr_in);
-
+
/* Now it's time to start receiving data on the connection. We will */
/* first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(tcp_cc_request->measure_cpu);
-
+
/* The loop will exit when the sender does a shutdown, which will */
/* return a length of zero */
-
+
if (tcp_cc_request->test_length > 0) {
times_up = 0;
trans_remaining = 0;
@@ -12811,12 +12811,12 @@
times_up = 1;
trans_remaining = tcp_cc_request->test_length * -1;
}
-
+
trans_received = 0;
while ((!times_up) || (trans_remaining > 0)) {
#ifdef WIN32
- /* The test timer will probably fire during this accept,
+ /* The test timer will probably fire during this accept,
so to make the start_timer above work we have to move
it to close s_listen while we are blocked on accept. */
win_kludge_socket = s_listen;
@@ -12833,7 +12833,7 @@
fprintf(where,"recv_tcp_cc: accept: errno = %d\n",errno);
fflush(where);
close(s_listen);
-
+
exit(1);
}
@@ -12841,11 +12841,11 @@
/* this is for those systems which *INCORRECTLY* fail to pass */
/* attributes across an accept() call. Including this goes against */
/* my better judgement :( raj 11/95 */
-
+
kludge_socket_options(s_data);
#endif /* KLUDGE_SOCKET_OPTIONS */
-
+
#ifdef WIN32
/* this is used so the timer thread can close the socket out from */
/* under us, which to date is the easiest/cleanest/least */
@@ -12860,8 +12860,8 @@
fprintf(where,"recv_tcp_cc: accepted data connection.\n");
fflush(where);
}
-
+
/* close the connection. the server will likely do a graceful */
/* close of the connection, insuring that all data has arrived at */
/* the client. for this it will call shutdown(), and then recv() and */
@@ -12874,7 +12874,7 @@
if (trans_remaining) {
trans_remaining--;
}
-
+
if (debug) {
fprintf(where,
"recv_tcp_cc: Transaction %d complete\n",
@@ -12883,13 +12883,13 @@
}
}
-
-
+
+
/* The loop now exits due to timeout or transaction count being */
/* reached */
-
+
cpu_stop(tcp_cc_request->measure_cpu,&elapsed_time);
-
+
if (timed_out) {
/* we ended the test by time, which was at least 2 seconds */
/* longer than we wanted to run. so, we want to subtract */
@@ -12897,16 +12897,16 @@
elapsed_time -= PAD_TIME;
}
/* send the results to the sender */
-
+
if (debug) {
fprintf(where,
"recv_tcp_cc: got %d transactions\n",
trans_received);
fflush(where);
}
-
- tcp_cc_results->bytes_received = (trans_received *
- (tcp_cc_request->request_size +
+
+ tcp_cc_results->bytes_received = (trans_received *
+ (tcp_cc_request->request_size +
tcp_cc_request->response_size));
tcp_cc_results->trans_received = trans_received;
tcp_cc_results->elapsed_time = elapsed_time;
@@ -12914,15 +12914,15 @@
if (tcp_cc_request->measure_cpu) {
tcp_cc_results->cpu_util = calc_cpu_util(elapsed_time);
}
-
+
if (debug) {
fprintf(where,
"recv_tcp_cc: test complete, sending results.\n");
fflush(where);
}
-
+
send_response();
-
+
}
void
@@ -12942,10 +12942,10 @@
#define SOCKETS_ARGS "b:CDnNhH:L:m:M:p:P:r:R:s:S:T:Vw:W:z46"
extern char *optarg; /* pointer to option string */
-
+
int c;
-
- char
+
+ char
arg1[BUFSIZ], /* argument holders */
arg2[BUFSIZ];
@@ -12977,10 +12977,10 @@
/* the first will set both to that value. Specifying only the */
/* second will leave the first untouched. To change only the */
/* first, use the form "first," (see the routine break_args.. */
-
+
while ((c= getopt(argc, argv, SOCKETS_ARGS)) != EOF) {
switch (c) {
- case '?':
+ case '?':
case '4':
remote_data_family = AF_INET;
local_data_family = AF_INET;
@@ -13011,7 +13011,7 @@
/* set TCP_CORK */
loc_tcpcork = 1;
rem_tcpcork = 1; /* however, at first, we ony have cork affect loc */
-#else
+#else
printf("WARNING: TCP_CORK not available on this platform!\n");
#endif /* TCP_CORK */
break;
@@ -13024,7 +13024,7 @@
break_args_explicit(optarg,arg1,arg2);
if (arg1[0]) {
/* make sure we leave room for the NULL termination boys and
- girls. raj 2005-02-82 */
+ girls. raj 2005-02-82 */
remote_data_address = malloc(strlen(arg1)+1);
strncpy(remote_data_address,arg1,strlen(arg1));
}
@@ -13035,7 +13035,7 @@
break_args_explicit(optarg,arg1,arg2);
if (arg1[0]) {
/* make sure we leave room for the NULL termination boys and
- girls. raj 2005-02-82 */
+ girls. raj 2005-02-82 */
local_data_address = malloc(strlen(arg1)+1);
strncpy(local_data_address,arg1,strlen(arg1));
}
@@ -13063,7 +13063,7 @@
break_args(optarg,arg1,arg2);
if (arg1[0])
req_size = convert(arg1);
- if (arg2[0])
+ if (arg2[0])
rsp_size = convert(arg2);
break;
case 'R':
@@ -13092,7 +13092,7 @@
break_args(optarg,arg1,arg2);
if (arg1[0])
client_port_min = atoi(arg1);
- if (arg2[0])
+ if (arg2[0])
client_port_max = atoi(arg2);
break;
case 'P':
@@ -13102,7 +13102,7 @@
break_args(optarg,arg1,arg2);
if (arg1[0])
strncpy(local_data_port,arg1,sizeof(local_data_port));
- if (arg2[0])
+ if (arg2[0])
strncpy(remote_data_port,arg2,sizeof(remote_data_port));
break;
case 't':
@@ -13141,7 +13141,7 @@
};
}
-#if defined(WANT_FIRST_BURST)
+#if defined(WANT_FIRST_BURST)
#if defined(WANT_HISTOGRAM)
/* if WANT_FIRST_BURST and WANT_HISTOGRAM are defined and the user
indeed wants a non-zero first burst size, and we would emit a
Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c 2012-01-31 22:19:03 UTC (rev 524)
+++ trunk/src/nettest_omni.c 2012-01-31 22:23:50 UTC (rev 525)
@@ -161,7 +161,7 @@
#else
static struct timeval intvl_one;
static struct timeval intvl_two;
-static struct timeval intvl_wait_start;
+static struct timeval intvl_wait_start;
static struct timeval *intvl_one_ptr = &intvl_one;
static struct timeval *intvl_two_ptr = &intvl_two;
static struct timeval *temp_intvl_ptr = &intvl_one;
@@ -652,7 +652,7 @@
}
static unsigned short
-get_port_number(struct addrinfo *res)
+get_port_number(struct addrinfo *res)
{
switch(res->ai_family) {
case AF_INET: {
@@ -846,7 +846,7 @@
a specific port :) raj 2008-01-08 */
srand(getpid());
if (client_port_max - client_port_min) {
- myport = client_port_min +
+ myport = client_port_min +
(rand() % (client_port_max - client_port_min));
}
else {
@@ -856,11 +856,11 @@
myport--;
myport_init = 1;
}
-
+
/* newport: */
/* pick a new port number */
myport++;
-
+
/* check to see if we are using the port number on which the
server is sitting _before_ we check against the boundaries lest
the server sits at the upper boundary. if this happens to be a
@@ -868,9 +868,9 @@
unsatisfying results and should be avoided. if this isn't a
loopback test, avoiding using the same port number doesn't
seriously affect anything anyway */
-
+
if (myport == get_port_number(remote_res)) myport++;
-
+
/* wrap the port number when we reach the upper bound. for
students of networking history, some ancient stacks (1980's and
early 1990's perhaps) mistakenly treated these port numbers as
@@ -879,7 +879,7 @@
if (myport >= client_port_max) {
myport = (unsigned short)client_port_min;
}
-
+
/* set up the data socket */
set_port_number(local_res, (unsigned short)myport);
}
@@ -1284,17 +1284,17 @@
netperf_output_source[i].max_line_len,
netperf_output_source[i].tot_line_len,
netperf_output_source[i].display_value,
- (netperf_output_source[i].line[0] == NULL) ? "" :
+ (netperf_output_source[i].line[0] == NULL) ? "" :
netperf_output_source[i].line[0],
- (netperf_output_source[i].line[1] == NULL) ? "" :
+ (netperf_output_source[i].line[1] == NULL) ? "" :
netperf_output_source[i].line[1],
- (netperf_output_source[i].line[2] == NULL) ? "" :
+ (netperf_output_source[i].line[2] == NULL) ? "" :
netperf_output_source[i].line[2],
- (netperf_output_source[i].line[3] == NULL) ? "" :
+ (netperf_output_source[i].line[3] == NULL) ? "" :
netperf_output_source[i].line[3],
- (netperf_output_source[i].brief == NULL) ? "" :
+ (netperf_output_source[i].brief == NULL) ? "" :
netperf_output_source[i].brief,
- (netperf_output_source[i].format == NULL) ? "" :
+ (netperf_output_source[i].format == NULL) ? "" :
netperf_output_source[i].format);
}
fflush(where);
@@ -1340,7 +1340,7 @@
/* try for a match based on the nmemonic/enum */
if (!strcasecmp(candidate,netperf_output_enum_to_str(name)))
return name;
-
+
/* try for a match on the actual header text */
temp = malloc(NETPERF_LINE_TOT(name));
h1 = temp;
@@ -1362,7 +1362,7 @@
free(temp);
return name;
}
- else
+ else
free(temp);
}
}
@@ -1429,7 +1429,7 @@
fflush(where);
exit(-1);
}
-
+
line = 0;
column = 1;
namepos = 0;
@@ -1439,7 +1439,7 @@
while (((c = fgetc(selections)) != EOF) && (line < 4)) {
if (namepos == 80) {
/* too long */
-
+
fprintf(where,
"Output selection starting column %d on line %d is too long\n",
line + 1,
@@ -1501,7 +1501,7 @@
if (line >= NETPERF_MAX_BLOCKS) {
if (debug) {
fprintf(where,
- "There can be no more than %d output selection lines."
+ "There can be no more than %d output selection lines."
" Ignoring output selection line %d |%s|\n",
NETPERF_MAX_BLOCKS,
line + 1,
@@ -1511,7 +1511,7 @@
return;
}
-
+
j=0;
token = strtok(list," ,");
while ((token) && (j < NETPERF_OUTPUT_MAX)) {
@@ -1530,7 +1530,7 @@
desired_output_groups |= netperf_output_source[name].output_group;
j++;
}
-
+
token = strtok(NULL," ,");
}
if ((token) && (debug)) {
@@ -1594,11 +1594,11 @@
done = 1;
}
} while (!done);
-
+
free(f1);
free(f2);
free(f3);
-
+
}
/* building blocks for output selection */
@@ -1627,7 +1627,7 @@
if (NETPERF_XMIT_ONLY(direction)) {
if (!(local_cpu_usage || remote_cpu_usage))
parse_output_selection_direct(stream_no_cpu);
- else
+ else
parse_output_selection_direct(stream_cpu);
}
else if (NETPERF_RECV_ONLY(direction)) {
@@ -1676,7 +1676,7 @@
mnemonic without any separators... */
else if (strchr(output_selection,',') ||
strchr(output_selection,';') ||
- (match_string_to_output_mnenomic(output_selection) !=
+ (match_string_to_output_mnenomic(output_selection) !=
NETPERF_OUTPUT_UNKNOWN)) {
parse_output_selection_direct(output_selection);
}
@@ -1786,7 +1786,7 @@
set_output_elt(REMOTE_SEND_THROUGHPUT, "Remote", "Send", "Throughput", "",
"%.2f", &remote_send_thruput, 1, 0);
- set_output_elt(REMOTE_RECV_THROUGHPUT, "Remote", "Recv", "Throughput", "",
+ set_output_elt(REMOTE_RECV_THROUGHPUT, "Remote", "Recv", "Throughput", "",
"%.2f", &remote_recv_thruput, 1, 0);
set_output_elt(THROUGHPUT_UNITS, "Throughput", "Units", "", "", "%s/s",
@@ -1795,13 +1795,13 @@
set_output_elt(CONFIDENCE_LEVEL, "Confidence", "Level", "Percent", "", "%d",
&confidence_level, 1, 0);
- set_output_elt(CONFIDENCE_INTERVAL, "Confidence", "Width", "Target", "",
+ set_output_elt(CONFIDENCE_INTERVAL, "Confidence", "Width", "Target", "",
"%f", &interval_pct, 1, 0);
set_output_elt(CONFIDENCE_ITERATION, "Confidence", "Iterations", "Run", "",
"%d", &confidence_iteration, 1, 0);
- set_output_elt(THROUGHPUT_CONFID, "Throughput", "Confidence", "Width (%)",
+ set_output_elt(THROUGHPUT_CONFID, "Throughput", "Confidence", "Width (%)",
"", "%.3f", &result_confid_pct, 1, 0);
set_output_elt(LOCAL_CPU_CONFID, "Local", "CPU", "Confidence", "Width (%)",
@@ -2043,7 +2043,7 @@
set_output_elt(LOCAL_DRIVER_FIRMWARE, "Local", "Driver", "Firmware", "",
"%s", local_driver_firmware, 1, OMNI_WANT_LOC_DRVINFO);
- set_output_elt(LOCAL_DRIVER_BUS, "Local", "Driver", "Bus", "", "%s",
+ set_output_elt(LOCAL_DRIVER_BUS, "Local", "Driver", "Bus", "", "%s",
local_driver_bus, 1, OMNI_WANT_LOC_DRVINFO);
set_output_elt(REMOTE_DRIVER_NAME, "Remote", "Driver", "Name", "", "%s",
@@ -2066,13 +2066,13 @@
"0x%.4x", &local_interface_device, 1, OMNI_WANT_LOC_IFIDS);
set_output_elt(LOCAL_INTERFACE_SUBVENDOR, "Local", "Interface", "Subvendor",
- "", "0x%.4x", &local_interface_subvendor, 1,
+ "", "0x%.4x", &local_interface_subvendor, 1,
OMNI_WANT_LOC_IFIDS);
set_output_elt(LOCAL_INTERFACE_VENDOR, "Local", "Interface", "Vendor", "",
"0x%.4x", &local_interface_vendor, 1, OMNI_WANT_LOC_IFIDS);
- set_output_elt(REMOTE_INTERFACE_SUBDEVICE, "Remote", "Interface",
+ set_output_elt(REMOTE_INTERFACE_SUBDEVICE, "Remote", "Interface",
"Subdevice", "", "0x%.4x", &remote_interface_subdevice, 1,
OMNI_WANT_REM_IFIDS);
@@ -2100,10 +2100,10 @@
set_output_elt(REMOTE_MACHINE, "Remote", "Machine", "", "", "%s",
remote_machine, 1, 0);
-
+
set_output_elt(REMOTE_VERSION, "Remote", "Version", "", "", "%s",
remote_version, 1, 0);
-
+
set_output_elt(REMOTE_RELEASE, "Remote", "Release", "", "", "%s",
remote_release, 1, 0);
@@ -2134,7 +2134,7 @@
set_output_elt(LOCAL_SECURITY_TYPE, "Local", "OS", "Security", "Type", "%s",
local_security_type, 1, 0);
- set_output_elt(LOCAL_SECURITY_SPECIFIC, "Local", "OS", "Security",
+ set_output_elt(LOCAL_SECURITY_SPECIFIC, "Local", "OS", "Security",
"Specific", "%s", local_security_specific, 1, 0);
set_output_elt(LOCAL_SECURITY_ENABLED_NUM, "Local", "OS", "Security",
@@ -2215,11 +2215,11 @@
set_output_elt(REMOTE_SOCKET_TOS, "Remote", "Socket", "TOS", "", "0x%.2x",
&remote_socket_tos, 1, 0);
- set_output_elt(LOCAL_CONG_CONTROL, "Local", "Congestion", "Control",
+ set_output_elt(LOCAL_CONG_CONTROL, "Local", "Congestion", "Control",
"Algorithm", "%s", local_cong_control, 0,
OMNI_WANT_LOC_CONG);
- set_output_elt(REMOTE_CONG_CONTROL, "Remote", "Congestion", "Control",
+ set_output_elt(REMOTE_CONG_CONTROL, "Remote", "Congestion", "Control",
"Algorithm", "%s", remote_cong_control, 0,
OMNI_WANT_REM_CONG);
@@ -2234,7 +2234,7 @@
}
-void
+void
print_omni_init() {
int i,j;
@@ -2277,7 +2277,7 @@
/* why? because one cannot simply pass a pointer to snprintf :) for
our nefarious porpoises, we only expect to handle single-value
format statements, not a full-blown format */
-int
+int
my_long_long_snprintf(char *buffer, size_t size, const char *format, void *value)
{
const char *fmt = format;
@@ -2360,13 +2360,13 @@
buflen = 0;
for (i = 0; i < NETPERF_MAX_BLOCKS; i++) {
- for (j = 0;
- ((j < NETPERF_OUTPUT_MAX) &&
+ for (j = 0;
+ ((j < NETPERF_OUTPUT_MAX) &&
(output_list[i][j] != OUTPUT_END));
j++) {
if ((netperf_output_source[output_list[i][j]].format != NULL) &&
(netperf_output_source[output_list[i][j]].display_value != NULL)) {
- vallen =
+ vallen =
my_snprintf(tmpval,
1024,
netperf_output_source[output_list[i][j]].format,
@@ -2381,12 +2381,12 @@
}
else
vallen = 0;
-
- if (vallen >
+
+ if (vallen >
netperf_output_source[output_list[i][j]].tot_line_len)
netperf_output_source[output_list[i][j]].tot_line_len = vallen;
-
- buflen +=
+
+ buflen +=
netperf_output_source[output_list[i][j]].tot_line_len;
}
}
@@ -2409,18 +2409,18 @@
h1 = hdr1;
v1 = val1;
for (i = 0; i < NETPERF_MAX_BLOCKS; i++) {
- for (j = 0;
- ((j < NETPERF_OUTPUT_MAX) &&
+ for (j = 0;
+ ((j < NETPERF_OUTPUT_MAX) &&
(output_list[i][j] != OUTPUT_END));
j++) {
int len;
- len = 0;
+ len = 0;
if (print_headers) {
- for (k = 0; ((k < 4) &&
- (NULL !=
+ for (k = 0; ((k < 4) &&
+ (NULL !=
netperf_output_source[output_list[i][j]].line[k]) &&
(strcmp("",netperf_output_source[output_list[i][j]].line[k]))); k++) {
-
+
len = sprintf(h1,
"%s",
netperf_output_source[output_list[i][j]].line[k]);
@@ -2438,7 +2438,7 @@
netperf_output_source[output_list[i][j]].tot_line_len,
netperf_output_source[output_list[i][j]].format,
netperf_output_source[output_list[i][j]].display_value);
-
+
/* nuke the trailing \n" from the string routine. */
*(v1 + len) = ',';
v1 += len + 1;
@@ -2478,13 +2478,13 @@
int vallen;
for (i = 0; i < NETPERF_MAX_BLOCKS; i++) {
- for (j = 0;
- ((j < NETPERF_OUTPUT_MAX) &&
+ for (j = 0;
+ ((j < NETPERF_OUTPUT_MAX) &&
(output_list[i][j] != OUTPUT_END));
j++) {
if ((netperf_output_source[output_list[i][j]].format != NULL) &&
(netperf_output_source[output_list[i][j]].display_value != NULL)) {
- vallen =
+ vallen =
my_snprintf(tmpval,
1024,
netperf_output_source[output_list[i][j]].format,
@@ -2507,7 +2507,7 @@
void
print_omni_human()
{
-
+
int i,j,k,buflen,buflen_max;
char *hdr[4];
@@ -2528,8 +2528,8 @@
buflen_max = 0;
for (i = 0; i < NETPERF_MAX_BLOCKS; i++) {
buflen = 0;
- for (j = 0;
- ((j < NETPERF_OUTPUT_MAX) &&
+ for (j = 0;
+ ((j < NETPERF_OUTPUT_MAX) &&
(output_list[i][j] != OUTPUT_END));
j++) {
if ((netperf_output_source[output_list[i][j]].format != NULL) &&
@@ -2543,15 +2543,15 @@
else
vallen = 0;
- if (vallen >
+ if (vallen >
netperf_output_source[output_list[i][j]].max_line_len)
netperf_output_source[output_list[i][j]].max_line_len = vallen;
-
- buflen +=
+
+ buflen +=
netperf_output_source[output_list[i][j]].max_line_len + 1;
}
- if (buflen > buflen_max)
+ if (buflen > buflen_max)
buflen_max = buflen;
}
@@ -2560,7 +2560,7 @@
hdr[k] = malloc(buflen_max+1);
}
val1 = malloc(buflen_max+1);
-
+
/* we could probably be more succinct here but perhaps the compiler
can figure that out for us :) */
for (k = 0; (k < 4) && (print_headers); k++) {
@@ -2586,8 +2586,8 @@
memset(val1,' ',buflen_max+1);
- for (j = 0;
- ((j < NETPERF_OUTPUT_MAX) &&
+ for (j = 0;
+ ((j < NETPERF_OUTPUT_MAX) &&
(output_list[i][j] != OUTPUT_END));
j++) {
if (print_headers) {
@@ -2609,7 +2609,7 @@
}
/* now move to the next starting column */
for (k = 0; (k < 4) && (print_headers); k++) {
- h[k] +=
+ h[k] +=
netperf_output_source[output_list[i][j]].max_line_len + 1;
}
v1 += netperf_output_source[output_list[i][j]].max_line_len + 1;
@@ -2642,7 +2642,7 @@
print_omni_init();
- if (debug > 2)
+ if (debug > 2)
dump_netperf_output_source(where);
switch (netperf_output_mode) {
@@ -2672,12 +2672,12 @@
2008-01-09 */
int
-connect_data_socket(SOCKET send_socket, struct addrinfo *remote_res)
+connect_data_socket(SOCKET send_socket, struct addrinfo *remote_res)
{
int ret;
-
+
/* Connect up to the remote port on the data socket */
- if ((ret = connect(send_socket,
+ if ((ret = connect(send_socket,
remote_res->ai_addr,
remote_res->ai_addrlen)) == INVALID_SOCKET) {
if (SOCKET_EINTR(ret)) {
@@ -2695,7 +2695,7 @@
2008-01-08 */
return -2;
}
- else
+ else
/* -3 means there was an error */
return -3;
}
@@ -2822,9 +2822,9 @@
}
my_recvs++;
} while ((bytes_left > 0) && (flags & NETPERF_WAITALL));
-
+
*num_receives = my_recvs;
-
+
/* OK, we are out of the loop - now what? */
if (bytes_recvd < 0) {
/* did the timer hit, or was there an error? */
@@ -2836,15 +2836,15 @@
/* it was a hard error */
return -3;
}
-
-
+
+
/* this looks a little funny, but should be correct. if we had
NETPERF_WAITALL set and we got here, it means we got all the
bytes of the request/response. otherwise we would have hit the
error or end of test cases. if NETPERF_WAITALL isn't set, this
is a STREAM test, and we will have only made one call to recv, so
bytes_recvd will be accurate. */
- if (bytes_left)
+ if (bytes_left)
return bytes_recvd;
else
return bytes_to_recv;
@@ -2876,7 +2876,7 @@
:) */
int i;
for (i = 0; i < 3; i++) {
- if (peer)
+ if (peer)
ret = sendto(data_socket,
buffer,
0,
@@ -2905,11 +2905,11 @@
}
else
return -3;
-
+
}
int
-disconnect_data_socket(SOCKET data_socket, int initiate, int do_close, struct sockaddr *peer, int peerlen)
+disconnect_data_socket(SOCKET data_socket, int initiate, int do_close, struct sockaddr *peer, int peerlen)
{
char buffer[4];
@@ -2938,7 +2938,7 @@
if (protocol != IPPROTO_UDP) {
if (initiate)
shutdown(data_socket, SHUT_WR);
-
+
/* we are expecting to get either a return of zero indicating
connection close, or an error. of course, we *may* never
receive anything from the remote which means we probably really
@@ -2948,7 +2948,7 @@
buffer,
1,
0);
-
+
if (bytes_recvd != 0) {
/* connection close, call close. we assume that the requisite
number of bytes have been received */
@@ -2963,7 +2963,7 @@
else {
int i;
for (i = 0; i < 3; i++) {
- if (peer)
+ if (peer)
bytes_recvd = sendto(data_socket,
buffer,
0,
@@ -2977,22 +2977,22 @@
0);
/* we only really care if the timer expired on us */
if (SOCKET_EINTR(bytes_recvd)) {
- if (do_close)
+ if (do_close)
close(data_socket);
return -1;
}
}
}
-
- if (do_close)
+
+ if (do_close)
close(data_socket);
-
+
return 0;
}
#ifdef HAVE_LINUX_TCP_H
static void
-dump_tcp_info(struct tcp_info *tcp_info)
+dump_tcp_info(struct tcp_info *tcp_info)
{
printf("tcpi_rto %d tcpi_ato %d tcpi_pmtu %d tcpi_rcv_ssthresh %d\n"
@@ -3077,7 +3077,7 @@
*mss = -1;
return;
}
-
+
if (getsockopt(socket,
protocol,
option,
@@ -3092,7 +3092,7 @@
}
-/*
+/*
if ( setsockopt(sd, SOL_TCP, TCP_CONGESTION, "ledbat", 6) == -1 ) {
perror("setsockopt");
exit(EXIT_FAILURE);
@@ -3129,7 +3129,7 @@
}
static SOCKET
-omni_create_data_socket(struct addrinfo *res)
+omni_create_data_socket(struct addrinfo *res)
{
SOCKET temp_socket;
@@ -3189,7 +3189,7 @@
void
send_omni_inner(char remote_host[], unsigned int legacy_caller, char header_str[])
{
-
+
int ret,rret;
int connected = 0;
int timed_out = 0;
@@ -3208,14 +3208,14 @@
uint32_t temp_recvs;
char tmpfmt;
-
+
struct addrinfo *local_res;
struct addrinfo *remote_res;
struct omni_request_struct *omni_request;
struct omni_response_struct *omni_response;
struct omni_results_struct *omni_result;
-
+
#ifdef WANT_FIRST_BURST
#define REQUEST_CWND_INITIAL 2
/* "in the beginning..." the WANT_FIRST_BURST stuff was like both
@@ -3255,14 +3255,14 @@
#endif
- omni_request =
+ omni_request =
(struct omni_request_struct *)netperf_request.content.test_specific_data;
- omni_response =
+ omni_response =
(struct omni_response_struct *)netperf_response.content.test_specific_data;
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... however, we do
@@ -3283,7 +3283,7 @@
control socket, and since we want to be able to use different
protocols and such, we are passed the name of the remote host and
must turn that into the test specific addressing information. */
-
+
complete_addrinfos(&remote_res,
&local_res,
remote_host,
@@ -3296,20 +3296,20 @@
}
/* initialize a few counters */
-
+
need_socket = 1;
- if (connection_test)
+ if (connection_test)
pick_next_port_number(local_res,remote_res);
-
+
/* If the user has requested cpu utilization measurements, we must
calibrate the cpu(s). We will perform this task within the tests
themselves. If the user has specified the cpu rate, then
calibrate_local_cpu will return rather quickly as it will have
nothing to do. If local_cpu_rate is zero, then we will go through
all the "normal" calibration stuff and return the rate back.*/
-
+
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
@@ -3354,13 +3354,13 @@
/* if the command-line included requests to randomize the IP
addresses, then honor it. of course, this may not work all that
well for some tests... raj 20101129 */
- if (local_mask_len)
+ if (local_mask_len)
random_ip_address(local_res, local_mask_len);
if (remote_mask_len)
random_ip_address(remote_res, remote_mask_len);
data_socket = omni_create_data_socket(local_res);
-
+
if (data_socket == INVALID_SOCKET) {
perror("netperf: send_omni: unable to create data socket");
exit(1);
@@ -3388,12 +3388,12 @@
if (send_size == 0) {
send_size = choose_send_size(lss_size,protocol);
}
- if (send_width == 0)
+ if (send_width == 0)
send_width = (lss_size/send_size) + 1;
if (send_width == 1) send_width++;
bytes_to_send = send_size;
}
-
+
send_ring = allocate_buffer_ring(send_width,
bytes_to_send,
local_send_align,
@@ -3405,7 +3405,7 @@
}
}
}
-
+
if (direction & NETPERF_RECV) {
/* do we need to join a multicast group? */
if (is_multicast_addr(local_res)) {
@@ -3434,7 +3434,7 @@
}
bytes_to_recv = recv_size;
}
-
+
recv_ring = allocate_buffer_ring(recv_width,
bytes_to_recv,
local_recv_align,
@@ -3446,9 +3446,9 @@
}
}
}
-
+
if (!no_control) {
-
+
/* Tell the remote end to do a listen or otherwise prepare for
what is to come. The server alters the socket paramters on the
other side at this point, hence the reason for all the values
@@ -3458,7 +3458,7 @@
default should be used. Alignment is the exception, it will
default to 8, which will probably be no alignment
alterations. */
-
+
netperf_request.content.request_type = DO_OMNI;
omni_request->flags = 0;
omni_request->send_buf_size = rss_size_req;
@@ -3467,7 +3467,7 @@
omni_request->send_offset = remote_send_offset;
omni_request->send_width = send_width;
omni_request->request_size = req_size;
-
+
omni_request->recv_buf_size = rsr_size_req;
omni_request->receive_size = remote_recv_size_req;
omni_request->recv_alignment = remote_recv_align;
@@ -3485,9 +3485,9 @@
if (remote_use_sendfile)
omni_request->flags |= OMNI_USE_SENDFILE;
- if (connection_test)
+ if (connection_test)
omni_request->flags |= OMNI_CONNECT_TEST;
-
+
if (remote_checksum_off)
omni_request->flags |= OMNI_CHECKSUM_OFF;
@@ -3505,7 +3505,7 @@
if (desired_output_groups & OMNI_WANT_REM_IFIDS)
omni_request->flags |= OMNI_WANT_IFIDS;
-
+
if (desired_output_groups & OMNI_WANT_REM_DRVINFO)
omni_request->flags |= OMNI_WANT_DRVINFO;
@@ -3517,7 +3517,7 @@
strncpy(omni_request->cong_control,
remote_cong_control_req,
sizeof(omni_request->cong_control));
- omni_request->cong_control[sizeof(omni_request->cong_control) - 1] =
+ omni_request->cong_control[sizeof(omni_request->cong_control) - 1] =
'\0';
if (want_keepalive)
@@ -3533,7 +3533,7 @@
omni_request->send_dirty_count = rem_dirty_count;
omni_request->recv_dirty_count = rem_dirty_count;
omni_request->recv_clean_count = rem_clean_count;
-
+
omni_request->data_port = atoi(remote_data_port);
omni_request->ipfamily = af_to_nf(remote_res->ai_family);
omni_request->socket_type = hst_to_nst(socket_type);
@@ -3549,7 +3549,7 @@
omni_request->direction |= NETPERF_RECV;
if (direction & NETPERF_RECV)
omni_request->direction |= NETPERF_XMIT;
-
+
/* some tests may require knowledge of our local addressing. such
tests will for the time being require that the user specify a
local IP/name so we can extract them from the data_socket. */
@@ -3583,14 +3583,14 @@
send_request_n(OMNI_REQUEST_CONV_CUTOFF);
-
+
/* the response from the remote should contain all the relevant
socket and other parameters we need to know for this test.
so, we can shove them back into the relevant variables here
and be on our way. */
recv_response_n(OMNI_RESPONSE_CONV_CUTOFF); /* brittle, but functional */
-
+
if (!netperf_response.content.serv_errno) {
rsr_size = omni_response->recv_buf_size;
remote_recv_size = omni_response->receive_size;
@@ -3609,7 +3609,7 @@
recv_response will have put everything into host order */
set_port_number(remote_res,
(unsigned short)omni_response->data_port);
-
+
if (debug) {
fprintf(where,"remote listen done.\n");
fprintf(where,"remote port is %u\n",get_port_number(remote_res));
@@ -3635,7 +3635,7 @@
remote_security_type_id = (int) omni_response->security_info >> 16;
remote_security_enabled_num = (short)omni_response->security_info;
remote_security_type = nsec_type_to_str(remote_security_type_id);
- remote_security_enabled =
+ remote_security_enabled =
nsec_enabled_to_str(remote_security_enabled_num);
}
else {
@@ -3647,12 +3647,12 @@
fflush(where);
exit(-1);
}
-
+
}
else {
/* we are a no_control test so some things about the remote need
to be set accordingly */
- if (NULL == remote_system_model)
+ if (NULL == remote_system_model)
remote_system_model = strdup("Unknown System Model");
if (NULL == remote_cpu_model)
remote_cpu_model = strdup("Unknown CPU Model");
@@ -3682,7 +3682,7 @@
unreliable transport or connection tests it can only be time
p based. having said that, we rely entirely on other code to
enforce this before we even get here. raj 2008-01-08 */
-
+
if (test_time) {
/* The user wanted to end the test after a period of time. if
we are a recv-only test, we need to protect ourself against
@@ -3705,7 +3705,7 @@
units_remaining = test_bytes;
times_up = 1;
}
-
+
/* grab the current time, and if necessary any starting information
for the gathering of CPU utilization at this end. */
cpu_start(local_cpu_usage);
@@ -3719,7 +3719,7 @@
demo_first_timestamp();
}
#endif
-
+
/* the "OR" here allows us to control test length by either
byte/transaction count or by timer. when the test is
byte/transaction count based the time test will always evaluate
@@ -3727,28 +3727,28 @@
count will always evaluate to false. when the test is finished
the whole expression will go false and we will stop sending
data. at least that is the plan :) raj 2008-01-08 */
-
+
while ((!times_up) || (units_remaining > 0)) {
/* we need to be careful about when we snap a timestamp
depending on the test parameters. this one *should* cover
everything but the burst request/response test - famous last
words of course. raj 20110111 */
-
+
if (keep_histogram) {
HIST_timestamp_start(time_hist);
}
-
-
+
+
again:
if (need_socket) {
- if (connection_test)
+ if (connection_test)
pick_next_port_number(local_res,remote_res);
data_socket = omni_create_data_socket(local_res);
-
+
if (data_socket == INVALID_SOCKET) {
perror("netperf: send_omni: unable to create data socket");
exit(1);
@@ -3847,7 +3847,7 @@
if (keep_histogram) {
HIST_timestamp_start(time_hist);
- }
+ }
}
#endif /* WANT_FIRST_BURST */
@@ -3983,7 +3983,7 @@
#endif
}
-
+
/* if this is a connection test, we want to do some stuff about
connection close here in the test loop. raj 2008-01-08 */
if (connection_test) {
@@ -4015,7 +4015,7 @@
call, the value will be real or -1. if this is a connection
test we want to do this here because later we won't be
connected and the data may no longer be available. */
- if (transport_mss == -2)
+ if (transport_mss == -2)
get_transport_info(data_socket,
&transport_mss,
local_res->ai_protocol);
@@ -4049,7 +4049,7 @@
if (keep_histogram) {
HIST_timestamp_stop_add(time_hist);
}
-
+
#ifdef WANT_DEMO
if (NETPERF_IS_RR(direction)) {
demo_interval_tick(1);
@@ -4067,27 +4067,27 @@
#endif /* WANT_INTERVALS */
- /* was this a "transaction" test? */
+ /* was this a "transaction" test? */
if (NETPERF_IS_RR(direction)) {
trans_completed++;
if (units_remaining) {
units_remaining--;
}
}
-
-
+
+
}
/* we are now, ostensibly, at the end of this iteration */
- if (transport_mss == -2)
+ if (transport_mss == -2)
get_transport_info(data_socket,
&transport_mss,
local_res->ai_protocol);
local_transport_retrans = get_transport_retrans(data_socket,
local_res->ai_protocol);
-
+
find_security_info(&local_security_enabled_num,
&local_security_type_id,
&local_security_specific);
@@ -4152,7 +4152,7 @@
will also store-away the necessaries for cpu utilization */
cpu_stop(local_cpu_usage,&elapsed_time);
-
+
/* if this is a legacy test, there is not much point to finding
all these things since they will not be emitted. */
if (!legacy) {
@@ -4168,7 +4168,7 @@
(desired_output_groups & OMNI_WANT_LOC_DRVINFO) ||
(desired_output_groups & OMNI_WANT_LOC_IFSLOT) ||
(desired_output_groups & OMNI_WANT_LOC_IFIDS)) {
- local_interface_name =
+ local_interface_name =
find_egress_interface(local_res->ai_addr,remote_res->ai_addr);
}
else {
@@ -4230,7 +4230,7 @@
/* Get the statistics from the remote end. The remote will have
calculated service demand and all those interesting things. If
it wasn't supposed to care, it will return obvious values. */
-
+
recv_response_n(OMNI_RESULTS_CONV_CUTOFF);
if (!netperf_response.content.serv_errno) {
if (debug)
@@ -4295,7 +4295,7 @@
netperf_response.content.serv_errno);
perror("");
fflush(where);
-
+
exit(-1);
}
}
@@ -4309,7 +4309,7 @@
/* so, what was the end result? */
local_cpu_method = format_cpu_method(cpu_method);
- if (local_send_calls > 0)
+ if (local_send_calls > 0)
bytes_per_send = (double) bytes_sent / (double) local_send_calls;
else bytes_per_send = 0.0;
@@ -4317,7 +4317,7 @@
bytes_per_recv = (double) bytes_received / (double) local_receive_calls;
else
bytes_per_recv = 0.0;
-
+
bytes_xferd = (double) bytes_sent + bytes_received;
/* if the output format is 'x' we know the test was
@@ -4332,7 +4332,7 @@
thruput = calc_thruput((double)trans_completed);
else if (NETPERF_RECV_ONLY(direction))
thruput = calc_thruput(bytes_xferd);
- else
+ else
thruput = calc_thruput(remote_bytes_xferd);
if (NETPERF_IS_RR(direction)) {
@@ -4356,9 +4356,9 @@
whether or not the user was asking for thruput to be in 'x'
units please... however... a connection_test only ever has
one transaction in flight at one time */
- rtt_latency =
- (((double)1.0/(trans_completed/rtt_elapsed_time)) *
- (double)1000000.0) *
+ rtt_latency =
+ (((double)1.0/(trans_completed/rtt_elapsed_time)) *
+ (double)1000000.0) *
(double) (1 + ((first_burst_size > 0) ? first_burst_size : 0));
}
else {
@@ -4381,7 +4381,7 @@
whether or not the user asked for something specific - as in
per KB even on a TCP_RR test if it is being (ab)used as a
bidirectional bulk-transfer test. raj 2008-01-14 */
- local_service_demand =
+ local_service_demand =
calc_service_demand_fmt(('x' == libfmt) ? (double)trans_completed: bytes_xferd,
0.0,
0.0,
@@ -4396,7 +4396,7 @@
remote_cpu_utilization = omni_result->cpu_util;
- remote_service_demand =
+ remote_service_demand =
calc_service_demand_fmt(('x' == libfmt) ? (double) trans_completed: bytes_xferd,
0.0,
remote_cpu_utilization,
@@ -4406,7 +4406,7 @@
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
-
+
/* time to calculate our confidence */
calculate_confidence(confidence_iteration,
elapsed_time,
@@ -4447,7 +4447,7 @@
if ('x' == libfmt) sd_str = "usec/Tran";
else sd_str = "usec/KB";
-
+
if (iteration_max > 1) {
result_confid_pct = get_result_confid();
loc_cpu_confid_pct = get_loc_cpu_confid();
@@ -4488,7 +4488,7 @@
print_omni();
}
-#if defined(DEBUG_OMNI_OUTPUT)
+#if defined(DEBUG_OMNI_OUTPUT)
{
/* just something quick to sanity check the output selectors. this
should be gone for "production" :) */
@@ -4507,7 +4507,7 @@
#ifdef WANT_HISTOGRAM
fprintf(where,"\nHistogram of ");
- if (NETPERF_RECV_ONLY(direction))
+ if (NETPERF_RECV_ONLY(direction))
fprintf(where,"recv");
if (NETPERF_XMIT_ONLY(direction))
fprintf(where,"send");
@@ -4530,7 +4530,7 @@
#endif /* WANT_HISTOGRAM */
}
-
+
}
void
@@ -4547,7 +4547,7 @@
{
inet_ntop(family, addr, hostname, BUFSIZ);
-
+
sprintf(portstr, "%u", port);
}
@@ -4580,18 +4580,18 @@
int connected;
int ret;
uint32_t temp_recvs;
-
+
struct omni_request_struct *omni_request;
struct omni_response_struct *omni_response;
struct omni_results_struct *omni_results;
-
- omni_request =
+
+ omni_request =
(struct omni_request_struct *)netperf_request.content.test_specific_data;
- omni_response =
+ omni_response =
(struct omni_response_struct *)netperf_response.content.test_specific_data;
- omni_results =
+ omni_results =
(struct omni_results_struct *)netperf_response.content.test_specific_data;
-
+
if (debug) {
fprintf(where,"netserver: recv_omni: entered...\n");
fflush(where);
@@ -4615,16 +4615,16 @@
fprintf(where,"recv_omni: setting the response type...\n");
fflush(where);
}
-
+
netperf_response.content.response_type = OMNI_RESPONSE;
-
+
if (debug) {
fprintf(where,"recv_omni: the response type is set...\n");
fflush(where);
}
/* Grab a socket to listen on, and then listen on it. */
-
+
if (debug) {
fprintf(where,"recv_omni: grabbing a socket...\n");
fflush(where);
@@ -4694,7 +4694,7 @@
0);
s_listen = omni_create_data_socket(local_res);
-
+
if (s_listen == INVALID_SOCKET) {
netperf_response.content.serv_errno = errno;
send_response();
@@ -4707,7 +4707,7 @@
/* We now alter the message_ptr variables to be at the desired */
/* alignments with the desired offsets. */
-
+
if (debug) {
fprintf(where,
"recv_omni: requested recv alignment of %d offset %d\n"
@@ -4757,7 +4757,7 @@
bytes_to_send,
omni_request->send_alignment,
omni_request->send_offset);
-
+
omni_response->send_width = send_width;
omni_response->send_size = bytes_to_send;
}
@@ -4792,14 +4792,14 @@
recv_width = (lsr_size/bytes_to_recv) + 1;
if (recv_width == 1) recv_width++;
}
- else
+ else
recv_width = omni_request->recv_width;
}
recv_ring = allocate_buffer_ring(recv_width,
bytes_to_recv,
omni_request->recv_alignment,
omni_request->recv_offset);
-
+
omni_response->receive_size = bytes_to_recv;
omni_response->recv_width = recv_width;
}
@@ -4812,7 +4812,7 @@
#endif
need_to_accept = (omni_request->protocol != IPPROTO_UDP);
-
+
/* we need to hang a listen for everything that needs at least one
accept */
if (need_to_accept) {
@@ -4842,7 +4842,7 @@
}
exit(-1);
}
-
+
/* Now myaddr_in contains the port and the internet address this is
returned to the sender also implicitly telling the sender that
the socket buffer sizing has been done. likely as not, the IP
@@ -4850,8 +4850,8 @@
the port number. since send_response is going to call htonl on
all the fields, we want to initially put the port number in there
in host order. */
-
- omni_response->data_port =
+
+ omni_response->data_port =
(int) ntohs(((struct sockaddr_in *)&myaddr_in)->sin_port);
if (debug) {
fprintf(where,"telling the remote to call me at %d\n",
@@ -4859,21 +4859,21 @@
fflush(where);
}
netperf_response.content.serv_errno = 0;
-
+
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a 0.0 to */
/* the initiator. */
-
+
omni_response->cpu_rate = (float)0.0; /* assume no cpu */
omni_response->flags &= ~OMNI_MEASURE_CPU;
if (omni_request->flags & OMNI_MEASURE_CPU) {
omni_response->flags |= OMNI_MEASURE_CPU;
- omni_response->cpu_rate =
+ omni_response->cpu_rate =
calibrate_local_cpu(omni_request->cpu_rate);
}
-
+
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
omni_response->send_buf_size = lss_size;
@@ -4916,7 +4916,7 @@
/* Now it's time to start receiving data on the connection. We will */
/* first grab the apropriate counters and then start grabbing. */
-
+
cpu_start(omni_request->flags & OMNI_MEASURE_CPU);
/* if the test is timed, set a timer of suitable length. if the
@@ -4929,7 +4929,7 @@
times_up = 0;
units_remaining = 0;
/* if we are the sender and only sending, then we don't need/want
- the padding, otherwise, we need the padding */
+ the padding, otherwise, we need the padding */
if (!(NETPERF_XMIT_ONLY(omni_request->direction)))
pad_time = PAD_TIME;
start_timer(omni_request->test_length + pad_time);
@@ -4942,8 +4942,8 @@
#if defined(WANT_INTERVALS)
INTERVALS_INIT();
#endif /* WANT_INTERVALS */
-
-
+
+
trans_completed = 0;
bytes_sent = 0;
bytes_received = 0;
@@ -4954,7 +4954,7 @@
if (need_to_accept) {
/* accept a connection from the remote */
#ifdef WIN32
- /* The test timer will probably fire during this accept,
+ /* The test timer will probably fire during this accept,
so to make the start_timer above work we have to move
it to close s_listen while we are blocked on accept. */
win_kludge_socket = s_listen;
@@ -4973,10 +4973,10 @@
fprintf(where,"recv_omni: accept: errno = %d\n",errno);
fflush(where);
close(s_listen);
-
+
exit(-1);
}
-
+
if (debug) {
fprintf(where,"recv_omni: accepted data connection.\n");
fflush(where);
@@ -4988,11 +4988,11 @@
/* this is for those systems which *INCORRECTLY* fail to pass
attributes across an accept() call. Including this goes
against my better judgement :( raj 11/95 */
-
+
kludge_socket_options(data_socket);
#endif /* KLUDGE_SOCKET_OPTIONS */
-
+
}
else {
/* I wonder if duping would be better here? we also need to set
@@ -5015,7 +5015,7 @@
other connection-oriented test will always have us making an
accept() call raj 2008-01-11 */
}
-
+
#ifdef WIN32
/* this is used so the timer thread can close the socket out from
under us, which to date is the easiest/cleanest/least
@@ -5254,7 +5254,7 @@
}
/* send the results to the sender */
-
+
omni_results->send_calls = (uint32_t) local_send_calls;
omni_results->bytes_received_lo = bytes_received & 0x00000000FFFFFFFFULL;
omni_results->bytes_received_hi = (bytes_received & 0xFFFFFFFF00000000ULL) >> 32;
@@ -5277,7 +5277,7 @@
(omni_request->flags & OMNI_WANT_IFSLOT) ||
(omni_request->flags & OMNI_WANT_IFIDS) ||
(omni_request->flags & OMNI_WANT_DRVINFO)) {
- local_interface_name =
+ local_interface_name =
find_egress_interface(local_res->ai_addr,(struct sockaddr *)&peeraddr_in);
strncpy(omni_results->ifname,local_interface_name,16);
omni_results->ifname[15] = 0;
@@ -5326,41 +5326,41 @@
"recv_omni: test complete, sending results.\n");
fflush(where);
}
-
+
send_response_n(OMNI_RESULTS_CONV_CUTOFF);
}
#ifdef WANT_MIGRATION
-void
+void
send_tcp_stream(char remote_host[])
{
-
+
char *tput_title = "\
Recv Send Send \n\
Socket Socket Message Elapsed \n\
Size Size Size Time Throughput \n\
bytes bytes bytes secs. %s/sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f %s\n";
-
+
char *tput_fmt_1 =
"%6d %6d %6d %-6.2f %7.2f %s\n";
-
+
char *cpu_title = "\
Recv Send Send Utilization Service Demand\n\
Socket Socket Message Elapsed Send Recv Send Recv\n\
Size Size Size Time Throughput local remote local remote\n\
bytes bytes bytes secs. %-8.8s/s %% %c %% %c us/KB us/KB\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f %c %s\n";
char *cpu_fmt_1 =
"%6d %6d %6d %-6.2f %7.2f %-6.2f %-6.2f %-6.3f %-6.3f %s\n";
-
+
char *ksink_fmt = "\n\
Alignment Offset %-8.8s %-8.8s Sends %-8.8s Recvs\n\
Local Remote Local Remote Xfered Per Per\n\
@@ -5396,7 +5396,7 @@
}
if (local_cpu_usage || remote_cpu_usage) {
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -5404,7 +5404,7 @@
cpu_fmt_0,
local_service_demand,
local_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
else {
@@ -5412,7 +5412,7 @@
cpu_fmt_0,
remote_service_demand,
remote_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
break;
@@ -5425,7 +5425,7 @@
local_cpu_method,
remote_cpu_method);
}
-
+
fprintf(where,
cpu_fmt_1, /* the format string */
rsr_size, /* remote recvbuf size */
@@ -5437,20 +5437,20 @@
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand, /* remote service demand */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
}
else {
/* The tester did not wish to measure service demand. */
-
+
switch (verbosity) {
case 0:
fprintf(where,
tput_fmt_0,
thruput,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
case 1:
@@ -5465,27 +5465,27 @@
send_size, /* how large were the sends */
elapsed_time, /* how long did it take */
thruput, /* how fast did it go */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
if (verbosity > 1) {
/* The user wanted to know it all, so we will give it to him. */
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
/* this stuff needs to be worked-out in the presence of confidence */
/* intervals and multiple iterations of the test... raj 11/94 */
-
+
fprintf(where,
ksink_fmt,
"Bytes",
@@ -5509,11 +5509,11 @@
#endif /* WANT_HISTOGRAM */
fflush(where);
}
-
+
}
}
-void
+void
send_tcp_maerts(char remote_host[])
{
@@ -5522,25 +5522,25 @@
Socket Socket Message Elapsed \n\
Size Size Size Time Throughput \n\
bytes bytes bytes secs. %s/sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f %s\n";
-
+
char *tput_fmt_1 =
"%6d %6d %6d %-6.2f %7.2f %s\n";
-
+
char *cpu_title = "\
Recv Send Send Utilization Service Demand\n\
Socket Socket Message Elapsed Recv Send Recv Send\n\
Size Size Size Time Throughput local remote local remote\n\
bytes bytes bytes secs. %-8.8s/s %% %c %% %c us/KB us/KB\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f %c %s\n";
char *cpu_fmt_1 =
"%6d %6d %6d %-6.2f %7.2f %-6.2f %-6.2f %-6.3f %-6.3f %s\n";
-
+
char *ksink_fmt = "\n\
Alignment Offset %-8.8s %-8.8s Recvs %-8.8s Sends\n\
Local Remote Local Remote Xfered Per Per\n\
@@ -5576,7 +5576,7 @@
}
if (local_cpu_usage || remote_cpu_usage) {
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -5584,7 +5584,7 @@
cpu_fmt_0,
local_service_demand,
local_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
else {
@@ -5592,7 +5592,7 @@
cpu_fmt_0,
remote_service_demand,
remote_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
break;
@@ -5605,7 +5605,7 @@
local_cpu_method,
remote_cpu_method);
}
-
+
fprintf(where,
cpu_fmt_1, /* the format string */
rsr_size, /* remote recvbuf size */
@@ -5617,20 +5617,20 @@
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand, /* remote service demand */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
}
else {
/* The tester did not wish to measure service demand. */
-
+
switch (verbosity) {
case 0:
fprintf(where,
tput_fmt_0,
thruput,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
case 1:
@@ -5645,27 +5645,27 @@
remote_send_size, /* how large were the recvs */
elapsed_time, /* how long did it take */
thruput, /* how fast did it go */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
if (verbosity > 1) {
/* The user wanted to know it all, so we will give it to him. */
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
/* this stuff needs to be worked-out in the presence of confidence */
/* intervals and multiple iterations of the test... raj 11/94 */
-
+
fprintf(where,
ksink_fmt,
"Bytes",
@@ -5711,12 +5711,12 @@
char *tput_fmt_0 =
"%7.2f %s\n";
-
+
char *tput_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %7.2f %s\n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *cpu_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem\n\
@@ -5734,16 +5734,16 @@
Socket Size Request Resp. Elapsed Latency CPU CPU S.dem S.dem\n\
Send Recv Size Size Time usecs local remote local remote\n\
bytes bytes bytes bytes secs. per tran %% %c %% %c us/Tr us/Tr\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f %c %s\n";
-
+
char *cpu_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f %s\n";
-
+
char *cpu_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *ksink_fmt = "\
Alignment Offset RoundTrip Trans Throughput\n\
Local Remote Local Remote Latency Rate %-8.8s/s\n\
@@ -5770,7 +5770,7 @@
}
if (local_cpu_usage || remote_cpu_usage) {
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -5778,7 +5778,7 @@
cpu_fmt_0,
local_service_demand,
local_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
else {
@@ -5786,7 +5786,7 @@
cpu_fmt_0,
remote_service_demand,
remote_cpu_method,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
}
break;
@@ -5805,7 +5805,7 @@
format_units(),
local_cpu_method,
remote_cpu_method);
- }
+ }
}
fprintf(where,
@@ -5820,7 +5820,7 @@
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand, /* remote service demand */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
fprintf(where,
cpu_fmt_1_line_2,
@@ -5831,13 +5831,13 @@
}
else {
/* The tester did not wish to measure service demand. */
-
+
switch (verbosity) {
case 0:
fprintf(where,
tput_fmt_0,
thruput,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
case 1:
@@ -5864,23 +5864,23 @@
1.0 s to get it converted to [kmg]bits/s or
[KMG]Bytes/s */
thruput,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
fprintf(where,
tput_fmt_1_line_2,
rss_size, /* remote recvbuf size */
rsr_size);
-
+
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
/* how to handle the verbose information in the presence of */
/* confidence intervals is yet to be determined... raj 11/94 */
if (verbosity > 1) {
@@ -5912,7 +5912,7 @@
outstanding at any one time. otherwise we will
underreport the latency of individual
transactions. learned from saf by raj 2007-06-08 */
- (((double)1.0/transaction_rate)*(double)1000000.0) *
+ (((double)1.0/transaction_rate)*(double)1000000.0) *
(double) (1 + ((first_burst_size > 0) ? first_burst_size : 0)),
transaction_rate,
calc_thruput_interval_omni(transaction_rate * (double)req_size,
@@ -5926,50 +5926,50 @@
#endif /* WANT_HISTOGRAM */
fflush(where);
}
- }
+ }
}
void
send_tcp_conn_rr(char remote_host[])
{
-
+
char *tput_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans.\n\
Send Recv Size Size Time Rate \n\
bytes Bytes bytes bytes secs. per sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f\n";
-
+
char *tput_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %7.2f \n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *cpu_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem\n\
Send Recv Size Size Time Rate local remote local remote\n\
bytes bytes bytes bytes secs. per sec %% %% us/Tr us/Tr\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f\n";
-
+
char *cpu_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f\n";
-
+
char *cpu_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *ksink_fmt = "\n\
Alignment Offset\n\
Local Remote Local Remote\n\
Send Recv Send Recv\n\
%5d %5d %5d %5d\n";
- send_omni_inner(remote_host,
+ send_omni_inner(remote_host,
legacy,
"MIGRATED TCP Connect/Request/Response TEST");
@@ -5991,7 +5991,7 @@
}
if (local_cpu_usage || remote_cpu_usage) {
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -6037,7 +6037,7 @@
}
else {
/* The tester did not wish to measure service demand. */
-
+
switch (verbosity) {
case 0:
fprintf(where,
@@ -6062,17 +6062,17 @@
tput_fmt_1_line_2,
rss_size, /* remote recvbuf size */
rsr_size);
-
+
break;
}
}
-
+
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
/* how to handle the verbose information in the presence of */
/* confidence intervals is yet to be determined... raj 11/94 */
if (verbosity > 1) {
@@ -6080,7 +6080,7 @@
/* This information will include as much as we can find about */
/* TCP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
fprintf(where,
ksink_fmt,
local_send_align,
@@ -6110,23 +6110,23 @@
Socket Message Elapsed Messages \n\
Size Size Time Okay Errors Throughput\n\
bytes bytes secs # # %s/sec\n\n";
-
+
char *tput_fmt_0 =
"%7.2f\n";
-
+
char *tput_fmt_1 = "\
%6d %6d %-7.2f %7"PRIu64" %6d %7.2f\n\
%6d %-7.2f %7"PRIu64" %7.2f\n\n";
-
-
+
+
char *cpu_title = "\
Socket Message Elapsed Messages CPU Service\n\
Size Size Time Okay Errors Throughput Util Demand\n\
bytes bytes secs # # %s/sec %% %c%c us/KB\n\n";
-
+
char *cpu_fmt_0 =
"%6.2f %c\n";
-
+
char *cpu_fmt_1 = "\
%6d %6d %-7.2f %7"PRIu64" %6d %7.1f %-6.2f %-6.3f\n\
%6d %-7.2f %7"PRIu64" %7.1f %-6.2f %-6.3f\n\n";
@@ -6143,8 +6143,8 @@
1, we will display a veritable plethora of background
information from outside of this block as it it not
cpu_measurement specific... */
-
-
+
+
if (confidence < 0) {
/* we did not hit confidence, but were we asked to look for it? */
if (iteration_max > 1) {
@@ -6153,7 +6153,7 @@
}
if (local_cpu_usage || remote_cpu_usage) {
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -6240,7 +6240,7 @@
void
send_udp_rr(char remote_host[])
{
-
+
char *tput_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans.\n\
@@ -6252,16 +6252,16 @@
Socket Size Request Resp. Elapsed \n\
Send Recv Size Size Time Throughput \n\
bytes Bytes bytes bytes secs. %s/sec \n\n";
-
+
char *tput_fmt_0 =
"%7.2f %s\n";
-
+
char *tput_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %7.2f %s\n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
-
+
char *cpu_title = "\
Local /Remote\n\
Socket Size Request Resp. Elapsed Trans. CPU CPU S.dem S.dem\n\
@@ -6273,13 +6273,13 @@
Socket Size Request Resp. Elapsed Tput CPU CPU S.dem S.dem\n\
Send Recv Size Size Time %-8.8s local remote local remote\n\
bytes bytes bytes bytes secs. per sec %% %c %% %c us/KB us/KB\n\n";
-
+
char *cpu_fmt_0 =
"%6.3f %c %s\n";
-
+
char *cpu_fmt_1_line_1 = "\
%-6d %-6d %-6d %-6d %-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f %s\n";
-
+
char *cpu_fmt_1_line_2 = "\
%-6d %-6d\n";
@@ -6294,16 +6294,16 @@
1, we will display a veritable plethora of background
information from outside of this block as it it not
cpu_measurement specific... */
-
+
if (confidence < 0) {
/* we did not hit confidence, but were we asked to look for it? */
if (iteration_max > 1) {
display_confidence();
}
}
-
+
if (local_cpu_usage || remote_cpu_usage) {
-
+
switch (verbosity) {
case 0:
if (local_cpu_usage) {
@@ -6342,7 +6342,7 @@
remote_cpu_method);
}
}
-
+
fprintf(where,
cpu_fmt_1_line_1, /* the format string */
lss_size, /* local sendbuf size */
@@ -6355,7 +6355,7 @@
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand, /* remote service demand */
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
fprintf(where,
cpu_fmt_1_line_2,
@@ -6371,7 +6371,7 @@
fprintf(where,
tput_fmt_0,
thruput,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
break;
case 1:
@@ -6381,7 +6381,7 @@
('x' == libfmt) ? tput_title : tput_title_band,
format_units());
}
-
+
fprintf(where,
tput_fmt_1_line_1, /* the format string */
lss_size,
@@ -6390,13 +6390,13 @@
rsp_size, /* how large were the responses */
elapsed_time, /* how long did it take */
thruput,
- ((print_headers) ||
+ ((print_headers) ||
(result_brand == NULL)) ? "" : result_brand);
fprintf(where,
tput_fmt_1_line_2,
rss_size, /* remote recvbuf size */
rsr_size);
-
+
break;
}
}
@@ -6406,7 +6406,7 @@
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
-
+
/* how to handle the verbose information in the presence of */
/* confidence intervals is yet to be determined... raj 11/94 */
@@ -6415,7 +6415,7 @@
/* This information will include as much as we can find about */
/* UDP statistics, the alignments of the sends and receives */
/* and all that sort of rot... */
-
+
#ifdef WANT_HISTOGRAM
fprintf(where,"\nHistogram of request/reponse times.\n");
HIST_report(time_hist);
@@ -6430,7 +6430,7 @@
/* using legacy test names will cause certain default settings to be
- made before we scan the test-specific arguments. raj 2010-07-20 */
+ made before we scan the test-specific arguments. raj 2010-07-20 */
static void
set_omni_defaults_by_legacy_testname() {
@@ -6539,7 +6539,7 @@
value, specifying a value with a leading comma will set just the second\n\
parm, a value with a trailing comma will set just the first. To set\n\
each parm to unique values, specify both and separate them with a\n\
-comma.\n";
+comma.\n";
void
print_omni_usage()
@@ -6559,12 +6559,12 @@
#define OMNI_ARGS "b:cCd:DG:hH:kK:l:L:m:M:nNoOp:P:r:R:s:S:t:T:u:Vw:W:46"
extern char *optarg; /* pointer to option string */
-
+
int c;
int have_uuid = 0;
int have_R_option = 0;
- char
+ char
arg1[BUFSIZ], /* argument holders */
arg2[BUFSIZ],
arg3[BUFSIZ];
@@ -6590,10 +6590,10 @@
set both to that value. Specifying only the second will leave the
first untouched. To change only the first, use the form "first,"
(see the routine break_args.. */
-
+
while ((c= getopt(argc, argv, OMNI_ARGS)) != EOF) {
switch (c) {
- case '?':
+ case '?':
case '4':
remote_data_family = AF_INET;
local_data_family = AF_INET;
@@ -6628,7 +6628,7 @@
/* set TCP_CORK */
loc_tcpcork = 1;
rem_tcpcork = 1; /* however, at first, we ony have cork affect loc */
-#else
+#else
printf("WARNING: TCP_CORK not available on this platform!\n");
#endif /* TCP_CORK */
break;
@@ -6657,7 +6657,7 @@
be arg3. for simplicities sake, we will assume the width
must follow the address and not the address family - ie
1.2.3.4/24,inet. This means we can just pass optarg again
- as the source rather than have to shuffle arg values. */
+ as the source rather than have to shuffle arg values. */
break_args_explicit_sep(optarg,'/',arg1,arg3);
if (arg1[0]) {
remote_data_address = malloc(strlen(arg1)+1);
@@ -6711,7 +6711,7 @@
be arg3. for simplicities sake, we will assume the width
must follow the address and not the address family - ie
1.2.3.4/24,inet. This means we can just pass optarg again
- as the source rather than have to shuffle arg values. */
+ as the source rather than have to shuffle arg values. */
break_args_explicit_sep(optarg,'/',arg1,arg3);
if (arg1[0]) {
local_data_address = malloc(strlen(arg1)+1);
@@ -6733,7 +6733,7 @@
break_args_explicit(optarg,arg1,arg2);
if (arg1[0]) {
send_size = convert(arg1);
- if (implicit_direction)
+ if (implicit_direction)
direction |= NETPERF_XMIT;
}
if (arg2[0]) {
@@ -6816,7 +6816,7 @@
break_args(optarg,arg1,arg2);
if (arg1[0])
client_port_min = atoi(arg1);
- if (arg2[0])
+ if (arg2[0])
client_port_max = atoi(arg2);
break;
case 'P':
@@ -6826,12 +6826,12 @@
break_args(optarg,arg1,arg2);
if (arg1[0])
strncpy(local_data_port,arg1,sizeof(local_data_port));
- if (arg2[0])
+ if (arg2[0])
strncpy(remote_data_port,arg2,sizeof(remote_data_port));
break;
case 'r':
/* set the request/response sizes. setting request/response
- sizes implicitly sets direction to XMIT and RECV */
+ sizes implicitly sets direction to XMIT and RECV */
if (implicit_direction) {
direction |= NETPERF_XMIT;
direction |= NETPERF_RECV;
@@ -6839,7 +6839,7 @@
break_args(optarg,arg1,arg2);
if (arg1[0])
req_size = convert(arg1);
- if (arg2[0])
+ if (arg2[0])
rsp_size = convert(arg2);
break;
case 'R':
@@ -6923,8 +6923,8 @@
enabled, UDP_STREAM/UDP_MAERTS sockets will not allow themselves
to be routed via a gateway. raj 20091026 */
- if ((!have_R_option) &&
- (protocol == IPPROTO_UDP) &&
+ if ((!have_R_option) &&
+ (protocol == IPPROTO_UDP) &&
(!NETPERF_IS_RR(direction)))
routing_allowed = 0;
@@ -7014,7 +7014,7 @@
}
/* so, did the user request a few things implicitly via output selection? */
- if (!legacy)
+ if (!legacy)
print_omni_init();
if (desired_output_groups & OMNI_WANT_STATS) {
Modified: trunk/src/nettest_unix.c
===================================================================
--- trunk/src/nettest_unix.c 2012-01-31 22:19:03 UTC (rev 524)
+++ trunk/src/nettest_unix.c 2012-01-31 22:23:50 UTC (rev 525)
@@ -80,7 +80,7 @@
static char
path_prefix[32];
-static int
+static int
rss_size, /* remote socket send buffer size */
rsr_size, /* remote socket recv buffer size */
lss_size_req, /* requested local socket send buffer size */
@@ -1140,7 +1140,7 @@
rsp_size,
local_recv_align,
local_recv_offset);
-
+
/*set up the data socket */
send_socket = create_unix_socket(AF_UNIX,
SOCK_STREAM);
@@ -1308,7 +1308,7 @@
}
rsp_bytes_left -= rsp_bytes_recvd;
temp_message_ptr += rsp_bytes_recvd;
- }
+ }
recv_ring = recv_ring->next;
if (timed_out) {
@@ -1598,7 +1598,7 @@
printf(cpu_title,format_units());
else
printf(tput_title,format_units());
- }
+ }
failed_sends = 0;
failed_cows = 0;
@@ -1783,7 +1783,7 @@
number of messages to the test. */
/* the test is over, so get stats and stuff */
- cpu_stop(local_cpu_usage,
+ cpu_stop(local_cpu_usage,
&elapsed_time);
/* Get the statistics from the remote end */
@@ -2306,7 +2306,7 @@
exit(1);
}
send_message_ptr = (char *)(( (long)temp_message_ptr +
- (long) local_send_align - 1) &
+ (long) local_send_align - 1) &
~((long) local_send_align - 1));
send_message_ptr = send_message_ptr + local_send_offset;
temp_message_ptr = (char *)malloc(DATABUFFERLEN);
@@ -2315,7 +2315,7 @@
exit(1);
}
recv_message_ptr = (char *)(( (long)temp_message_ptr +
- (long) local_recv_align - 1) &
+ (long) local_recv_align - 1) &
~((long) local_recv_align - 1));
recv_message_ptr = recv_message_ptr + local_recv_offset;
@@ -2332,7 +2332,7 @@
fprintf(where,"send_dg_rr: send_socket obtained...\n");
}
-
+
/* If the user has requested cpu utilization measurements, we must
calibrate the cpu(s). We will perform this task within the tests
themselves. If the user has specified the cpu rate, then
@@ -3273,7 +3273,7 @@
/* we hit the end of the test based on time - lets
bail out of here now... */
fprintf(where,"yo5\n");
- fflush(where);
+ fflush(where);
break;
}
@@ -3290,7 +3290,7 @@
/* the test timer has popped */
timed_out = 1;
fprintf(where,"yo6\n");
- fflush(where);
+ fflush(where);
break;
}
netperf_response.content.serv_errno = 997;
@@ -3369,7 +3369,7 @@
int c;
- char
+ char
arg1[BUFSIZ], /* argument holders */
arg2[BUFSIZ];
@@ -3389,7 +3389,7 @@
while ((c= getopt(argc, argv, UNIX_ARGS)) != EOF) {
switch (c) {
- case '?':
+ case '?':
case 'h':
print_unix_usage();
exit(1);
@@ -3419,7 +3419,7 @@
break_args(optarg,arg1,arg2);
if (arg1[0])
req_size = convert(arg1);
- if (arg2[0])
+ if (arg2[0])
rsp_size = convert(arg2);
break;
case 'm':
More information about the netperf-dev
mailing list