[netperf-dev] netperf2 commit notice r567 - in trunk: doc src
raj at netperf.org
raj at netperf.org
Wed Apr 25 12:26:24 PDT 2012
Author: raj
Date: 2012-04-25 12:26:24 -0700 (Wed, 25 Apr 2012)
New Revision: 567
Modified:
trunk/doc/netperf.info
trunk/src/netlib.c
trunk/src/netsh.c
Log:
allow a negative value for the demo interval to mean make a check of the time after each unit of work is completed. this mode should allow netperf interim results reporting to be a bit more responsive to changes in connection speed
Modified: trunk/doc/netperf.info
===================================================================
--- trunk/doc/netperf.info 2012-04-16 18:44:47 UTC (rev 566)
+++ trunk/doc/netperf.info 2012-04-25 19:26:24 UTC (rev 567)
@@ -1418,7 +1418,7 @@
units to be 2^30 (GB), 2^20 (MB) or 2^10 (KB) respectively. A
suffix of "g," "m" or "k" will specify units of 10^9, 10^6 or 10^3
bytes respectively. For example:
- `-s 128K'
+ `-S 128K'
Will request the remote send and receive socket buffer sizes to be
128KB or 131072 bytes.
@@ -2009,7 +2009,7 @@
units to be 2^30 (GB), 2^20 (MB) or 2^10 (KB) respectively. A
suffix of "g," "m" or "k" will specify units of 10^9, 10^6 or 10^3
bytes respectively. For example:
- `-s 128K'
+ `-S 128K'
Will request the remote (netserver) send and receive socket buffer
sizes to be 128KB or 131072 bytes.
Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c 2012-04-16 18:44:47 UTC (rev 566)
+++ trunk/src/netlib.c 2012-04-25 19:26:24 UTC (rev 567)
@@ -3847,7 +3847,10 @@
#if defined(WANT_INTERVALS) || defined(WANT_DEMO)
-int demo_mode; /* are we actually in demo mode? */
+int demo_mode; /* are we actually in demo mode? = 0
+ == not in demo mode; 1 == classic
+ unit based demo mode; 2 == always
+ timestamp demo mode */
double demo_interval = 1000000.0; /* what is the desired interval to
display interval results. default
is one second in units of
@@ -3911,10 +3914,15 @@
#else
inline demo_interval_tick(uint32_t units) {
#endif
- if (demo_mode) {
- double actual_interval;
- static int count = 0;
- struct timeval now;
+ double actual_interval = 0.0;
+ static int count = 0;
+ struct timeval now;
+ int emit_output = 0;
+
+ switch (demo_mode) {
+ case 0:
+ return;
+ case 1: /* use the unit accumulation first */
units_this_tick += units;
if (units_this_tick >= demo_units) {
/* time to possibly update demo_units and maybe output an
@@ -3925,66 +3933,83 @@
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) {
- /* time to emit an interim result, giving the current time to
- the millisecond for compatability with RRD */
- gettimeofday(&now,NULL);
- switch (netperf_output_mode) {
- case HUMAN:
- fprintf(where,
- "Interim result: %7.2f %s/s over %.3f seconds ending at %ld.%.3ld\n",
- calc_thruput_interval(units_this_tick,
- actual_interval/1000000.0),
- format_units(),
- actual_interval/1000000.0,
- now.tv_sec,
- (long) now.tv_usec/1000);
- break;
- case CSV:
- fprintf(where,
- "%7.2f,%s/s,%.3f,%ld.%.3ld\n",
- calc_thruput_interval(units_this_tick,
- actual_interval/1000000.0),
- format_units(),
- actual_interval/1000000.0,
- now.tv_sec,
- (long) now.tv_usec/1000);
- break;
- case KEYVAL:
- fprintf(where,
- "NETPERF_INTERIM_RESULT[%d]=%.2f\n"
- "NETPERF_UNITS[%d]=%s/s\n"
- "NETPERF_INTERVAL[%d]=%.3f\n"
- "NETPERF_ENDING[%d]=%ld.%.3ld\n",
- count,
- calc_thruput_interval(units_this_tick,
- actual_interval/1000000.0),
- count,
- format_units(),
- count,
- actual_interval/1000000.0,
- count,
- now.tv_sec,
- (long) now.tv_usec/1000);
- count += 1;
- break;
- default:
- fprintf(where,
- "Hey Ricky you not fine, theres a bug at demo time. Hey Ricky!");
- fflush(where);
- exit(-1);
- }
- 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;
- }
}
+ else
+ return;
+ break;
+ case 2: /* Always timestamp */
+ units_this_tick += units;
+ HIST_timestamp(demo_two_ptr);
+ actual_interval = delta_micro(demo_one_ptr,demo_two_ptr);
+
+ break;
+ default:
+ fprintf(where,
+ "Unexpected value of demo_mode of %d. Please report this as a bug.\n",
+ demo_mode);
+ fflush(where);
+ exit(-1);
}
+
+ 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);
+ switch (netperf_output_mode) {
+ case HUMAN:
+ fprintf(where,
+ "Interim result: %7.2f %s/s over %.3f seconds ending at %ld.%.3ld\n",
+ calc_thruput_interval(units_this_tick,
+ actual_interval/1000000.0),
+ format_units(),
+ actual_interval/1000000.0,
+ now.tv_sec,
+ (long) now.tv_usec/1000);
+ break;
+ case CSV:
+ fprintf(where,
+ "%7.2f,%s/s,%.3f,%ld.%.3ld\n",
+ calc_thruput_interval(units_this_tick,
+ actual_interval/1000000.0),
+ format_units(),
+ actual_interval/1000000.0,
+ now.tv_sec,
+ (long) now.tv_usec/1000);
+ break;
+ case KEYVAL:
+ fprintf(where,
+ "NETPERF_INTERIM_RESULT[%d]=%.2f\n"
+ "NETPERF_UNITS[%d]=%s/s\n"
+ "NETPERF_INTERVAL[%d]=%.3f\n"
+ "NETPERF_ENDING[%d]=%ld.%.3ld\n",
+ count,
+ calc_thruput_interval(units_this_tick,
+ actual_interval/1000000.0),
+ count,
+ format_units(),
+ count,
+ actual_interval/1000000.0,
+ count,
+ now.tv_sec,
+ (long) now.tv_usec/1000);
+ count += 1;
+ break;
+ default:
+ fprintf(where,
+ "Hey Ricky you not fine, theres a bug at demo time. Hey Ricky!");
+ fflush(where);
+ exit(-1);
+ }
+ 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;
+
+ }
}
void demo_stream_interval(uint32_t units) {
Modified: trunk/src/netsh.c
===================================================================
--- trunk/src/netsh.c 2012-04-16 18:44:47 UTC (rev 566)
+++ trunk/src/netsh.c 2012-04-25 19:26:24 UTC (rev 567)
@@ -87,7 +87,7 @@
getopt to parse the command line, we will tell getopt that they do
not take parms, and then look for them ourselves */
-#define GLOBAL_CMD_LINE_ARGS "A:a:b:B:CcdDf:F:H:hi:I:jk:K:l:L:n:NO:o:P:p:rSs:t:T:v:VW:w:y:Y:Z:46"
+#define GLOBAL_CMD_LINE_ARGS "A:a:b:B:CcdD:f:F:H:hi:I:jk:K:l:L:n:NO:o:P:p:rSs:t:T:v:VW:w:y:Y:Z:46"
/************************************************************************/
/* */
@@ -254,8 +254,10 @@
-c [cpu_rate] Report local CPU usage\n\
-C [cpu_rate] Report remote CPU usage\n\
-d Increase debugging output\n\
- -D [secs,units] * Display interim results at least every secs seconds\n\
+ -D time,[units] * Display interim results at least every time interval\n\
using units as the initial guess for units per second\n\
+ A negative value for time will make heavy use of the\n\
+ system's timestamping functionality\n\
-f G|M|K|g|m|k Set the output units\n\
-F lfill[,rfill]* Pre-fill buffers with data from specified file\n\
-h Display this text\n\
@@ -670,18 +672,18 @@
break;
case 'D':
#if (defined WANT_DEMO)
- demo_mode++;
- if (argv[optind] && isdigit((unsigned char)argv[optind][0])){
- /* there was an optional parm */
- break_args_explicit(argv[optind],arg1,arg2);
- optind++;
- if (arg1[0]) {
- demo_interval = atof(arg1) * 1000000.0;
+ demo_mode = 1; /* 1 == use units; 2 == always timestamp */
+ break_args_explicit(optarg,arg1,arg2);
+ if (arg1[0]) {
+ demo_interval = atof(arg1) * 1000000.0;
+ if (demo_interval < 0.0) {
+ demo_interval = demo_interval * -1.0;
+ demo_mode = 2;
}
- if (arg2[0]) {
- demo_units = convert(arg2);
- }
}
+ if (arg2[0]) {
+ demo_units = convert(arg2);
+ }
#else
printf("Sorry, Demo Mode not configured into this netperf.\n"
"Please consider reconfiguring netperf with\n"
More information about the netperf-dev
mailing list