[netperf-dev] netperf2 commit notice r526 - trunk/src
raj at netperf.org
raj at netperf.org
Tue Jan 31 14:27:31 PST 2012
Author: raj
Date: 2012-01-31 14:27:31 -0800 (Tue, 31 Jan 2012)
New Revision: 526
Modified:
trunk/src/netcpu_kstat10.c
trunk/src/netcpu_procstat.c
trunk/src/netlib.c
trunk/src/netsh.c
trunk/src/netsh.h
trunk/src/nettest_bsd.h
Log:
continues a deletion of trailing whitespace kick
Modified: trunk/src/netcpu_kstat10.c
===================================================================
--- trunk/src/netcpu_kstat10.c 2012-01-31 22:23:50 UTC (rev 525)
+++ trunk/src/netcpu_kstat10.c 2012-01-31 22:27:31 UTC (rev 526)
@@ -54,7 +54,7 @@
static cpu_time_counters_t corrected_cpu_counters[MAXCPUS];
static void
-print_cpu_time_counters(char *name, int instance, cpu_time_counters_t *counters)
+print_cpu_time_counters(char *name, int instance, cpu_time_counters_t *counters)
{
fprintf(where,
"%s[%d]:\n"
@@ -70,7 +70,7 @@
}
void
-cpu_util_init(void)
+cpu_util_init(void)
{
kstat_t *ksp;
int i;
@@ -92,7 +92,7 @@
i = 0;
for (ksp = kc->kc_chain, i = 0;
(ksp != NULL) && (i < MAXCPUS);
- ksp = ksp->ks_next) {
+ ksp = ksp->ks_next) {
if ((strcmp(ksp->ks_module,"cpu") == 0) &&
(strcmp(ksp->ks_name,"sys") == 0)) {
if (debug) {
@@ -102,7 +102,7 @@
}
lib_cpu_map[i++] = ksp->ks_instance;
}
- }
+ }
if (MAXCPUS == i) {
fprintf(where,
@@ -193,7 +193,7 @@
}
else if (strstr(knp->name,"nsec")) {
/* finding another nsec here means Sun have changed
- something and we need to warn the user. raj 2005-01-28 */
+ something and we need to warn the user. raj 2005-01-28 */
print_unexpected_statistic_warning("get_cpu_counters",
knp->name,
"nsec");
@@ -334,7 +334,7 @@
/* the kstat10 mechanism, since it is based on actual nanosecond
counters is not going to use a comparison to an idle rate. so, the
calibrate_idle_rate routine will be rather simple :) raj 2005-01-28
- */
+ */
float
calibrate_idle_rate(int iterations, int interval)
@@ -348,7 +348,7 @@
int i;
float correction_factor;
float actual_rate;
-
+
uint64_t total_cpu_nsec;
/* multiply by 100 and divide by total and you get whole
@@ -361,7 +361,7 @@
#define CALC_HUNDREDTH_PERCENT 10000
#define CALC_THOUSANDTH_PERCENT 100000
#define CALC_ACCURACY CALC_THOUSANDTH_PERCENT
-
+
uint64_t fraction_idle;
uint64_t fraction_user;
uint64_t fraction_kernel;
@@ -378,9 +378,9 @@
example, tests that were ended by watchdog timers such as the udp
stream test. We let these tests tell up what the elapsed time
should be. */
-
+
if (elapsed_time != 0.0) {
- correction_factor = (float) 1.0 +
+ correction_factor = (float) 1.0 +
((lib_elapsed - elapsed_time) / elapsed_time);
}
else {
@@ -409,7 +409,7 @@
with the interrupt time and use that to calculate a new idle
percentage and thus a CPU util percentage.
- that is what we will attempt to do here. raj 2005-01-28
+ that is what we will attempt to do here. raj 2005-01-28
of course, we also have to wonder what we should do if there is
more interrupt time than the sum of user, kernel and idle.
@@ -417,7 +417,7 @@
time-being, one that we will blythly ignore, except perhaps for
a quick check. raj 2005-01-31
*/
-
+
/* we ass-u-me that these counters will never wrap during a
netperf run. this may not be a particularly safe thing to
do. raj 2005-01-28 */
@@ -429,13 +429,13 @@
starting_cpu_counters[i].kernel;
delta_cpu_counters[i].interrupt = ending_cpu_counters[i].interrupt -
starting_cpu_counters[i].interrupt;
-
+
if (debug) {
print_cpu_time_counters("delta_cpu_counters",i,delta_cpu_counters);
}
/* for this summation, we do not include interrupt time */
- total_cpu_nsec =
+ total_cpu_nsec =
delta_cpu_counters[i].idle +
delta_cpu_counters[i].user +
delta_cpu_counters[i].kernel;
@@ -461,7 +461,7 @@
i,delta_cpu_counters[i].user,
i,delta_cpu_counters[i].kernel);
fflush(where);
-
+
lib_local_cpu_util = -1.0;
lib_local_per_cpu_util[i] = -1.0;
return -1.0;
@@ -471,25 +471,25 @@
promote things to long doubled but that didn't seem to result
in happiness and joy. raj 2005-01-28 */
- fraction_idle =
+ fraction_idle =
(delta_cpu_counters[i].idle * CALC_ACCURACY) / total_cpu_nsec;
- fraction_user =
+ fraction_user =
(delta_cpu_counters[i].user * CALC_ACCURACY) / total_cpu_nsec;
- fraction_kernel =
+ fraction_kernel =
(delta_cpu_counters[i].kernel * CALC_ACCURACY) / total_cpu_nsec;
/* ok, we have our fractions, now we want to take that fraction of
the interrupt time and subtract that from the bucket. */
- interrupt_idle = ((delta_cpu_counters[i].interrupt * fraction_idle) /
+ interrupt_idle = ((delta_cpu_counters[i].interrupt * fraction_idle) /
CALC_ACCURACY);
- interrupt_user = ((delta_cpu_counters[i].interrupt * fraction_user) /
+ interrupt_user = ((delta_cpu_counters[i].interrupt * fraction_user) /
CALC_ACCURACY);
- interrupt_kernel = ((delta_cpu_counters[i].interrupt * fraction_kernel) /
+ interrupt_kernel = ((delta_cpu_counters[i].interrupt * fraction_kernel) /
CALC_ACCURACY);
if (debug) {
@@ -505,17 +505,17 @@
interrupt_kernel);
}
- corrected_cpu_counters[i].idle = delta_cpu_counters[i].idle -
+ corrected_cpu_counters[i].idle = delta_cpu_counters[i].idle -
interrupt_idle;
- corrected_cpu_counters[i].user = delta_cpu_counters[i].user -
+ corrected_cpu_counters[i].user = delta_cpu_counters[i].user -
interrupt_user;
- corrected_cpu_counters[i].kernel = delta_cpu_counters[i].kernel -
+ corrected_cpu_counters[i].kernel = delta_cpu_counters[i].kernel -
interrupt_kernel;
corrected_cpu_counters[i].interrupt = delta_cpu_counters[i].interrupt;
-
+
if (debug) {
print_cpu_time_counters("corrected_cpu_counters",
i,
@@ -529,7 +529,7 @@
/* ok, now we sum the numbers again, this time including interrupt
*/
- total_cpu_nsec =
+ total_cpu_nsec =
corrected_cpu_counters[i].idle +
corrected_cpu_counters[i].user +
corrected_cpu_counters[i].kernel +
@@ -538,22 +538,22 @@
/* and recalculate our fractions we are really only going to use
fraction_idle, but lets calculate the rest just for the heck of
it. one day we may want to display them. raj 2005-01-28 */
-
+
/* multiply by 100 and divide by total and you get whole
percentages. multiply by 1000 and divide by total and you get
tenths of percentages. multiply by 10000 and divide by total
and you get hundredths of percentages. etc etc etc raj
2005-01-28 */
- fraction_idle =
+ fraction_idle =
(corrected_cpu_counters[i].idle * CALC_ACCURACY) / total_cpu_nsec;
- fraction_user =
+ fraction_user =
(corrected_cpu_counters[i].user * CALC_ACCURACY) / total_cpu_nsec;
- fraction_kernel =
+ fraction_kernel =
(corrected_cpu_counters[i].kernel * CALC_ACCURACY) / total_cpu_nsec;
- fraction_interrupt =
+ fraction_interrupt =
(corrected_cpu_counters[i].interrupt * CALC_ACCURACY) / total_cpu_nsec;
if (debug) {
@@ -564,7 +564,7 @@
}
/* and finally, what is our CPU utilization? */
- lib_local_per_cpu_util[i] = 100.0 - (((float)fraction_idle /
+ lib_local_per_cpu_util[i] = 100.0 - (((float)fraction_idle /
(float)CALC_ACCURACY) * 100.0);
lib_local_per_cpu_util[i] *= correction_factor;
if (debug) {
Modified: trunk/src/netcpu_procstat.c
===================================================================
--- trunk/src/netcpu_procstat.c 2012-01-31 22:23:50 UTC (rev 525)
+++ trunk/src/netcpu_procstat.c 2012-01-31 22:27:31 UTC (rev 526)
@@ -2,7 +2,7 @@
@(#)netcpu_procstat.c (c) Copyright 2005-2011 Version 2.5.0";
/* netcpu_procstat.c
-
+
Implement the /proc/stat specific portions of netperf CPU
utilization measurements. These are broken-out into a separate file
to make life much nicer over in netlib.c which had become a maze of
@@ -54,7 +54,7 @@
uint64_t hard_irq;
uint64_t soft_irq;
uint64_t steal;
- uint64_t guest;
+ uint64_t guest;
} cpu_states_t;
static cpu_states_t lib_start_count[MAXCPUS];
@@ -71,7 +71,7 @@
static int proc_stat_buflen = 0;
void
-cpu_util_init(void)
+cpu_util_init(void)
{
if (debug) {
@@ -230,7 +230,7 @@
if (end >= start || (start & 0xffffffff00000000ULL))
return (end - start);
- /*
+ /*
* We wrapped, and it is likely that the kernel is suppling 32-bit
* counters, because "start" is less than 32-bits wide. If that's
* the case, then handle the wrap by subtracting off everything but
@@ -256,9 +256,9 @@
example, tests that were ended by watchdog timers such as the udp
stream test. We let these tests tell up what the elapsed time
should be. */
-
+
if (elapsed_time != 0.0) {
- correction_factor = (float) 1.0 +
+ correction_factor = (float) 1.0 +
((lib_elapsed - elapsed_time) / elapsed_time);
}
else {
@@ -272,9 +272,9 @@
for (i = 0; i < lib_num_loc_cpus; i++) {
/* Find the difference in all CPU stat fields */
- diff.user =
+ diff.user =
tick_subtract(lib_start_count[i].user, lib_end_count[i].user);
- diff.nice =
+ diff.nice =
tick_subtract(lib_start_count[i].nice, lib_end_count[i].nice);
diff.sys =
tick_subtract(lib_start_count[i].sys, lib_end_count[i].sys);
@@ -290,7 +290,7 @@
tick_subtract(lib_start_count[i].steal, lib_end_count[i].steal);
diff.guest =
tick_subtract(lib_start_count[i].guest, lib_end_count[i].guest);
- total_ticks = diff.user + diff.nice + diff.sys + diff.idle + diff.iowait
+ total_ticks = diff.user + diff.nice + diff.sys + diff.idle + diff.iowait
+ diff.hard_irq + diff.soft_irq + diff.steal + diff.guest;
/* calculate idle time as a percentage of all CPU states */
@@ -300,7 +300,7 @@
}
lib_local_per_cpu_util[i] = 100.0;
} else {
- lib_local_per_cpu_util[i] = 100.0 *
+ lib_local_per_cpu_util[i] = 100.0 *
((float) diff.idle / (float) total_ticks);
}
/* invert percentage to reflect non-idle time */
@@ -329,7 +329,7 @@
}
/* we want the average across all n processors */
lib_local_cpu_util /= (float)lib_num_loc_cpus;
-
+
return lib_local_cpu_util;
}
Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c 2012-01-31 22:23:50 UTC (rev 525)
+++ trunk/src/netlib.c 2012-01-31 22:27:31 UTC (rev 526)
@@ -136,7 +136,7 @@
#include <sys/pri.h>
#define PRIORITY PRI_LOW
#else/* _AIX */
-#ifdef __sgi
+#ifdef __sgi
#include <sys/prctl.h>
#include <sys/schedctl.h>
#define PRIORITY NDPLOMIN
@@ -191,7 +191,7 @@
process-level looper process. we also now require support for the
"long" integer type. raj 4/95. */
-int
+int
lib_num_loc_cpus, /* the number of cpus in the system */
lib_num_rem_cpus; /* how many we think are in the remote */
@@ -222,7 +222,7 @@
int *response_array;
/* INVALID_SOCKET == INVALID_HANDLE_VALUE == (unsigned int)(~0) == -1 */
-SOCKET netlib_control = INVALID_SOCKET;
+SOCKET netlib_control = INVALID_SOCKET;
SOCKET server_sock = INVALID_SOCKET;
int control_family = AF_UNSPEC;
@@ -261,7 +261,7 @@
FILE *where;
char libfmt = '?';
-
+
#ifdef WIN32
HANDLE hAlarm = INVALID_HANDLE_VALUE;
#endif
@@ -293,7 +293,7 @@
bytes. this should be more than enough to be sure that there is
no page or cache thrashing by looper processes on MP
systems. otherwise that's really just too bad - such systems
- should define _SC_PAGE_SIZE - raj 4/95 */
+ should define _SC_PAGE_SIZE - raj 4/95 */
#ifndef _SC_PAGE_SIZE
#ifdef WIN32
@@ -327,11 +327,11 @@
struct itimerval old_interval;
new_interval.it_interval.tv_sec = 0;
- new_interval.it_interval.tv_usec = 0;
+ new_interval.it_interval.tv_usec = 0;
new_interval.it_value.tv_sec = 0;
- new_interval.it_value.tv_usec = 0;
+ new_interval.it_value.tv_usec = 0;
if (setitimer(ITIMER_REAL,&new_interval,&old_interval) != 0) {
- /* there was a problem arming the interval timer */
+ /* there was a problem arming the interval timer */
perror("netperf: setitimer");
exit(1);
}
@@ -357,11 +357,11 @@
{
static char *place = EMSG; /* option letter processing */
register char *oli; /* option letter list index */
-
+
if (!*place) {
/* update scanning pointer */
if (optind >= argc || *(place = argv[optind]) != '-' || !*++place) {
- return EOF;
+ return EOF;
}
if (*place == '-') {
/* found "--" */
@@ -370,7 +370,7 @@
return EOF;
}
}
-
+
/* option letter okay? */
if ((optopt = (int)*place++) == (int)':'
|| !(oli = strchr(ostr, optopt))) {
@@ -380,7 +380,7 @@
error("illegal option");
return BADCH;
}
- if (*++oli != ':') {
+ if (*++oli != ':') {
/* don't need argument */
optarg = NULL;
if (!*place)
@@ -421,11 +421,11 @@
dwError = GetLastError();
dwResult = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY,
- NULL,
- dwError,
- LANG_NEUTRAL,
- (LPTSTR)&szTemp,
- 0,
+ NULL,
+ dwError,
+ LANG_NEUTRAL,
+ (LPTSTR)&szTemp,
+ 0,
NULL );
if (dwResult)
@@ -468,7 +468,7 @@
char *
-inet_ttos(int type)
+inet_ttos(int type)
{
switch (type) {
case SOCK_DGRAM:
@@ -529,10 +529,10 @@
#ifndef AF_INET_SDP
#define AF_INET_SDP 27
#define PF_INET_SDP AF_INET_SDP
-#endif
+#endif
char *
-inet_ftos(int family)
+inet_ftos(int family)
{
switch(family) {
case AF_INET:
@@ -555,7 +555,7 @@
}
int
-inet_nton(int af, const void *src, char *dst, int cnt)
+inet_nton(int af, const void *src, char *dst, int cnt)
{
@@ -624,7 +624,7 @@
the way they belong before we swap */
conv_rec.words[0] = htonl(conv_rec.words[0]);
conv_rec.words[1] = htonl(conv_rec.words[1]);
-
+
/* now swap */
for (i=0; i<= 3; i++) {
scratch = conv_rec.bytes[i];
@@ -642,7 +642,7 @@
#endif
return(conv_rec.whole_thing);
-
+
}
double
@@ -674,7 +674,7 @@
conv_rec.bytes[i] = conv_rec.bytes[7-i];
conv_rec.bytes[7-i] = scratch;
}
-
+
#if defined(__FLOAT_WORD_ORDER) && defined(__BYTE_ORDER)
if (__FLOAT_WORD_ORDER != __BYTE_ORDER) {
/* Fixup mixed endian floating point machines */
@@ -689,9 +689,9 @@
this happens, the proper order will go out on the network */
conv_rec.words[0] = htonl(conv_rec.words[0]);
conv_rec.words[1] = htonl(conv_rec.words[1]);
-
+
return(conv_rec.whole_thing);
-
+
}
@@ -750,7 +750,7 @@
fflush(where);
exit(-1);
}
-
+
for (i = 0; i < 4; i ++){
addr[i] = ntohl(addr[i]);
len = mask_len - i * 32;
@@ -780,7 +780,7 @@
{
/* on HP-UX, even when we use the looper procs we need the pstat */
- /* call */
+ /* call */
int temp_cpus;
@@ -789,7 +789,7 @@
struct pst_dynamic psd;
- if (pstat_getdynamic((struct pst_dynamic *)&psd,
+ if (pstat_getdynamic((struct pst_dynamic *)&psd,
(size_t)sizeof(psd), (size_t)1, 0) != -1) {
temp_cpus = psd.psd_proc_cnt;
}
@@ -812,7 +812,7 @@
#ifdef WIN32
SYSTEM_INFO SystemInfo;
GetSystemInfo(&SystemInfo);
-
+
temp_cpus = SystemInfo.dwNumberOfProcessors;
#else
/* we need to know some other ways to do this, or just fall-back on
@@ -833,9 +833,9 @@
}
return(temp_cpus);
-
-}
+}
+
#ifdef WIN32
#ifdef __GNUC__
#define S64_SUFFIX(x) x##LL
@@ -886,7 +886,7 @@
}
-
+
/************************************************************************/
/* */
@@ -895,12 +895,12 @@
/************************************************************************/
void
-#if defined(__hpux)
+#if defined(__hpux)
catcher(sig, code, scp)
int sig;
int code;
struct sigcontext *scp;
-#else
+#else
catcher(int sig)
#endif /* __hpux || __VMS */
{
@@ -920,11 +920,11 @@
#endif /* RAJ_DEBUG */
switch(sig) {
-
+
case SIGINT:
times_up = 1;
break;
- case SIGALRM:
+ case SIGALRM:
if (--test_len_ticks == 0) {
/* the test is over */
if (times_up != 0) {
@@ -964,7 +964,7 @@
"catcher: interval timer running unexpectedly!\n");
fflush(where);
times_up = 1;
-#endif /* WANT_INTERVALS */
+#endif /* WANT_INTERVALS */
break;
}
}
@@ -1015,7 +1015,7 @@
}
#else
return;
-#endif /* WIN32 */
+#endif /* WIN32 */
}
@@ -1026,27 +1026,27 @@
{
DWORD ErrorCode;
DWORD HandlesClosedFlags = 0;
-
+
/* Wait on this event for parm seconds. */
-
+
ErrorCode = WaitForSingleObject(hAlarm, seconds*1000);
if (ErrorCode == WAIT_FAILED)
{
perror("WaitForSingleObject failed");
exit(1);
}
-
+
if (ErrorCode == WAIT_TIMEOUT)
{
/* WaitForSingleObject timed out; this means the timer
wasn't canceled. */
-
+
times_up = 1;
-
+
/* Give the other threads time to notice that times_up has
changed state before taking the harsh step of closing the
sockets. */
-
+
if (WaitForSingleObject(hAlarm, PAD_TIME/2*1000) ==
WAIT_TIMEOUT) {
/* We have yet to find a good way to fully emulate
@@ -1056,7 +1056,7 @@
It is rather kludgy, but should be sufficient to
get this puppy shipped. The concept can be
attributed/blamed :) on Robin raj 1/96 */
-
+
if (win_kludge_socket != INVALID_SOCKET) {
HandlesClosedFlags |= 1;
closesocket(win_kludge_socket);
@@ -1088,11 +1088,11 @@
DWORD thread_id ;
HANDLE tHandle;
-
+
if (hAlarm == (HANDLE) INVALID_HANDLE_VALUE)
{
/* Create the Alarm event object */
- hAlarm = CreateEvent(
+ hAlarm = CreateEvent(
(LPSECURITY_ATTRIBUTES) NULL, /* no security */
FALSE, /* auto reset event */
FALSE, /* init. state = reset */
@@ -1107,16 +1107,16 @@
{
ResetEvent(hAlarm);
}
-
-
+
+
tHandle = CreateThread(0,
0,
(LPTHREAD_START_ROUTINE)emulate_alarm,
(LPVOID)(ULONG_PTR)time,
- 0,
+ 0,
&thread_id ) ;
CloseHandle(tHandle);
-
+
#else /* not WIN32 */
struct sigaction action;
@@ -1157,7 +1157,7 @@
exit(-1);
}
- /* this is the easy case - just set the timer for so many seconds */
+ /* this is the easy case - just set the timer for so many seconds */
ret = alarm(time);
if (ret != 0) {
fprintf(where,
@@ -1171,7 +1171,7 @@
test_len_ticks = 1;
-}
+}
@@ -1196,7 +1196,7 @@
running "long" it would be necessary to keep this in mind when
calculating the number of itimer events */
- ticks_per_itvl = ((interval_wate * sysconf(_SC_CLK_TCK) * 1000) /
+ ticks_per_itvl = ((interval_wate * sysconf(_SC_CLK_TCK) * 1000) /
1000000);
if (ticks_per_itvl == 0) ticks_per_itvl = 1;
@@ -1227,11 +1227,11 @@
signal catcher raj 2/95 */
new_interval.it_interval.tv_sec = usec_per_itvl / 1000000;
- new_interval.it_interval.tv_usec = usec_per_itvl % 1000000;
+ new_interval.it_interval.tv_usec = usec_per_itvl % 1000000;
new_interval.it_value.tv_sec = usec_per_itvl / 1000000;
- new_interval.it_value.tv_usec = usec_per_itvl % 1000000;
+ new_interval.it_value.tv_usec = usec_per_itvl % 1000000;
if (setitimer(ITIMER_REAL,&new_interval,&old_interval) != 0) {
- /* there was a problem arming the interval timer */
+ /* there was a problem arming the interval timer */
perror("netperf: setitimer");
exit(1);
}
@@ -1493,12 +1493,12 @@
}
#ifndef WIN32
- temp_link->buffer_ptr = (char *)(( (long)(temp_link->buffer_base) +
- (long)alignment - 1) &
+ temp_link->buffer_ptr = (char *)(( (long)(temp_link->buffer_base) +
+ (long)alignment - 1) &
~((long)alignment - 1));
#else
- temp_link->buffer_ptr = (char *)(( (ULONG_PTR)(temp_link->buffer_base) +
- (ULONG_PTR)alignment - 1) &
+ temp_link->buffer_ptr = (char *)(( (ULONG_PTR)(temp_link->buffer_base) +
+ (ULONG_PTR)alignment - 1) &
~((ULONG_PTR)alignment - 1));
#endif
temp_link->buffer_ptr += offset;
@@ -1561,7 +1561,7 @@
limit = temp_buffer + length;
dirty_totals = 0;
- for (i = 0;
+ for (i = 0;
((i < dirty_count) && (temp_buffer < limit));
i++) {
*temp_buffer += (char)i;
@@ -1569,7 +1569,7 @@
temp_buffer++;
}
- for (i = 0;
+ for (i = 0;
((i < clean_count) && (temp_buffer < limit));
i++) {
dirty_totals += *temp_buffer;
@@ -1749,7 +1749,7 @@
struct sendfile_ring_elt *first_link = NULL;
struct sendfile_ring_elt *temp_link = NULL;
struct sendfile_ring_elt *prev_link;
-
+
int i;
int fildes;
struct stat statbuf;
@@ -1761,7 +1761,7 @@
/* use an temp file for the fill file */
char temp_file[] = {"netperfXXXXXX\0"};
int *temp_buffer;
-
+
/* make sure we have at least an ints worth, even if the user is
using an insane buffer size for a sendfile test. we are
ass-u-me-ing that malloc will return something at least aligned
@@ -1836,7 +1836,7 @@
exit(1);
}
}
-
+
/* so, at this point we know that fildes is a descriptor which
references a file of sufficient size for our nefarious
porpoises. raj 2007-08-09 */
@@ -1881,7 +1881,7 @@
}
/* close the ring */
first_link->next = temp_link;
-
+
return(first_link); /* it's a dummy ring */
}
@@ -1952,8 +1952,8 @@
/*
- format_number()
-
+ format_number()
+
return a pointer to a formatted string containing the value passed
translated into the units specified. It assumes that the base units
are bytes. If the format calls for bits, it will use SI units (10^)
@@ -1967,13 +1967,13 @@
elsewhere such as in the TCP_RR-as-bidirectional test case.
*/
-
+
char *
format_number(double number)
{
static char fmtbuf[64];
-
+
switch (libfmt) {
case 'K':
snprintf(fmtbuf, sizeof(fmtbuf), "%-7.2f" , number / 1024.0);
@@ -2054,7 +2054,7 @@
default:
method_char = '?';
}
-
+
return method_char;
}
@@ -2063,7 +2063,7 @@
format_units()
{
static char unitbuf[64];
-
+
switch (libfmt) {
case 'K':
strcpy(unitbuf, "KBytes");
@@ -2086,11 +2086,11 @@
case 'x':
strcpy(unitbuf, "Trans");
break;
-
+
default:
strcpy(unitbuf, "KBytes");
}
-
+
return unitbuf;
}
@@ -2102,7 +2102,7 @@
/* tear-down the control connection between me and the server. */
/****************************************************************/
-void
+void
shutdown_control()
{
@@ -2159,7 +2159,7 @@
}
-/*
+/*
bind_to_specific_processor will bind the calling process to the
processor in "processor" It has lots of ugly ifdefs to deal with
all the different ways systems do processor affinity. this is a
@@ -2217,7 +2217,7 @@
#define NETPERF_CPU_SETSIZE __CPU_SETSIZE
#if defined(__CPU_SET_S)
#define NETPERF_CPU_SET(cpu, cpusetp) __CPU_SET_S(cpu, sizeof (cpu_set_t), cpusetp)
-#define NETPERF_CPU_ZERO(cpusetp) __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)
+#define NETPERF_CPU_ZERO(cpusetp) __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)
#else
#define NETPERF_CPU_SET(cpu, cpusetp) __CPU_SET(cpu, cpusetp)
#define NETPERF_CPU_ZERO(cpusetp) __CPU_ZERO (cpusetp)
@@ -2236,7 +2236,7 @@
if (mapped_affinity < 8*sizeof(netperf_cpu_set)) {
NETPERF_CPU_ZERO(&netperf_cpu_set);
NETPERF_CPU_SET(mapped_affinity,&netperf_cpu_set);
-
+
if (sched_setaffinity(getpid(), len, &netperf_cpu_set)) {
if (debug) {
fprintf(stderr, "failed to set PID %d's CPU affinity errno %d\n",
@@ -2252,7 +2252,7 @@
fflush(stderr);
}
}
-
+
#elif HAVE_BIND_TO_CPU_ID
/* this is the one for Tru64 */
#include <sys/types.h>
@@ -2260,7 +2260,7 @@
#include <sys/processor.h>
/* really should be checking a return code one of these days. raj
- 2005/08/31 */
+ 2005/08/31 */
bind_to_cpu_id(getpid(), mapped_affinity,0);
@@ -2270,26 +2270,26 @@
ULONG_PTR AffinityMask;
ULONG_PTR ProcessAffinityMask;
ULONG_PTR SystemAffinityMask;
-
- if ((mapped_affinity < 0) ||
+
+ if ((mapped_affinity < 0) ||
(mapped_affinity > MAXIMUM_PROCESSORS)) {
fprintf(where,
"Invalid processor_affinity specified: %d\n", mapped_affinity); fflush(where);
return;
}
-
+
if (!GetProcessAffinityMask(
- GetCurrentProcess(),
- &ProcessAffinityMask,
+ GetCurrentProcess(),
+ &ProcessAffinityMask,
&SystemAffinityMask))
{
perror("GetProcessAffinityMask failed");
fflush(stderr);
exit(1);
}
-
+
AffinityMask = (ULONG_PTR)1 << mapped_affinity;
-
+
if (AffinityMask & ProcessAffinityMask) {
if (!SetThreadAffinityMask( GetCurrentThread(), AffinityMask)) {
perror("SetThreadAffinityMask failed");
@@ -2352,10 +2352,10 @@
}
count = sizeof(netperf_request)/4;
}
-
+
/* display the contents of the request if the debug level is high
enough. otherwise, just send the darned thing ;-) */
-
+
if (debug > 1) {
fprintf(where,
"entered send_request_n...contents before %d htonls:\n",
@@ -2374,12 +2374,12 @@
arbitrarily rather than trying to figure-out just how much of the
request array contains real information. this should be simpler,
and at any rate, the performance of sending control messages for
- this benchmark is not of any real concern. */
-
+ this benchmark is not of any real concern. */
+
for (counter = 0;counter < count; counter++) {
request_array[counter] = htonl(request_array[counter]);
}
-
+
if (debug > 1) {
fprintf(where,"send_request_n...contents after %d htonls:\n",
count);
@@ -2397,7 +2397,7 @@
sizeof(netperf_request),
0) != sizeof(netperf_request)) {
perror("send_request: send call failure");
-
+
exit(1);
}
}
@@ -2417,7 +2417,7 @@
void
send_request()
{
-
+
/* pass the processor affinity request value to netserver this is a
kludge and I know it. sgb 8/11/04 */
@@ -2470,11 +2470,11 @@
request array contains real information. this should be simpler,
and at any rate, the performance of sending control messages for
this benchmark is not of any real concern. */
-
+
for (counter = 0; counter < count; counter++) {
response_array[counter] = htonl(response_array[counter]);
}
-
+
if (debug > 1) {
fprintf(where,
"send_response_n: contents after htonl\n");
@@ -2495,7 +2495,7 @@
fprintf(where, "BytesSent: %d\n", bytes_sent);
exit(1);
}
-
+
}
/***********************************************************************/
@@ -2521,7 +2521,7 @@
/* go back and "undo" the ntohl that recv_request() did, starting with
the specified point and going to the end of the request array */
void
-fixup_request_n(int n)
+fixup_request_n(int n)
{
int i;
int limit;
@@ -2541,7 +2541,7 @@
recv_request_timed_n(int n, int seconds)
{
int tot_bytes_recvd,
- bytes_recvd,
+ bytes_recvd,
bytes_left;
char *buf = (char *)&netperf_request;
int buflen = sizeof(netperf_request);
@@ -2568,7 +2568,7 @@
each time to preclude someone with nefarious intent from just
dribbling data to us piecemeal. of course, who knows what
someone with nefarious intent might come-up with. raj 2012-01-23 */
- tot_bytes_recvd = 0;
+ tot_bytes_recvd = 0;
bytes_recvd = 0; /* nt_lint; bytes_recvd uninitialized if buflen == 0 */
bytes_left = buflen;
timeout.tv_sec = seconds;
@@ -2597,9 +2597,9 @@
}
} while ((tot_bytes_recvd != buflen) &&
(bytes_recvd > 0 ));
-
+
/* put the request into host order */
-
+
for (counter = 0; counter < count; counter++) {
request_array[counter] = ntohl(request_array[counter]);
}
@@ -2618,7 +2618,7 @@
close(server_sock);
return -1;
}
-
+
if (bytes_recvd == 0) {
/* the remote has shutdown the control connection, we should shut
it down as well and return */
@@ -2627,7 +2627,7 @@
"recv_request: remote requested shutdown of control\n");
fflush(where);
}
-
+
close(server_sock);
return 0;
}
@@ -2635,7 +2635,7 @@
if (tot_bytes_recvd < buflen) {
if (debug > 1)
dump_request();
-
+
fprintf(where,
"recv_request: partial request received of %d bytes\n",
tot_bytes_recvd);
@@ -2646,16 +2646,16 @@
if (debug > 1) {
dump_request();
- }
+ }
/* get the processor affinity request value from netperf this is a
kludge and I know it. sgb 8/11/04 */
-
+
local_proc_affinity = netperf_request.content.dummy;
-
+
if (local_proc_affinity != -1) {
bind_to_specific_processor(local_proc_affinity,0);
- }
+ }
return buflen;
}
@@ -2697,19 +2697,19 @@
recv_response_timed_n(int addl_time, int n)
{
int tot_bytes_recvd,
- bytes_recvd = 0,
+ bytes_recvd = 0,
bytes_left;
char *buf = (char *)&netperf_response;
int buflen = sizeof(netperf_response);
int counter,count;
-
+
/* stuff for select, use fd_set for better compliance */
fd_set readfds;
struct timeval timeout;
-
- tot_bytes_recvd = 0;
+
+ tot_bytes_recvd = 0;
bytes_left = buflen;
-
+
if (n < 0) count = sizeof(netperf_request)/4;
else count = 2 + n;
@@ -2725,18 +2725,18 @@
}
/* zero out the response structure */
-
+
/* BUG FIX SJB 2/4/93 - should be < not <= */
- for (counter = 0;
+ for (counter = 0;
counter < sizeof(netperf_response)/sizeof(int);
counter++) {
response_array[counter] = 0;
}
-
+
/* we only select once. it is assumed that if the response is split
(which should not be happening, that we will receive the whole
thing and not have a problem ;-) */
-
+
FD_ZERO(&readfds);
FD_SET(netlib_control,&readfds);
timeout.tv_sec = 120 + addl_time; /* wait at least two minutes
@@ -2748,7 +2748,7 @@
triggered by fix from Jeff
Dwork. */
timeout.tv_usec = 0;
-
+
/* select had better return one, or there was either a problem or a */
/* timeout... */
@@ -2763,26 +2763,26 @@
counter);
exit(1);
}
-
+
while ((tot_bytes_recvd != buflen) &&
((bytes_recvd = recv(netlib_control, buf, bytes_left,0)) > 0 )) {
tot_bytes_recvd += bytes_recvd;
buf += bytes_recvd;
bytes_left -= bytes_recvd;
}
-
+
if (debug) {
fprintf(where,"recv_response: received a %d byte response\n",
tot_bytes_recvd);
fflush(where);
}
-
+
/* put the desired quantity of the response into host order */
-
+
for (counter = 0; counter < count; counter++) {
response_array[counter] = ntohl(response_array[counter]);
}
-
+
if (bytes_recvd == SOCKET_ERROR) {
perror("recv_response");
exit(1);
@@ -2803,14 +2803,14 @@
/*
- recv_response_timed()
-
+ recv_response_timed()
+
receive the remote's response on the control socket. we will put the
entire response into host order before giving it to the calling
routine. hopefully, this will go most of the way to insuring
intervendor interoperability. if there are any problems, we will
just punt the entire situation.
-
+
The call to select at the beginning is to get us out of hang
situations where the remote gives-up but we don't find-out about
it. This seems to happen only rarely, but it would be nice to be
@@ -2841,7 +2841,7 @@
}
void
-recv_response()
+recv_response()
{
/* 0 => no additional time, -1 => convert all test-specific data */
recv_response_timed_n(0,-1);
@@ -2853,7 +2853,7 @@
recv_response_timed_n(0,n);
}
-void
+void
get_remote_system_info()
{
char delim[2];
@@ -2890,7 +2890,7 @@
remote_machine = strdup("UnknownRemoteMachine");
remote_version = strdup("UnknownRemoteVersion");
}
-
+
}
@@ -3141,7 +3141,7 @@
(iirc) that we might get a mixed-mode connection would be if the
address family is specified as AF_UNSPEC, and getaddrinfo() returns
different families for the local and server names.
-
+
the "names" can also be IP addresses in ASCII string form.
raj 2003-02-27 */
@@ -3373,7 +3373,7 @@
GetVersion() & 0xFF ,
GetVersion() & 0xFF00 ,
SystemInfo.dwProcessorType
-
+
#else
"%-15s%-15s%-15s%-15s%-15s",
system_name.sysname,
@@ -3435,25 +3435,25 @@
{
char *remote_id="";
-
+
/* send a request for node info to the remote */
netperf_request.content.request_type = NODE_IDENTIFY;
-
+
send_request();
-
+
/* and now wait for the reply to come back */
-
+
recv_response();
-
+
if (netperf_response.content.serv_errno) {
Set_errno(netperf_response.content.serv_errno);
perror("identify_remote: on remote");
exit(1);
}
-
+
fprintf(where,"Remote Information \n\
Sysname Nodename Release Version Machine\n");
-
+
fprintf(where,"%s",
remote_id);
}
@@ -3464,7 +3464,7 @@
gettimeofday(&time1,
&tz);
-
+
if (measure_cpu) {
cpu_util_init();
measuring_cpu = 1;
@@ -3486,21 +3486,21 @@
cpu_stop_internal();
cpu_util_terminate();
}
-
+
gettimeofday(&time2,
&tz);
-
+
if (time2.tv_usec < time1.tv_usec) {
time2.tv_usec += 1000000;
time2.tv_sec -= 1;
}
-
+
sec = time2.tv_sec - time1.tv_sec;
usec = time2.tv_usec - time1.tv_usec;
lib_elapsed = (float)sec + ((float)usec/(float)1000000.0);
-
+
*elapsed = lib_elapsed;
-
+
}
@@ -3533,11 +3533,11 @@
case 'x':
divisor = 1.0;
break;
-
+
default:
divisor = 1024.0;
}
-
+
return (units_received / divisor / elapsed);
}
@@ -3591,7 +3591,7 @@
fflush(where);
divisor = 1024.0;
}
-
+
return (units_received / divisor / elapsed);
}
@@ -3607,7 +3607,7 @@
-float
+float
calc_cpu_util(float elapsed_time)
{
float temp_util;
@@ -3625,7 +3625,7 @@
return temp_util;
}
-float
+float
calc_service_demand_internal(double unit_divisor,
double units_sent,
float elapsed_time,
@@ -3651,16 +3651,16 @@
}
if (num_cpus == 0) num_cpus = lib_num_loc_cpus;
-
+
if (elapsed_time == 0.0) {
elapsed_time = lib_elapsed;
}
if (cpu_utilization == 0.0) {
cpu_utilization = lib_local_cpu_util;
}
-
- thruput = (units_sent /
- (double) unit_divisor /
+
+ thruput = (units_sent /
+ (double) unit_divisor /
(double) elapsed_time);
/* on MP systems, it is necessary to multiply the service demand by
@@ -3672,10 +3672,10 @@
millisecond, so we multiply cpu_utilization by 10 to go to
milliseconds, or 10,000 to go to micro seconds. With revision
2.1, the service demand measure goes to microseconds per unit.
- raj 12/95 */
- service_demand = (cpu_utilization*10000.0/thruput) *
+ raj 12/95 */
+ service_demand = (cpu_utilization*10000.0/thruput) *
(float) num_cpus;
-
+
if (debug) {
fprintf(where,
"calc_service_demand using: units_sent = %f\n"
@@ -3735,7 +3735,7 @@
float
calibrate_local_cpu(float local_cpu_rate)
{
-
+
lib_num_loc_cpus = get_num_cpus();
lib_use_idle = 0;
@@ -3797,7 +3797,7 @@
sizeof(lib_num_rem_cpus));
/* remrate = (float) netperf_response.content.test_specific_data[0]; */
return(remrate);
- }
+ }
}
@@ -3841,7 +3841,7 @@
double demo_units = 0.0; /* what is our current best guess as
to how many work units must be
done to be near the desired
- reporting interval? */
+ reporting interval? */
double units_this_tick;
#endif
@@ -3865,7 +3865,7 @@
static struct timeval *demo_one_ptr = &demo_one;
static struct timeval *demo_two_ptr = &demo_two;
static struct timeval *temp_demo_ptr = &demo_one;
-#endif
+#endif
void demo_first_timestamp() {
HIST_timestamp(demo_one_ptr);
@@ -3898,16 +3898,16 @@
static int count = 0;
struct timeval now;
units_this_tick += units;
- if (units_this_tick >= demo_units) {
- /* time to possibly update demo_units and maybe output an
- interim result */
- HIST_timestamp(demo_two_ptr);
- actual_interval = delta_micro(demo_one_ptr,demo_two_ptr);
+ if (units_this_tick >= demo_units) {
+ /* time to possibly update demo_units and maybe output an
+ interim result */
+ HIST_timestamp(demo_two_ptr);
+ actual_interval = delta_micro(demo_one_ptr,demo_two_ptr);
/* we always want to fine-tune demo_units here whether we emit
an interim result or not. if we are short, this will
lengthen demo_units. if we are long, this will shorten it */
demo_units = demo_units * (demo_interval / actual_interval);
- if (actual_interval >= demo_interval) {
+ if (actual_interval >= demo_interval) {
/* time to emit an interim result, giving the current time to
the millisecond for compatability with RRD */
gettimeofday(&now,NULL);
@@ -3956,16 +3956,16 @@
fflush(where);
exit(-1);
}
- fflush(where);
- units_this_tick = 0.0;
+ fflush(where);
+ units_this_tick = 0.0;
/* now get a new starting timestamp. we could be clever
- and swap pointers - the math we do probably does not
- take all that long, but for now this will suffice */
- temp_demo_ptr = demo_one_ptr;
- demo_one_ptr = demo_two_ptr;
- demo_two_ptr = temp_demo_ptr;
- }
- }
+ and swap pointers - the math we do probably does not
+ take all that long, but for now this will suffice */
+ temp_demo_ptr = demo_one_ptr;
+ demo_one_ptr = demo_two_ptr;
+ demo_two_ptr = temp_demo_ptr;
+ }
+ }
}
}
@@ -3984,12 +3984,12 @@
demo_interval_tick(units);
}
-#endif
+#endif
/* hist.c
Given a time difference in microseconds, increment one of 61
- different buckets:
+ different buckets:
0 - 9 in increments of 1 usec
0 - 9 in increments of 10 usecs
@@ -4000,12 +4000,12 @@
1 - 9 in increments of 1 sec
1 - 9 in increments of 10 sec
> 100 secs
-
+
This will allow any time to be recorded to within an accuracy of
10%, and provides a compact representation for capturing the
distribution of a large number of time differences (e.g.
request-response latencies).
-
+
Colin Low 10/6/93
Rick Jones 2004-06-15 extend to unit and ten usecs
*/
@@ -4025,7 +4025,7 @@
/* we never want to have a full queue, so will trade a little space
for that. one day we may still have to check for a full queue */
- h->limit = max_outstanding + 1;
+ h->limit = max_outstanding + 1;
/* now allocate the time_ones based on h->limit */
#ifdef HAVE_GETHRTIME
@@ -4033,27 +4033,27 @@
#elif HAVE_GET_HRT
h->time_ones = (hrt_t *) malloc(h->limit * sizeof(hrt_t));
#elif defined(WIN32)
- h->time_ones = (LARGE_INTEGER *) malloc(h->limit *
+ h->time_ones = (LARGE_INTEGER *) malloc(h->limit *
sizeof(LARGE_INTEGER));
#else
- h->time_ones = (struct timeval *) malloc(h->limit *
+ h->time_ones = (struct timeval *) malloc(h->limit *
sizeof(struct timeval));
#endif /* HAVE_GETHRTIME */
if (h->time_ones == NULL) {
perror("HIST_new_n - time_ones malloc failed");
exit(1);
}
-
+
return h;
}
-
-HIST
+
+HIST
HIST_new(void){
return HIST_new_n(0);
}
-void
+void
HIST_clear(HIST h){
int i;
for(i = 0; i < HIST_NUM_OF_BUCKET; i++){
@@ -4086,7 +4086,7 @@
h->consumer = 0;
}
-void
+void
HIST_add(register HIST h, int time_delta){
register float val;
register int base = HIST_NUM_OF_BUCKET / 10;
@@ -4146,7 +4146,7 @@
}
}
-void
+void
output_row(FILE *fd, char *title, int *row){
register int i;
register int j;
@@ -4171,7 +4171,7 @@
return(sum);
}
-void
+void
HIST_report(HIST h){
#ifndef OLD_HISTOGRAM
output_row(stdout, "UNIT_USEC ", h->unit_usec);
@@ -4332,7 +4332,7 @@
LARGE_INTEGER DeltaTimestamp;
static LARGE_INTEGER TickHz = {{0,0}};
- if (TickHz.QuadPart == 0)
+ if (TickHz.QuadPart == 0)
{
QueryPerformanceFrequency(&TickHz);
}
@@ -4341,9 +4341,9 @@
good enough? Spencer: Yes, that should be more than good
enough for histogram support */
- DeltaTimestamp.QuadPart = (end->QuadPart - begin->QuadPart) *
+ DeltaTimestamp.QuadPart = (end->QuadPart - begin->QuadPart) *
1000000/TickHz.QuadPart;
- assert((DeltaTimestamp.HighPart == 0) &&
+ assert((DeltaTimestamp.HighPart == 0) &&
((int)DeltaTimestamp.LowPart >= 0));
return (int)DeltaTimestamp.LowPart;
@@ -4439,26 +4439,26 @@
code */
int confidence_iterations; /* for iterations */
-double
+double
result_confid=-10.0,
loc_cpu_confid=-10.0,
rem_cpu_confid=-10.0,
- measured_sum_result=0.0,
+ measured_sum_result=0.0,
measured_square_sum_result=0.0,
- measured_mean_result=0.0,
- measured_var_result=0.0,
+ measured_mean_result=0.0,
+ measured_var_result=0.0,
measured_sum_local_cpu=0.0,
measured_square_sum_local_cpu=0.0,
measured_mean_local_cpu=0.0,
- measured_var_local_cpu=0.0,
+ measured_var_local_cpu=0.0,
measured_sum_remote_cpu=0.0,
measured_square_sum_remote_cpu=0.0,
measured_mean_remote_cpu=0.0,
- measured_var_remote_cpu=0.0,
-
+ measured_var_remote_cpu=0.0,
+
measured_sum_local_service_demand=0.0,
measured_square_sum_local_service_demand=0.0,
measured_mean_local_service_demand=0.0,
@@ -4474,8 +4474,8 @@
measured_mean_local_time=0.0,
measured_var_local_time=0.0,
- measured_mean_remote_time=0.0,
-
+ measured_mean_remote_time=0.0,
+
measured_fails,
measured_local_results,
confidence=-10.0;
@@ -4486,7 +4486,7 @@
/* Constants for Confidence Intervals */
/* */
/************************************************************************/
-void
+void
init_stat()
{
measured_sum_result=0.0;
@@ -4529,7 +4529,7 @@
/* this routine does a simple table lookup for some statistical
function that I would remember if I stayed awake in my probstats
class... raj 11/94 */
-double
+double
confid(int level, int freedom)
{
double t99[35],t95[35];
@@ -4564,7 +4564,7 @@
t95[28]= 2.048;
t95[29]= 2.045;
t95[30]= 2.042;
-
+
t99[1]=63.657;
t99[2]= 9.925;
t99[3]= 5.841;
@@ -4595,7 +4595,7 @@
t99[28]= 2.763;
t99[29]= 2.756;
t99[30]= 2.750;
-
+
if(level==95){
return(t95[freedom]);
} else if(level==99){
@@ -4631,35 +4631,35 @@
}
/* the test time */
- measured_sum_local_time +=
+ measured_sum_local_time +=
(double) time;
- measured_square_sum_local_time +=
+ measured_square_sum_local_time +=
(double) time*time;
- measured_mean_local_time =
+ measured_mean_local_time =
(double) measured_sum_local_time/confidence_iterations;
- measured_var_local_time =
+ measured_var_local_time =
(double) measured_square_sum_local_time/confidence_iterations
-measured_mean_local_time*measured_mean_local_time;
-
+
/* the test result */
- measured_sum_result +=
+ measured_sum_result +=
(double) result;
- measured_square_sum_result +=
+ measured_square_sum_result +=
(double) result*result;
- measured_mean_result =
+ measured_mean_result =
(double) measured_sum_result/confidence_iterations;
- measured_var_result =
+ measured_var_result =
(double) measured_square_sum_result/confidence_iterations
-measured_mean_result*measured_mean_result;
/* local cpu utilization */
- measured_sum_local_cpu +=
+ measured_sum_local_cpu +=
(double) loc_cpu;
- measured_square_sum_local_cpu +=
+ measured_square_sum_local_cpu +=
(double) loc_cpu*loc_cpu;
- measured_mean_local_cpu =
+ measured_mean_local_cpu =
(double) measured_sum_local_cpu/confidence_iterations;
- measured_var_local_cpu =
+ measured_var_local_cpu =
(double) measured_square_sum_local_cpu/confidence_iterations
-measured_mean_local_cpu*measured_mean_local_cpu;
@@ -4668,9 +4668,9 @@
(double) rem_cpu;
measured_square_sum_remote_cpu+=
(double) rem_cpu*rem_cpu;
- measured_mean_remote_cpu =
+ measured_mean_remote_cpu =
(double) measured_sum_remote_cpu/confidence_iterations;
- measured_var_remote_cpu =
+ measured_var_remote_cpu =
(double) measured_square_sum_remote_cpu/confidence_iterations
-measured_mean_remote_cpu*measured_mean_remote_cpu;
@@ -4679,9 +4679,9 @@
(double) loc_sd;
measured_square_sum_local_service_demand+=
(double) loc_sd*loc_sd;
- measured_mean_local_service_demand =
+ measured_mean_local_service_demand =
(double) measured_sum_local_service_demand/confidence_iterations;
- measured_var_local_service_demand =
+ measured_var_local_service_demand =
(double) measured_square_sum_local_service_demand/confidence_iterations
-measured_mean_local_service_demand*measured_mean_local_service_demand;
@@ -4690,26 +4690,26 @@
(double) rem_sd;
measured_square_sum_remote_service_demand+=
(double) rem_sd*rem_sd;
- measured_mean_remote_service_demand =
+ measured_mean_remote_service_demand =
(double) measured_sum_remote_service_demand/confidence_iterations;
- measured_var_remote_service_demand =
+ measured_var_remote_service_demand =
(double) measured_square_sum_remote_service_demand/confidence_iterations
-measured_mean_remote_service_demand*measured_mean_remote_service_demand;
- if(confidence_iterations>1){
- result_confid= (double) interval -
- 2.0 * confid(confidence_level,confidence_iterations-1)*
- sqrt(measured_var_result/(confidence_iterations-1.0)) /
+ if(confidence_iterations>1){
+ result_confid= (double) interval -
+ 2.0 * confid(confidence_level,confidence_iterations-1)*
+ sqrt(measured_var_result/(confidence_iterations-1.0)) /
measured_mean_result;
- loc_cpu_confid= (double) interval -
- 2.0 * confid(confidence_level,confidence_iterations-1)*
- sqrt(measured_var_local_cpu/(confidence_iterations-1.0)) /
+ loc_cpu_confid= (double) interval -
+ 2.0 * confid(confidence_level,confidence_iterations-1)*
+ sqrt(measured_var_local_cpu/(confidence_iterations-1.0)) /
measured_mean_local_cpu;
- rem_cpu_confid= (double) interval -
+ rem_cpu_confid= (double) interval -
2.0 * confid(confidence_level,confidence_iterations-1)*
- sqrt(measured_var_remote_cpu/(confidence_iterations-1.0)) /
+ sqrt(measured_var_remote_cpu/(confidence_iterations-1.0)) /
measured_mean_remote_cpu;
if(debug){
Modified: trunk/src/netsh.c
===================================================================
--- trunk/src/netsh.c 2012-01-31 22:23:50 UTC (rev 525)
+++ trunk/src/netsh.c 2012-01-31 22:27:31 UTC (rev 526)
@@ -134,7 +134,7 @@
local_cpu_usage = 0, /* you guessed it */
remote_cpu_usage = 0; /* still right ! */
-float
+float
local_cpu_rate = 0.0F,
remote_cpu_rate = 0.0F;
@@ -144,7 +144,7 @@
/* the end-test conditions for the tests - either transactions, bytes,
or time. different vars used for clarity - space is cheap ;-) */
-int
+int
test_time = 10, /* test ends by time */
test_len_ticks, /* how many times will the timer go off before the
test is over? */
@@ -296,7 +296,7 @@
"* For these options taking two parms, specifying one value with no comma\n\
will only set the first parms and will leave the second at the default\n\
value. To set the second value it must be preceded with a comma or be a\n\
-comma-separated pair. This is to retain previous netperf behaviour.\n";
+comma-separated pair. This is to retain previous netperf behaviour.\n";
/* This routine will return the two arguments to the calling routine.
@@ -353,7 +353,7 @@
/* break_args_explicit - now just a wrapper around a call to
break_args_explicit_sep passing-in a ',' as the separator. raj
- 20101129 */
+ 20101129 */
void
break_args_explicit(char *s, char *arg1, char *arg2)
@@ -487,7 +487,7 @@
}
int
-parse_protocol(char protocol_string[])
+parse_protocol(char protocol_string[])
{
char temp[10];
@@ -499,7 +499,7 @@
temp,
protocol_string);
}
-
+
#ifdef IPPROTO_TCP
if (!strcasecmp(temp,"tcp")){
socket_type = SOCK_STREAM;
@@ -556,7 +556,7 @@
/* convert the specified string to upper case if we know how */
static void
-convert_to_upper(char *source)
+convert_to_upper(char *source)
{
#if defined(HAVE_TOUPPER)
int i,length;
@@ -581,10 +581,10 @@
char *p;
int c;
-
+
char arg1[BUFSIZ], /* argument holders */
arg2[BUFSIZ];
-
+
program = (char *)malloc(strlen(argv[0]) + 1);
if (program == NULL) {
printf("malloc() to store program name failed!\n");
@@ -619,10 +619,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, GLOBAL_CMD_LINE_ARGS)) != EOF) {
switch (c) {
- case '?':
+ case '?':
case 'h':
print_netperf_usage();
exit(1);
@@ -680,11 +680,11 @@
demo_units = convert(arg2);
}
}
-#else
+#else
printf("Sorry, Demo Mode not configured into this netperf.\n"
"Please consider reconfiguring netperf with\n"
"--enable-demo=yes and recompiling\n");
-#endif
+#endif
break;
case 'f':
/* set the thruput formatting */
@@ -741,7 +741,7 @@
/* make sure that iteration_min and iteration_max are at least
at a reasonable default value. if a -i option has previously
been parsed, these will no longer be 1, so we can check
- against 1 */
+ against 1 */
if (iteration_min == 1) iteration_min = 3;
if (iteration_max == 1) iteration_max = 10;
/* make sure that the interval is set if it isn't at its default
@@ -797,7 +797,7 @@
case 'O':
/* set the remote offsets */
break_args(optarg,arg1,arg2);
- if (arg1[0])
+ if (arg1[0])
remote_send_offset = convert(arg1);
if (arg2[0])
remote_recv_offset = convert(arg2);
@@ -819,7 +819,7 @@
break;
case 's':
/* the user wishes us to sleep/pause some length of time before
- actually starting the test */
+ actually starting the test */
wait_time_secs = convert(optarg);
break;
case 't':
@@ -843,9 +843,9 @@
break;
case 'W':
/* set the "width" of the user space data buffer ring. This will
- be the number of send_size buffers malloc'd in the tests */
+ be the number of send_size buffers malloc'd in the tests */
break_args(optarg,arg1,arg2);
- if (arg1[0])
+ if (arg1[0])
send_width = convert(arg1);
if (arg2[0])
recv_width = convert(arg2);
@@ -917,7 +917,7 @@
case 'H':
/* save-off the host identifying information, use
break_args_explicit since passing just one value should not
- set both */
+ set both */
break_args_explicit(optarg,arg1,arg2);
if (arg1[0])
strncpy(host_name,arg1,sizeof(host_name));
@@ -1048,7 +1048,7 @@
address_family);
exit(-1);
}
- break;
+ break;
#if defined(AF_INET6)
case AF_INET6:
strcpy(host_name,"::1");
@@ -1149,7 +1149,7 @@
#endif
#ifdef HAVE_ICSC_EXS
(strcasecmp(test_name,"EXS_TCP_STREAM") == 0) ||
-#endif /* HAVE_ICSC_EXS */
+#endif /* HAVE_ICSC_EXS */
#ifdef HAVE_SENDFILE
(strcasecmp(test_name,"TCP_SENDFILE") == 0) ||
#endif /* HAVE_SENDFILE */
Modified: trunk/src/netsh.h
===================================================================
--- trunk/src/netsh.h 2012-01-31 22:23:50 UTC (rev 525)
+++ trunk/src/netsh.h 2012-01-31 22:27:31 UTC (rev 526)
@@ -108,7 +108,7 @@
/* the end-test conditions for the tests - either transactions, bytes, */
/* or time. different vars used for clarity - space is cheap ;-) */
-extern int
+extern int
test_time, /* test ends by time */
test_len_ticks,
test_bytes, /* test ends on byte count */
@@ -185,7 +185,7 @@
extern int
shell_num_cpus;
-extern char
+extern char
test_name[BUFSIZ];
extern char
Modified: trunk/src/nettest_bsd.h
===================================================================
--- trunk/src/nettest_bsd.h 2012-01-31 22:23:50 UTC (rev 525)
+++ trunk/src/nettest_bsd.h 2012-01-31 22:27:31 UTC (rev 526)
@@ -143,7 +143,7 @@
uint32_t send_calls;
int32_t send_buf_size; /* SO_SNDBUF at end of test */
uint32_t failed_sends;
- uint32_t trans_received;
+ uint32_t trans_received;
float elapsed_time; /* length of test in seconds */
@@ -156,7 +156,7 @@
float peak_cpu_util; /* its individual utilization */
int32_t vendor;
int32_t device; /* pci device id of the probable egress
- interface */
+ interface */
int32_t subvendor;
int32_t subdevice;
int32_t transport_retrans;
@@ -166,7 +166,7 @@
char ifname[16]; /* the probable egress interface */
char driver[32]; /* size based on linux/ethtool.h */
char version[32];
- char firmware[32];
+ char firmware[32];
char bus[32];
char ifslot[16]; /* slot id of the probable egress interface */
char cong_control[16]; /* what the congestion control alg was */
@@ -178,25 +178,25 @@
struct tcp_stream_request_struct {
int send_buf_size;
int recv_buf_size; /* how big does the client want it - the */
- /* receive socket buffer that is */
+ /* receive socket buffer that is */
int receive_size; /* how many bytes do we want to receive at one */
- /* time? */
+ /* time? */
int recv_alignment; /* what is the alignment of the receive */
- /* buffer? */
- int recv_offset; /* and at what offset from that alignment? */
+ /* buffer? */
+ int recv_offset; /* and at what offset from that alignment? */
int no_delay; /* do we disable the nagle algorithm for send */
- /* coalescing? */
+ /* coalescing? */
int measure_cpu; /* does the client want server cpu utilization */
- /* measured? */
- float cpu_rate; /* do we know how fast the cpu is already? */
+ /* measured? */
+ float cpu_rate; /* do we know how fast the cpu is already? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid copies on */
- /* receives? */
+ /* receives? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dirty_count; /* how many integers in the receive buffer */
- /* should be made dirty before calling recv? */
+ /* should be made dirty before calling recv? */
int clean_count; /* how many integers should be read from the */
- /* recv buffer before calling recv? */
+ /* recv buffer before calling recv? */
int port; /* the port to which the recv side should bind
to allow netperf to run through those evil
firewall things */
@@ -212,13 +212,13 @@
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
- int so_rcvavoid; /* could the remote avoid receive copies? */
+ int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcp_stream_results_struct {
double bytes_received;
- unsigned int recv_calls;
+ unsigned int recv_calls;
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
@@ -231,25 +231,25 @@
struct tcp_maerts_request_struct {
int send_buf_size;
int recv_buf_size; /* how big does the client want it - the */
- /* receive socket buffer that is */
+ /* receive socket buffer that is */
int send_size; /* how many bytes do we want netserver to send
at one time? */
int send_alignment; /* what is the alignment of the send */
- /* buffer? */
- int send_offset; /* and at what offset from that alignment? */
+ /* buffer? */
+ int send_offset; /* and at what offset from that alignment? */
int no_delay; /* do we disable the nagle algorithm for send */
- /* coalescing? */
+ /* coalescing? */
int measure_cpu; /* does the client want server cpu utilization */
- /* measured? */
- float cpu_rate; /* do we know how fast the cpu is already? */
+ /* measured? */
+ float cpu_rate; /* do we know how fast the cpu is already? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid copies on */
- /* receives? */
+ /* receives? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dirty_count; /* how many integers in the send buffer */
- /* should be made dirty before calling recv? */
+ /* should be made dirty before calling recv? */
int clean_count; /* how many integers should be read from the */
- /* recv buffer before calling recv? */
+ /* recv buffer before calling recv? */
int port; /* the port to which the recv side should bind
to allow netperf to run through those evil
firewall things */
@@ -265,13 +265,13 @@
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
- int so_rcvavoid; /* could the remote avoid receive copies? */
+ int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcp_maerts_results_struct {
double bytes_sent;
- unsigned int send_calls;
+ unsigned int send_calls;
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
@@ -293,7 +293,7 @@
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
- /* copies? */
+ /* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int port; /* the port to which the recv side should bind
to allow netperf to run through those evil
@@ -338,7 +338,7 @@
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
- /* copies? */
+ /* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int port; /* the port to which the recv side should bind
to allow netperf to run through those evil
@@ -384,7 +384,7 @@
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
- /* copies? */
+ /* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int port; /* the port to which the recv side should bind
to allow netperf to run through those evil
@@ -428,13 +428,13 @@
float cpu_rate;
int test_length;
int so_rcvavoid; /* do we want the remote to avoid receive */
- /* copies? */
+ /* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int port; /* the port to which the recv side should bind
to allow netperf to run through those evil
firewall things */
int ipfamily;
-
+
};
struct udp_stream_response_struct {
@@ -472,7 +472,7 @@
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
- /* copies? */
+ /* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int port; /* the port to which the recv side should bind
to allow netperf to run through those evil
@@ -517,7 +517,7 @@
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
- /* copies? */
+ /* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int port; /* the port to which the recv side should bind
to allow netperf to run through those evil
@@ -582,18 +582,18 @@
extern void scan_omni_args(int argc, char *argv[]);
#endif
extern void scan_sockets_args(int argc, char *argv[]);
-extern struct addrinfo *complete_addrinfo(char *controlhost,
- char *data_address,
- char *port,
- int family,
- int type,
- int protocol,
+extern struct addrinfo *complete_addrinfo(char *controlhost,
+ char *data_address,
+ char *port,
+ int family,
+ int type,
+ int protocol,
int flags);
extern void complete_addrinfos(struct addrinfo **remote,
- struct addrinfo **local,
- char remote_host[],
- int type,
- int protocol,
+ struct addrinfo **local,
+ char remote_host[],
+ int type,
+ int protocol,
int flags);
extern int af_to_nf(int af);
extern int nf_to_af(int nf);
@@ -601,14 +601,14 @@
extern int hst_to_nst(int hst);
extern char *hst_to_str(int hst);
extern char *protocol_to_str(int protocol);
-extern void print_top_test_header(char test_name[],
- struct addrinfo *source,
+extern void print_top_test_header(char test_name[],
+ struct addrinfo *source,
struct addrinfo *destination);
-extern void set_port_number(struct addrinfo *res,
+extern void set_port_number(struct addrinfo *res,
unsigned short port);
-extern void set_hostname_and_port(char *hostname,
- char *portstr,
- int family,
+extern void set_hostname_and_port(char *hostname,
+ char *portstr,
+ int family,
int port);
extern void set_sockaddr_family_addr_port(struct sockaddr_storage *sockaddr,
int family,
More information about the netperf-dev
mailing list