+ case 1:
+ delta = vlib_time_now (vm) - time_before_connects;
+ if (delta != 0.0)
+ CLI_OUTPUT ("%d three-way handshakes in %.2f seconds %.2f/s",
+ n_clients, delta, ((f64) n_clients) / delta);
+
+ tm->test_start_time = vlib_time_now (tm->vlib_main);
+ CLI_OUTPUT ("Test started at %.6f", tm->test_start_time);
+ break;
+
+ default:
+ CLI_OUTPUT ("unexpected event(1): %d", event_type);
+ error = clib_error_return (0, "failed: unexpected event(1): %d",
+ event_type);
+ goto cleanup;
+ }
+
+ /* Now wait for the sessions to finish... */
+ vlib_process_wait_for_event_or_clock (vm, test_timeout);
+ event_type = vlib_process_get_events (vm, &event_data);
+ switch (event_type)
+ {
+ case ~0:
+ CLI_OUTPUT ("Timeout with %d sessions still active...",
+ tm->ready_connections);
+ error = clib_error_return (0, "failed: timeout with %d sessions",
+ tm->ready_connections);
+ goto cleanup;
+
+ case 2:
+ tm->test_end_time = vlib_time_now (vm);
+ CLI_OUTPUT ("Test finished at %.6f", tm->test_end_time);
+ break;
+
+ default:
+ CLI_OUTPUT ("unexpected event(2): %d", event_type);
+ error = clib_error_return (0, "failed: unexpected event(2): %d",
+ event_type);
+ goto cleanup;
+ }
+
+ delta = tm->test_end_time - tm->test_start_time;
+
+ if (delta != 0.0)
+ {
+ total_bytes = (tm->no_return ? tm->tx_total : tm->rx_total);
+ transfer_type = tm->no_return ? "half-duplex" : "full-duplex";
+ CLI_OUTPUT ("%lld bytes (%lld mbytes, %lld gbytes) in %.2f seconds",
+ total_bytes, total_bytes / (1ULL << 20),
+ total_bytes / (1ULL << 30), delta);
+ CLI_OUTPUT ("%.2f bytes/second %s", ((f64) total_bytes) / (delta),
+ transfer_type);
+ CLI_OUTPUT ("%.4f gbit/second %s",
+ (((f64) total_bytes * 8.0) / delta / 1e9), transfer_type);
+ }
+ else
+ {
+ CLI_OUTPUT ("zero delta-t?");
+ error = clib_error_return (0, "failed: zero delta-t");
+ goto cleanup;
+ }
+
+ if (tm->test_bytes && tm->test_failed)
+ error = clib_error_return (0, "failed: test bytes");
+
+cleanup:
+ tm->run_test = 0;
+ for (i = 0; i < vec_len (tm->connection_index_by_thread); i++)
+ {
+ vec_reset_length (tm->connection_index_by_thread[i]);
+ vec_reset_length (tm->connections_this_batch_by_thread[i]);
+ }
+
+ pool_free (tm->sessions);
+
+ /* Detach the application, so we can use different fifo sizes next time */
+ if (tm->test_client_attached)
+ {
+ vnet_app_detach_args_t _da, *da = &_da;
+ int rv;
+
+ da->app_index = tm->app_index;
+ rv = vnet_application_detach (da);
+ if (rv)
+ {
+ error = clib_error_return (0, "failed: app detach");
+ CLI_OUTPUT ("WARNING: app detach failed...");
+ }
+ tm->test_client_attached = 0;
+ tm->app_index = ~0;
+ }
+ if (error)
+ CLI_OUTPUT ("test failed");
+ return error;
+}