[ofa-general] [PATCH] uDAPL (v2.0) dtest: add connection timers on client side

Davis, Arlin R arlin.r.davis at intel.com
Mon May 18 12:07:38 PDT 2009


Add timers for active connections and print
results. Allow polling or wait on conn event.

Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
---
 test/dtest/dtest.c |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/test/dtest/dtest.c b/test/dtest/dtest.c
index 6ff7798..f1f0f2b 100755
--- a/test/dtest/dtest.c
+++ b/test/dtest/dtest.c
@@ -183,6 +183,7 @@ struct dt_time {
 	double rdma_rd_total;
 	double rtt;
 	double close;
+	double conn;
 };
 
 struct dt_time time;
@@ -197,6 +198,7 @@ static int verbose = 0;
 static int polling = 0;
 static int poll_count = 0;
 static int rdma_wr_poll_count = 0;
+static int conn_poll_count = 0;
 static int rdma_rd_poll_count[MAX_RDMA_RD] = { 0 };
 static int delay = 0;
 static int buf_len = RDMA_BUFFER_SIZE;
@@ -617,6 +619,9 @@ complete:
 	}
 	printf("%d: EP create: %10.2lf usec\n", getpid(), time.epc);
 	printf("%d: EP free:   %10.2lf usec\n", getpid(), time.epf);
+	if (!server)
+		printf("%d: connect:   %10.2lf usec, poll_cnt=%d\n", 
+		       getpid(), time.conn, conn_poll_count);
 	printf("%d: TOTAL:     %10.2lf usec\n", getpid(), time.total);
 
 #if defined(_WIN32) || defined(_WIN64)
@@ -843,6 +848,9 @@ DAT_RETURN connect_ep(char *hostname, DAT_CONN_QUAL conn_id)
 	/* setup receive rdma buffer to initial string to be overwritten */
 	strcpy((char *)rbuf, "blah, blah, blah\n");
 
+	/* clear event structure */
+	memset(&event, 0, sizeof(DAT_EVENT));
+
 	if (server) {		/* SERVER */
 
 		/* create the service point for server listen */
@@ -962,6 +970,7 @@ DAT_RETURN connect_ep(char *hostname, DAT_CONN_QUAL conn_id)
 			pdata[i] = i + 1;
 
 		LOGPRINTF("%d Connecting to server\n", getpid());
+        	start = get_time();
 		ret = dat_ep_connect(h_ep,
 				     &remote_addr,
 				     conn_id,
@@ -979,14 +988,18 @@ DAT_RETURN connect_ep(char *hostname, DAT_CONN_QUAL conn_id)
 
 	printf("%d Waiting for connect response\n", getpid());
 
-	ret = dat_evd_wait(h_conn_evd, DAT_TIMEOUT_INFINITE, 1, &event, &nmore);
-	if (ret != DAT_SUCCESS) {
-		fprintf(stderr, "%d Error dat_evd_wait: %s\n",
-			getpid(), DT_RetToString(ret));
-		return (ret);
-	} else
-		LOGPRINTF("%d dat_evd_wait for h_conn_evd completed\n",
-			  getpid());
+	if (polling) 
+		while (DAT_GET_TYPE(dat_evd_dequeue(h_conn_evd, &event)) == 
+		       DAT_QUEUE_EMPTY)
+			conn_poll_count++;
+	else 
+		ret = dat_evd_wait(h_conn_evd, DAT_TIMEOUT_INFINITE, 
+				   1, &event, &nmore);
+
+	if (!server) {
+        	stop = get_time();
+        	time.conn += ((stop - start) * 1.0e6);
+	}
 
 #ifdef TEST_REJECT_WITH_PRIVATE_DATA
 	if (event.event_number != DAT_CONNECTION_EVENT_PEER_REJECTED) {
@@ -1012,8 +1025,9 @@ DAT_RETURN connect_ep(char *hostname, DAT_CONN_QUAL conn_id)
 #endif
 
 	if (event.event_number != DAT_CONNECTION_EVENT_ESTABLISHED) {
-		fprintf(stderr, "%d Error unexpected conn event : %s\n",
-			getpid(), DT_EventToSTr(event.event_number));
+		fprintf(stderr, "%d Error unexpected conn event : 0x%x %s\n",
+			getpid(), event.event_number,
+			DT_EventToSTr(event.event_number));
 		return (DAT_ABORT);
 	}
 
-- 
1.5.2.5




More information about the general mailing list