[netperf-dev] netperf2 commit notice r54 - in trunk: . src
raj at netperf.org
raj at netperf.org
Mon Feb 6 16:45:00 PST 2006
Author: raj
Date: 2006-02-06 16:44:55 -0800 (Mon, 06 Feb 2006)
New Revision: 54
Modified:
trunk/Release_Notes
trunk/config.h.in
trunk/configure
trunk/configure.ac
trunk/src/netlib.c
trunk/src/netsh.c
trunk/src/nettest_bsd.c
Log:
Add-in the "sit and spin" intervals mode support, and document some stuff
in the Release Notes file to make sure it is not forgotten.
Modified: trunk/Release_Notes
===================================================================
--- trunk/Release_Notes 2006-02-06 23:35:59 UTC (rev 53)
+++ trunk/Release_Notes 2006-02-07 00:44:55 UTC (rev 54)
@@ -2,6 +2,56 @@
Things changed in this release:
+*) There is now a -B global command-line argument that will append its
+ parameter as a string to the end of result lines when test banners
+ have been suppressed. this is to make it easier to distinguish one
+ result from another when aggregate restults are being run in
+ parallel, without having to resort to having the individual results
+ shell redirected to a file. This has been done for some of the
+ tests in nettest_bsd.c, but not all of them, nor for the tests in
+ the other nettest_mumble.c files.
+
+*) There is now an --enable-spin configure option that will enable
+ intervals if not already enabled and will have the sender sit and
+ spin in a tight loop until time for the next interval rather than
+ wait for an interval timer to expire. This means it should be
+ possible to have a much finer granularity on the interval, at the
+ expense of an EXTREME increase in CPU utilization. (To the extent
+ I'm considering disabling measurement of local CPU utilization when
+ that mode is enabled, and bursts have been requested - your
+ feedback on that topic would be most appreciated)
+
+ If only --enable-intervals is used with configure, the old set the
+ interval timer and wait method is still used.
+
+ If --enable-spin is configured, the test banner will include "spin
+ intervals" rather than the "intervals" from a plain
+ --enable-intervals. The sit and spin will either use
+ gettimeofday(), or gethrtime() if gethrtime() is available.
+
+ This has been implemented in the tests of nettest_bsd.c but none of
+ the others. Volunteers would be most welcome. I would entertain
+ the notion of making the implementation a series of inline
+ functions in netlib. This holds true for the demo mode - why will
+ become clear when you look at nettest_bsd.c. While things are
+ considerably cleaner than they were before, with reuse within
+ nettest_bsd.c, there is no resuse with the rest of the
+ nettest_mumble.c files.
+
+*) the -w option for the interval time now takes three optional
+ suffixes. if the suffix is 'm' (eg 10m) it will assume the user has
+ specified time in units of milliseconds. if the suffix is 'u' it
+ will assume microseconds, and if 's' seconds. no suffix remains
+ milliseconds for backwards compatability with previous netperf
+ versions.
+
+*) It should be possible to successfully compile with
+ --enable-intervals.
+
+These are the Release Notes for Revision 2.4.1 of netperf:
+
+Things changed in this release:
+
*) netcpu_pstatnew.c has been altered to workaround a bug in the
interrupt cycle accounting in HP-UX 11.23 that is not expected to
be resolved until a later release. basically, some interrupt time
Modified: trunk/config.h.in
===================================================================
--- trunk/config.h.in 2006-02-06 23:35:59 UTC (rev 53)
+++ trunk/config.h.in 2006-02-07 00:44:55 UTC (rev 54)
@@ -282,6 +282,10 @@
/* Define to one to include SCTP tests. */
#undef WANT_SCTP
+/* Define to one to spin waiting on paced operation. WILL AFFEFCT CPU
+ UTILIZATION */
+#undef WANT_SPIN
+
/* Define to one to include Unix Domain socket tests. */
#undef WANT_UNIX
Modified: trunk/configure
===================================================================
--- trunk/configure 2006-02-06 23:35:59 UTC (rev 53)
+++ trunk/configure 2006-02-07 00:44:55 UTC (rev 54)
@@ -863,6 +863,7 @@
--enable-exs include ICSC async sockets tests
--enable-sctp include tests to measure SCTP performance
--enable-intervals include ability to pace operations, may affect result
+ --enable-spin paces operations should sit and spin - WILL affect result
--enable-burst include intial request burst ability in _RR tests, may affect result
--enable-cpuutil include code to measure CPU utilization using specified mechanism
@@ -7304,6 +7305,57 @@
fi
+# see if paced sends should wait and spin
+
+echo "$as_me:$LINENO: checking whether paced sends should spin" >&5
+echo $ECHO_N "checking whether paced sends should spin... $ECHO_C" >&6
+
+# Check whether --enable-spin or --disable-spin was given.
+if test "${enable_spin+set}" = set; then
+ enableval="$enable_spin"
+
+fi;
+
+case "$enable_spin" in
+ yes)
+ use_spin=true
+ ;;
+ no)
+ use_spin=false
+ ;;
+ '')
+ use_spin=false
+ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: --enable-spin takes yes or no" >&5
+echo "$as_me: error: --enable-spin takes yes or no" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+esac
+
+if $use_spin
+then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if $use_spin
+then
+
+cat >>confdefs.h <<\_ACEOF
+#define WANT_INTERVALS
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define WANT_SPIN
+_ACEOF
+
+fi
+
# see if we should be enabling initial request bursts
echo "$as_me:$LINENO: checking whether to include initial burst support in _RR tests" >&5
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2006-02-06 23:35:59 UTC (rev 53)
+++ trunk/configure.ac 2006-02-07 00:44:55 UTC (rev 54)
@@ -372,6 +372,41 @@
AC_DEFINE([WANT_INTERVALS],,[Define to one to enable paced operation support. May affect results.])
fi
+# see if paced sends should wait and spin
+
+AC_MSG_CHECKING([whether paced sends should spin])
+
+AC_ARG_ENABLE(spin,
+ [ --enable-spin paces operations should sit and spin - WILL affect result])
+
+case "$enable_spin" in
+ yes)
+ use_spin=true
+ ;;
+ no)
+ use_spin=false
+ ;;
+ '')
+ use_spin=false
+ ;;
+ *)
+ AC_MSG_ERROR([--enable-spin takes yes or no])
+ ;;
+esac
+
+if $use_spin
+then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
+if $use_spin
+then
+ AC_DEFINE([WANT_INTERVALS],,[Define to one to enable paced operation support. May affect results.])
+ AC_DEFINE([WANT_SPIN],,[Define to one to spin waiting on paced operation. WILL AFFEFCT CPU UTILIZATION])
+fi
+
# see if we should be enabling initial request bursts
AC_MSG_CHECKING([whether to include initial burst support in _RR tests])
Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c 2006-02-06 23:35:59 UTC (rev 53)
+++ trunk/src/netlib.c 2006-02-07 00:44:55 UTC (rev 54)
@@ -1089,6 +1089,38 @@
return(base);
}
+/* this routine is like convert, but it is used for an interval time
+ specification instead of stuff like socket buffer or send sizes.
+ it converts everything to microseconds for internal use. if there
+ is an 'm' at the end it assumes the user provided milliseconds, s
+ will imply seconds, u will imply microseconds. in the future n
+ will imply nanoseconds but for now it will be ignored. if there is
+ no suffix or an unrecognized suffix, it will be assumed the user
+ provided milliseconds, which was the long-time netperf default. one
+ of these days, we should probably revisit that nanosecond business
+ wrt the return value being just an int rather than a uint64_t or
+ something. raj 2006-02-06 */
+
+unsigned int
+convert_timespec(char *string) {
+
+ unsigned int base;
+ base = atoi(string);
+ if (strstr(string,"m")) {
+ base *= 1000;
+ }
+ else if (strstr(string,"u")) {
+ base *= (1);
+ }
+ else if (strstr(string,"s")) {
+ base *= (1000 * 1000);
+ }
+ else {
+ base *= (1000);
+ }
+ return(base);
+}
+
/* this routine will allocate a circular list of buffers for either */
/* send or receive operations. each of these buffers will be aligned */
@@ -3065,9 +3097,9 @@
#endif
-/* we split these out so we can use HIST_timestamp and delta_micro for
- _either_ WANT_HISTOGRAM, or WANT_DEMO modes. raj 2005-04-06 */
-#if defined(WANT_HISTOGRAM) || defined(WANT_DEMO)
+/* with the advent of sit-and-spin intervals support, we might as well
+ make these things available all the time, not just for demo or
+ histogram modes. raj 2006-02-06 */
#ifdef HAVE_GETHRTIME
void
@@ -3131,7 +3163,7 @@
}
#endif /* HAVE_GETHRTIME */
-#endif /* WANT_HISTOGRAM */
+
#ifdef WANT_DLPI
Modified: trunk/src/netsh.c
===================================================================
--- trunk/src/netsh.c 2006-02-06 23:35:59 UTC (rev 53)
+++ trunk/src/netsh.c 2006-02-07 00:44:55 UTC (rev 54)
@@ -705,8 +705,8 @@
/* second, and that the packet rate is */
/* expressed in packets per millisecond. */
#ifdef WANT_INTERVALS
- interval_wate = convert(optarg);
- interval_usecs = interval_wate * 1000;
+ interval_usecs = convert_timespec(optarg);
+ interval_wate = interval_usecs / 1000;
#else
fprintf(where,
"Packet rate control is not compiled in.\n");
Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c 2006-02-06 23:35:59 UTC (rev 53)
+++ trunk/src/nettest_bsd.c 2006-02-07 00:44:55 UTC (rev 54)
@@ -222,6 +222,7 @@
fflush(where); \
exit(1); \
}
+
#define INTERVALS_WAIT() \
/* in this case, the interval count is the count-down couter \
to decide to sleep for a little bit */ \
@@ -241,10 +242,49 @@
} \
interval_count = interval_burst; \
}
-
#else
+/* first out timestamp */
+#ifdef HAVE_GETHRTIME
+static hrtime_t intvl_one;
+static hrtime_t intvl_two;
+static hrtime_t *intvl_one_ptr = &intvl_one;
+static hrtime_t *intvl_two_ptr = &intvl_two;
+static hrtime_t *temp_intvl_ptr = &intvl_one;
+#else
+static struct timeval intvl_one;
+static struct timeval intvl_two;
+static struct timeval *intvl_one_ptr = &intvl_one;
+static struct timeval *intvl_two_ptr = &intvl_two;
+static struct timeval *temp_intvl_ptr = &intvl_one;
#endif
+
+#define INTERVALS_INIT() \
+ if (interval_burst) { \
+ HIST_timestamp(intvl_one_ptr); \
+ } \
+ interval_count = interval_burst; \
+
+#define INTERVALS_WAIT() \
+ /* in this case, the interval count is the count-down couter \
+ to decide to sleep for a little bit */ \
+ if ((interval_burst) && (--interval_count == 0)) { \
+ /* call sigsuspend and wait for the interval timer to get us \
+ out */ \
+ if (debug) { \
+ fprintf(where,"about to spin suspend\n"); \
+ fflush(where); \
+ } \
+ HIST_timestamp(intvl_two_ptr); \
+ while(delta_micro(intvl_one_ptr,intvl_two_ptr) < interval_usecs) { \
+ HIST_timestamp(intvl_two_ptr); \
+ } \
+ temp_intvl_ptr = intvl_one_ptr; \
+ intvl_one_ptr = intvl_two_ptr; \
+ intvl_two_ptr = temp_intvl_ptr; \
+ interval_count = interval_burst; \
+ }
#endif
+#endif
#ifdef WANT_DEMO
#ifdef HAVE_GETHRTIME
More information about the netperf-dev
mailing list