[netperf-dev] netperf2 commit notice r576 - trunk/src
raj at netperf.org
raj at netperf.org
Fri May 11 18:14:07 PDT 2012
Author: raj
Date: 2012-05-11 18:14:07 -0700 (Fri, 11 May 2012)
New Revision: 576
Modified:
trunk/src/netlib.c
trunk/src/netlib.h
trunk/src/nettest_omni.c
Log:
enable emitting that last, short, interim result
Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c 2012-05-11 18:39:03 UTC (rev 575)
+++ trunk/src/netlib.c 2012-05-12 01:14:07 UTC (rev 576)
@@ -3904,19 +3904,76 @@
}
}
+#ifdef WIN32
+__forceinline void demo_interval_display(double actual_interval)
+#else
+ inline void demo_interval_display(double actual_interval)
+#endif
+{
+ static int count = 0;
+ struct timeval now;
+
+ 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);
+}
+
/* this has gotten long enough to warrant being an inline function
rather than a macro, and it has been enough years since all the
important compilers have supported such a construct so it should
not be a big deal. raj 2012-01-23 */
#ifdef WIN32
-__forceinline void demo_interval_tick(uint32_t units) {
+__forceinline void demo_interval_tick(uint32_t units)
#else
-inline void demo_interval_tick(uint32_t units) {
+ inline void demo_interval_tick(uint32_t units)
#endif
+{
double actual_interval = 0.0;
- static int count = 0;
- struct timeval now;
switch (demo_mode) {
case 0:
@@ -3950,56 +4007,14 @@
exit(-1);
}
+
+
+ /* units == 0 will be when we have completed a test. we want to
+ emit a final interim results if there is anything to report */
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);
+ demo_interval_display(actual_interval);
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
@@ -4011,6 +4026,29 @@
}
}
+#ifdef WIN32
+__forceinline void demo_interval_final()
+#else
+ inline void demo_interval_final()
+#endif
+{
+
+ double actual_interval;
+
+ switch (demo_mode) {
+ case 0:
+ return;
+ case 1:
+ case 2:
+ if (units_this_tick > 0.0) {
+ HIST_timestamp(demo_two_ptr);
+ actual_interval = delta_micro(demo_one_ptr,demo_two_ptr);
+ demo_interval_display(actual_interval);
+ units_this_tick = 0.0;
+ }
+ }
+}
+
void demo_stream_interval(uint32_t units) {
demo_interval_tick(units);
}
Modified: trunk/src/netlib.h
===================================================================
--- trunk/src/netlib.h 2012-05-11 18:39:03 UTC (rev 575)
+++ trunk/src/netlib.h 2012-05-12 01:14:07 UTC (rev 576)
@@ -505,6 +505,7 @@
extern void demo_rr_setup(uint32_t units);
extern void demo_stream_interval(uint32_t units);
extern void demo_interval_tick(uint32_t units);
+extern void demo_interval_final();
#endif
#endif
Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c 2012-05-11 18:39:03 UTC (rev 575)
+++ trunk/src/nettest_omni.c 2012-05-12 01:14:07 UTC (rev 576)
@@ -4227,6 +4227,12 @@
/* we are now, ostensibly, at the end of this iteration */
+#if defined(WANT_DEMO)
+ /* if we were in demo mode this will ensure one final interim
+ result, which, naturally might be a bit early :) */
+ demo_interval_final();
+#endif
+
if (transport_mss == -2)
get_transport_info(data_socket,
&transport_mss,
More information about the netperf-dev
mailing list