[ofw] [PATCH] perftest: adjust performance counters for ridiculously long Vista time stamping

Sean Hefty sean.hefty at intel.com
Tue Feb 24 21:22:34 PST 2009


Adjust time stamping to account for lengthy time stamps.  Only keep performance
data on the client side to avoid server time stamping overhead.  Extract out
common performance code into a new module that's included by all the perftests.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/perftest.c branches\winverbs\tests\perftest/perftest.c
--- trunk\tests\perftest/perftest.c	1969-12-31 16:00:00.000000000 -0800
+++ branches\winverbs\tests\perftest/perftest.c	2009-02-23 11:57:36.709504500 -0800
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2005 Hewlett Packard, Inc (Grant Grundler)
+ * Copyright (c) 2008-2009 Intel Corporation.  All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "perftest.h"
+
+UINT64 get_cycles()
+{
+	LARGE_INTEGER counter;
+	static UINT64 base_adj = 0;
+	static UINT64 running_adj = 0;
+
+	if (base_adj == 0) {
+		int i;
+
+		QueryPerformanceCounter(&counter);
+		base_adj = counter.QuadPart;
+		for (i = 0; i < (1 << 16) - 2; i++) {
+			QueryPerformanceCounter(&counter);
+		}
+		QueryPerformanceCounter(&counter);
+		base_adj = (counter.QuadPart - base_adj) >> 16;
+	}
+
+	QueryPerformanceCounter(&counter);
+
+	running_adj += base_adj;
+	return counter.QuadPart - running_adj;
+}
+
+UINT64 get_freq()
+{
+	LARGE_INTEGER freq;
+	QueryPerformanceFrequency(&freq);
+	return freq.QuadPart;
+}
+
+cycles_t get_median(int n, cycles_t delta[])
+{
+	if ((n - 1) % 2)
+		return(delta[n / 2] + delta[n / 2 - 1]) / 2;
+	else
+		return delta[n / 2];
+}
+
+int __cdecl cycles_compare(const void * aptr, const void * bptr)
+{
+	const cycles_t *a = aptr;
+	const cycles_t *b = bptr;
+	if (*a < *b) return -1;
+	if (*a > *b) return 1;
+	return 0;
+
+}
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/perftest.h branches\winverbs\tests\perftest/perftest.h
--- trunk\tests\perftest/perftest.h	1969-12-31 16:00:00.000000000 -0800
+++ branches\winverbs\tests\perftest/perftest.h	2009-02-23 11:54:18.800721300 -0800
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2005 Hewlett Packard, Inc (Grant Grundler)
+ * Copyright (c) 2008-2009 Intel Corporation.  All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <windows.h>
+
+typedef UINT64 cycles_t;
+
+UINT64 get_cycles();
+UINT64 get_freq();
+
+cycles_t get_median(int n, cycles_t delta[]);
+int __cdecl cycles_compare(const void * aptr, const void * bptr);
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/rdma_bw/rdma_bw.c
branches\winverbs\tests\perftest/rdma_bw/rdma_bw.c
--- trunk\tests\perftest/rdma_bw/rdma_bw.c	2009-01-19 11:58:40.371933300 -0800
+++ branches\winverbs\tests\perftest/rdma_bw/rdma_bw.c	2009-02-24 14:14:19.543533900 -0800
@@ -37,6 +37,7 @@
 #include <time.h>
 
 #include "..\..\..\etc\user\getopt.c"
+#include "perftest.h"
 #include <infiniband/verbs.h>
 #include <rdma/rdma_cma.h>
 
@@ -88,22 +89,6 @@ static void pp_send_start(struct pingpon
 static void pp_close_cma(struct pp_data );
 static struct pingpong_context *pp_init_ctx(void *, struct pp_data *);
 
-typedef UINT64 cycles_t;
-
-static __inline UINT64 get_cycles()
-{
-	LARGE_INTEGER counter;
-	QueryPerformanceCounter(&counter);
-	return counter.QuadPart;
-}
-
-static __inline UINT64 get_freq()
-{
-	LARGE_INTEGER freq;
-	QueryPerformanceFrequency(&freq);
-	return freq.QuadPart;
-}
-
 static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port)
 {
 	struct ibv_port_attr attr;
@@ -842,10 +827,10 @@ static void print_report(unsigned int it
 		mbytes = (double) tsize * (double) iters / (double) 0x100000;
 		printf("Bandwidth average: %7.2f MB/sec\n", mbytes / sec);
 
-		printf("%Service Demand peak (#%d to #%d): %7.2f cycles/KB\n",
+		printf("Service Demand peak (#%d to #%d): %7.2f cycles/KB\n",
 				 opt_posted, opt_completed,
 				 (double) opt_delta * 1024. / (double) tsize);
-		printf("%Service Demand Avg  : %7.2f cycles/KB\n",
+		printf("Service Demand Avg  : %7.2f cycles/KB\n",
 				 (double) (tcompleted[iters - 1] - tposted[0]) * 1024. / (double) (tsize * iters));	
 	}
 }
@@ -1117,7 +1102,8 @@ int __cdecl main(int argc, char *argv[])
 
 		while (scnt < iters && scnt - ccnt < data.tx_depth) {
 			struct ibv_send_wr *bad_wr;
-			tposted[scnt] = get_cycles();
+			if (data.servername)
+				tposted[scnt] = get_cycles();
 
 			if (ibv_post_send(qp, &ctx->wr, &bad_wr)) {
 				fprintf(stderr, "Couldn't post send: scnt=%d\n", scnt);
@@ -1133,7 +1119,8 @@ int __cdecl main(int argc, char *argv[])
 				ne = ibv_poll_cq(ctx->scq, 1, &wc);
 			} while (ne == 0);
 
-			tcompleted[ccnt] = get_cycles();
+			if (data.servername)
+				tcompleted[ccnt] = get_cycles();
 
 			if (ne < 0) {
 				fprintf(stderr, "poll CQ failed %d\n", ne);
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/rdma_bw/SOURCES
branches\winverbs\tests\perftest/rdma_bw/SOURCES
--- trunk\tests\perftest/rdma_bw/SOURCES	2009-01-15 11:30:41.566547400 -0800
+++ branches\winverbs\tests\perftest/rdma_bw/SOURCES	2009-02-23 12:19:51.694775800 -0800
@@ -10,11 +10,11 @@ USE_STL = 1
 USE_NATIVE_EH = 1
 USE_IOSTREAM = 1
 
-SOURCES =			\
-	rdma_bw.rc		\
-	rdma_bw.c
+SOURCES = rdma_bw.rc rdma_bw.c ..\perftest.c
 	
-INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\ulp\librdmacm\include;..\..\..\inc;..\..\..\inc\user;
+INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
+		   ..\..\..\ulp\librdmacm\include;\
+		   ..\..\..\inc;..\..\..\inc\user;
 
 TARGETLIBS =						\
 	$(SDK_LIB_PATH)\kernel32.lib	\
@@ -24,7 +24,7 @@ TARGETLIBS =						\
 	$(SDK_LIB_PATH)\ws2_32.lib		\
 !if $(FREEBUILD)
 	$(TARGETPATH)\*\libibverbs.lib	\
-	$(TARGETPATH)\*\librdmacm.lib	\
+	$(TARGETPATH)\*\librdmacm.lib
 !else
 	$(TARGETPATH)\*\libibverbsd.lib	\
 	$(TARGETPATH)\*\librdmacmd.lib
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/rdma_lat/rdma_lat.c
branches\winverbs\tests\perftest/rdma_lat/rdma_lat.c
--- trunk\tests\perftest/rdma_lat/rdma_lat.c	2009-01-19 14:24:11.203415300 -0800
+++ branches\winverbs\tests\perftest/rdma_lat/rdma_lat.c	2009-02-24 11:09:57.653775600 -0800
@@ -38,6 +38,7 @@
 #include <time.h>
 
 #include "..\..\..\etc\user\getopt.c"
+#include "perftest.h"
 #include <infiniband/verbs.h>
 #include <rdma/rdma_cma.h>
 
@@ -101,22 +102,6 @@ static void pp_send_start(struct pingpon
 static void pp_close_cma(struct pp_data );
 static struct pingpong_context *pp_init_ctx(void *, struct pp_data *);
 
-typedef UINT64 cycles_t;
-
-static __inline UINT64 get_cycles()
-{
-	LARGE_INTEGER counter;
-	QueryPerformanceCounter(&counter);
-	return counter.QuadPart;
-}
-
-static __inline UINT64 get_freq()
-{
-	LARGE_INTEGER freq;
-	QueryPerformanceFrequency(&freq);
-	return freq.QuadPart;
-}
-
 static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port)
 {
 	struct ibv_port_attr attr;
@@ -884,30 +869,6 @@ static void usage(const char *argv0)
 	printf("  -c, --cma              Use the RDMA CMA to setup the RDMA connection\n");
 }
 
-/*
- * When there is an
- *	odd number of samples, the median is the middle number.
- * 	even number of samples, the median is the mean of the
- *		two middle numbers.
- *
- */
-static cycles_t get_median(int n, cycles_t delta[])
-{
-	if ((n - 1) % 2)
-		return (delta[n / 2] + delta[n / 2 - 1]) / 2;
-	else
-		return delta[n / 2];
-}
-
-static int __cdecl cycles_compare(const void * aptr, const void * bptr)
-{
-	const cycles_t *a = aptr;
-	const cycles_t *b = bptr;
-	if (*a < *b) return -1;
-	if (*a > *b) return 1;
-	return 0;
-}
-
 static void print_report(struct report_options * options,
 			 unsigned int iters, cycles_t *tstamp)
 {
@@ -1177,7 +1138,8 @@ int __cdecl main(int argc, char *argv[])
 
 		if (scnt < iters) {
 			struct ibv_send_wr *bad_wr;
-			tstamp[scnt] = get_cycles();
+			if (data.servername)
+				tstamp[scnt] = get_cycles();
 
 			*post_buf = (char)++scnt;
 			if (ibv_post_send(qp, wr, &bad_wr)) {
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/rdma_lat/SOURCES
branches\winverbs\tests\perftest/rdma_lat/SOURCES
--- trunk\tests\perftest/rdma_lat/SOURCES	2009-01-15 11:41:03.209902400 -0800
+++ branches\winverbs\tests\perftest/rdma_lat/SOURCES	2009-02-23 12:19:46.694807800 -0800
@@ -10,11 +10,11 @@ USE_STL = 1
 USE_NATIVE_EH = 1
 USE_IOSTREAM = 1
 
-SOURCES =			\
-	rdma_lat.rc		\
-	rdma_lat.c
+SOURCES = rdma_lat.rc rdma_lat.c ..\perftest.c
 	
-INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\ulp\librdmacm\include;..\..\..\inc;..\..\..\inc\user;
+INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
+		   ..\..\..\ulp\librdmacm\include;\
+		   ..\..\..\inc;..\..\..\inc\user;
 
 TARGETLIBS =						\
 	$(SDK_LIB_PATH)\kernel32.lib	\
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/read_bw/read_bw.c
branches\winverbs\tests\perftest/read_bw/read_bw.c
--- trunk\tests\perftest/read_bw/read_bw.c	2008-12-17 11:06:44.023625000 -0800
+++ branches\winverbs\tests\perftest/read_bw/read_bw.c	2009-02-24 11:31:02.775463500 -0800
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies Ltd.  All rights reserved.
- * Copyright (c) 2008 Intel Corporation.  All rights reserved.
+ * Copyright (c) 2008-2009 Intel Corporation.  All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -37,6 +37,7 @@
 #include <time.h>
 
 #include "..\..\..\etc\user\getopt.c"
+#include "perftest.h"
 #include <infiniband/verbs.h>
 
 #define PINGPONG_READ_WRID	1
@@ -81,20 +82,6 @@ struct pingpong_dest {
 	unsigned long long vaddr;
 };
 
-static __inline UINT64 get_cycles()
-{
-	LARGE_INTEGER counter;
-	QueryPerformanceCounter(&counter);
-	return counter.QuadPart;
-}
-
-static __inline UINT64 get_freq()
-{
-	LARGE_INTEGER freq;
-	QueryPerformanceFrequency(&freq);
-	return freq.QuadPart;
-}
-
 static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port)
 {
 	struct ibv_port_attr attr;
@@ -541,7 +528,8 @@ static int run_iter(struct pingpong_cont
 	while (scnt < user_param->iters || ccnt < user_param->iters) {
 		while (scnt < user_param->iters && (scnt - ccnt) < user_param->tx_depth ) {
 			struct ibv_send_wr *bad_wr;
-			tposted[scnt] = get_cycles();
+			if (user_param->servername)
+				tposted[scnt] = get_cycles();
 			if (ibv_post_send(qp, &ctx->wr, &bad_wr)) {
 				fprintf(stderr, "Couldn't post send: scnt=%d\n",
 					scnt);
@@ -571,7 +559,8 @@ static int run_iter(struct pingpong_cont
 			do {
 				ne = ibv_poll_cq(ctx->cq, 1, &wc);
 				if (ne) {
-					tcompleted[ccnt] = get_cycles();
+					if (user_param->servername)
+						tcompleted[ccnt] = get_cycles();
 					if (wc.status != IBV_WC_SUCCESS) {
 						fprintf(stderr, "Completion wth error at %s:\n",
 							user_param->servername ? "client" : "server");
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/read_bw/SOURCES
branches\winverbs\tests\perftest/read_bw/SOURCES
--- trunk\tests\perftest/read_bw/SOURCES	2008-12-17 11:06:44.008000000 -0800
+++ branches\winverbs\tests\perftest/read_bw/SOURCES	2009-02-23 12:20:20.944588600 -0800
@@ -10,11 +10,10 @@ USE_STL = 1
 USE_NATIVE_EH = 1
 USE_IOSTREAM = 1
 
-SOURCES =		\
-	read_bw.rc	\
-	read_bw.c
+SOURCES = read_bw.rc read_bw.c ..\perftest.c
 	
-INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user;
+INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
+		   ..\..\..\inc;..\..\..\inc\user;
 
 TARGETLIBS =						\
 	$(SDK_LIB_PATH)\kernel32.lib	\
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/read_lat/read_lat.c
branches\winverbs\tests\perftest/read_lat/read_lat.c
--- trunk\tests\perftest/read_lat/read_lat.c	2008-12-17 11:06:45.179875000 -0800
+++ branches\winverbs\tests\perftest/read_lat/read_lat.c	2009-02-23 12:02:21.284134700 -0800
@@ -38,6 +38,7 @@
 #include <time.h>
 
 #include "..\..\..\etc\user\getopt.c"
+#include "perftest.h"
 #include <infiniband/verbs.h>
 
 #define PINGPONG_READ_WRID	1
@@ -90,20 +91,6 @@ struct pingpong_dest {
 };
 struct pingpong_dest my_dest;
 
-static __inline UINT64 get_cycles()
-{
-	LARGE_INTEGER counter;
-	QueryPerformanceCounter(&counter);
-	return counter.QuadPart;
-}
-
-static __inline UINT64 get_freq()
-{
-	LARGE_INTEGER freq;
-	QueryPerformanceFrequency(&freq);
-	return freq.QuadPart;
-}
-
 static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port)
 {
 	struct ibv_port_attr attr;
@@ -567,30 +554,6 @@ static void usage(const char *argv0)
 	printf("  -e               sleep on CQ events (default poll)\n");
 }
 
-/*
- * When there is an
- *	odd number of samples, the median is the middle number.
- * 	even number of samples, the median is the mean of the
- *		two middle numbers.
- *
- */
-static __inline cycles_t get_median(int n, cycles_t delta[])
-{
-	if ((n - 1) % 2)
-		return (delta[n / 2] + delta[n / 2 - 1]) / 2;
-	else
-		return delta[n / 2];
-}
-
-static int __cdecl cycles_compare(const void * aptr, const void * bptr)
-{
-	const cycles_t *a = aptr;
-	const cycles_t *b = bptr;
-	if (*a < *b) return -1;
-	if (*a > *b) return 1;
-	return 0;
-}
-
 static void print_report(struct report_options * options,
 			 unsigned int iters, cycles_t *tstamp,int size)
 {
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/read_lat/SOURCES
branches\winverbs\tests\perftest/read_lat/SOURCES
--- trunk\tests\perftest/read_lat/SOURCES	2008-12-17 11:06:45.179875000 -0800
+++ branches\winverbs\tests\perftest/read_lat/SOURCES	2009-02-23 12:20:43.944441400 -0800
@@ -10,11 +10,10 @@ USE_STL = 1
 USE_NATIVE_EH = 1
 USE_IOSTREAM = 1
 
-SOURCES =			\
-	read_lat.rc		\
-	read_lat.c
+SOURCES = read_lat.rc read_lat.c ..\perftest.c
 	
-INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user;
+INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
+		   ..\..\..\inc;..\..\..\inc\user;
 
 TARGETLIBS =						\
 	$(SDK_LIB_PATH)\kernel32.lib	\
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/send_bw/send_bw.c
branches\winverbs\tests\perftest/send_bw/send_bw.c
--- trunk\tests\perftest/send_bw/send_bw.c	2009-01-13 23:17:06.640625000 -0800
+++ branches\winverbs\tests\perftest/send_bw/send_bw.c	2009-02-24 11:18:11.759619600 -0800
@@ -36,6 +36,7 @@
 #include <time.h>
 
 #include "..\..\..\etc\user\getopt.c"
+#include "perftest.h"
 #include <infiniband/verbs.h>
 
 #define PINGPONG_SEND_WRID  1
@@ -96,20 +97,6 @@ struct pingpong_dest {
 	unsigned long long vaddr;
 };
 
-static __inline UINT64 get_cycles()
-{
-	LARGE_INTEGER counter;
-	QueryPerformanceCounter(&counter);
-	return counter.QuadPart;
-}
-
-static __inline UINT64 get_freq()
-{
-	LARGE_INTEGER freq;
-	QueryPerformanceFrequency(&freq);
-	return freq.QuadPart;
-}
-
 static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port)
 {
 	struct ibv_port_attr attr;
@@ -717,7 +704,8 @@ static int run_iter_bi(struct pingpong_c
 		while (scnt < user_param->iters &&
 		       (scnt - ccnt) < user_param->tx_depth / 2) {
 			struct ibv_send_wr *bad_wr;
-			tposted[scnt] = get_cycles();
+			if (user_param->servername)
+				tposted[scnt] = get_cycles();
 			if (ibv_post_send(qp, &ctx->wr, &bad_wr)) {
 				fprintf(stderr, "Couldn't post send: scnt=%d\n",
 					scnt);
@@ -757,7 +745,8 @@ static int run_iter_bi(struct pingpong_c
 			}
 			switch ((int) wc.wr_id) {
 			case PINGPONG_SEND_WRID:
-				tcompleted[ccnt] = get_cycles();
+				if (user_param->servername)
+					tcompleted[ccnt] = get_cycles();
 				ccnt += 1;
 				break;
 			case PINGPONG_RECV_WRID:
@@ -841,7 +830,8 @@ static int run_iter_uni(struct pingpong_
 			do {
 				ne = ibv_poll_cq(ctx->cq, 1, &wc);
 				if (ne) {
-					tcompleted[ccnt] = get_cycles();
+					if (user_param->servername)
+						tcompleted[ccnt] = get_cycles();
 					if (wc.status != IBV_WC_SUCCESS) {
 						fprintf(stderr, "Completion wth error at %s:\n",
 							user_param->servername ? "client" : "server");
@@ -871,7 +861,8 @@ static int run_iter_uni(struct pingpong_
 		while (scnt < user_param->iters || ccnt < user_param->iters) {
 			while (scnt < user_param->iters && (scnt - ccnt) < user_param->tx_depth ) {
 				struct ibv_send_wr *bad_wr;
-				tposted[scnt] = get_cycles();
+				if (user_param->servername)
+					tposted[scnt] = get_cycles();
 				if (ibv_post_send(qp, &ctx->wr, &bad_wr)) {
 					fprintf(stderr, "Couldn't post send: scnt=%d\n",
 						scnt);
@@ -903,7 +894,8 @@ static int run_iter_uni(struct pingpong_
 					if (ne <= 0)
 						break;
 
-					tcompleted[ccnt] = get_cycles();
+					if (user_param->servername)
+						tcompleted[ccnt] = get_cycles();
 					if (wc.status != IBV_WC_SUCCESS) {
 						fprintf(stderr, "Completion wth error at %s:\n",
 							user_param->servername ? "client" : "server");
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/send_bw/SOURCES
branches\winverbs\tests\perftest/send_bw/SOURCES
--- trunk\tests\perftest/send_bw/SOURCES	2008-12-17 11:06:43.242375000 -0800
+++ branches\winverbs\tests\perftest/send_bw/SOURCES	2009-02-23 12:21:10.616145700 -0800
@@ -10,11 +10,10 @@ USE_STL = 1
 USE_NATIVE_EH = 1
 USE_IOSTREAM = 1
 
-SOURCES =			\
-	send_bw.rc		\
-	send_bw.c
+SOURCES = send_bw.rc send_bw.c ..\perftest.c
 	
-INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user;
+INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
+		   ..\..\..\inc;..\..\..\inc\user;
 
 TARGETLIBS =						\
 	$(SDK_LIB_PATH)\kernel32.lib	\
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/send_lat/send_lat.c
branches\winverbs\tests\perftest/send_lat/send_lat.c
--- trunk\tests\perftest/send_lat/send_lat.c	2009-01-13 23:17:06.703125000 -0800
+++ branches\winverbs\tests\perftest/send_lat/send_lat.c	2009-02-24 12:51:40.877776800 -0800
@@ -38,6 +38,7 @@
 #include <time.h>
 
 #include "..\..\..\etc\user\getopt.c"
+#include "perftest.h"
 #include <infiniband/verbs.h>
 
 #define PINGPONG_SEND_WRID  1
@@ -101,20 +102,6 @@ struct pingpong_dest {
 	unsigned int rkey;
 };
 
-static __inline UINT64 get_cycles()
-{
-	LARGE_INTEGER counter;
-	QueryPerformanceCounter(&counter);
-	return counter.QuadPart;
-}
-
-static __inline UINT64 get_freq()
-{
-	LARGE_INTEGER freq;
-	QueryPerformanceFrequency(&freq);
-	return freq.QuadPart;
-}
-
 static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port)
 {
 	struct ibv_port_attr attr;
@@ -714,31 +701,6 @@ static void usage(const char *argv0)
 	printf("  -g             send messages to multicast group(only available in UD connection\n");
 }
 
-/*
- * When there is an
- *	odd number of samples, the median is the middle number.
- *	even number of samples, the median is the mean of the
- *		two middle numbers.
- *
- */
-static __inline cycles_t get_median(int n, cycles_t delta[])
-{
-	if ((n - 1) % 2)
-		return(delta[n / 2] + delta[n / 2 - 1]) / 2;
-	else
-		return delta[n / 2];
-}
-
-static int __cdecl cycles_compare(const void * aptr, const void * bptr)
-{
-	const cycles_t *a = aptr;
-	const cycles_t *b = bptr;
-	if (*a < *b) return -1;
-	if (*a > *b) return 1;
-	return 0;
-
-}
-
 static void print_report(struct report_options * options,
 			 unsigned int iters, cycles_t *tstamp,int size)
 {
@@ -911,7 +873,8 @@ static int run_iter(struct pingpong_cont
 
 			}
 			/* client post first */
-			tstamp[scnt] = get_cycles();
+			if (user_param->servername)
+				tstamp[scnt] = get_cycles();
 			*post_buf = (char)++scnt;
 			if (ibv_post_send(qp, wr, &bad_wr)) {
 				fprintf(stderr, "Couldn't post send: scnt=%d\n",
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/send_lat/SOURCES
branches\winverbs\tests\perftest/send_lat/SOURCES
--- trunk\tests\perftest/send_lat/SOURCES	2008-12-17 11:06:44.429875000 -0800
+++ branches\winverbs\tests\perftest/send_lat/SOURCES	2009-02-23 12:21:35.303487700 -0800
@@ -10,11 +10,10 @@ USE_STL = 1
 USE_NATIVE_EH = 1
 USE_IOSTREAM = 1
 
-SOURCES =			\
-	send_lat.rc		\
-	send_lat.c
+SOURCES = send_lat.rc send_lat.c ..\perftest.c
 	
-INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user;
+INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
+		   ..\..\..\inc;..\..\..\inc\user;
 
 TARGETLIBS =						\
 	$(SDK_LIB_PATH)\kernel32.lib	\
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/write_bw/SOURCES
branches\winverbs\tests\perftest/write_bw/SOURCES
--- trunk\tests\perftest/write_bw/SOURCES	2008-12-17 11:06:43.429875000 -0800
+++ branches\winverbs\tests\perftest/write_bw/SOURCES	2009-02-23 12:22:00.350202400 -0800
@@ -10,11 +10,10 @@ USE_STL = 1
 USE_NATIVE_EH = 1
 USE_IOSTREAM = 1
 
-SOURCES =			\
-	write_bw.rc		\
-	write_bw.c
+SOURCES = write_bw.rc write_bw.c ..\perftest.c
 	
-INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user;
+INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
+		   ..\..\..\inc;..\..\..\inc\user;
 
 TARGETLIBS =						\
 	$(SDK_LIB_PATH)\kernel32.lib	\
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/write_bw/write_bw.c
branches\winverbs\tests\perftest/write_bw/write_bw.c
--- trunk\tests\perftest/write_bw/write_bw.c	2008-12-17 11:06:43.429875000 -0800
+++ branches\winverbs\tests\perftest/write_bw/write_bw.c	2009-02-24 11:31:02.603622600 -0800
@@ -37,6 +37,7 @@
 #include <time.h>
 
 #include "..\..\..\etc\user\getopt.c"
+#include "perftest.h"
 #include <infiniband/verbs.h>
 
 #define PINGPONG_RDMA_WRID	3
@@ -90,20 +91,6 @@ struct pingpong_dest {
 	unsigned long long vaddr;
 };
 
-static __inline UINT64 get_cycles()
-{
-	LARGE_INTEGER counter;
-	QueryPerformanceCounter(&counter);
-	return counter.QuadPart;
-}
-
-static __inline UINT64 get_freq()
-{
-	LARGE_INTEGER freq;
-	QueryPerformanceFrequency(&freq);
-	return freq.QuadPart;
-}
-
 static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port)
 {
 	struct ibv_port_attr attr;
@@ -606,8 +593,9 @@ static int run_iter(struct pingpong_cont
       	    ctx->wr.wr.rdma.remote_addr = rem_dest[index]->vaddr;
             ctx->wr.wr.rdma.rkey = rem_dest[index]->rkey;
             qp = ctx->qp[index];
-            ctx->wr.wr_id      = index ;
-            tposted[totscnt] = get_cycles();
+            ctx->wr.wr_id = index;
+			if (user_param->servername)
+	            tposted[totscnt] = get_cycles();
             if (ibv_post_send(qp, &ctx->wr, &bad_wr)) {
                 fprintf(stderr, "Couldn't post warmup send: qp index = %d qp scnt=%d total scnt %d\n",
                         index,ctx->scnt[index],totscnt);
@@ -617,50 +605,59 @@ static int run_iter(struct pingpong_cont
             ++totscnt;
       }
 	}    
+
 	/* main loop for posting */
-	while (totscnt < (user_param->iters * user_param->numofqps)  || totccnt < (user_param->iters * user_param->numofqps) ) {
-	  /* main loop to run over all the qps and post each time n messages */
-	  for (index =0 ; index < user_param->numofqps ; index++) {
-          ctx->wr.wr.rdma.remote_addr = rem_dest[index]->vaddr;
-          ctx->wr.wr.rdma.rkey = rem_dest[index]->rkey;
-          qp = ctx->qp[index];
-          ctx->wr.wr_id      = index ;
-          while (ctx->scnt[index] < user_param->iters && (ctx->scnt[index] - ctx->ccnt[index]) <
user_param->maxpostsofqpiniteration) {
-	      tposted[totscnt] = get_cycles();
-	      if (ibv_post_send(qp, &ctx->wr, &bad_wr)) {
-              fprintf(stderr, "Couldn't post send: qp index = %d qp scnt=%d total scnt %d\n",
-                      index,ctx->scnt[index],totscnt);
-              return 1;
-	      }     
-	      ctx->scnt[index]= ctx->scnt[index]+1;
-	      ++totscnt;
-	    }
-	  }
-	  /* finished posting now polling */
-	  if (totccnt < (user_param->iters * user_param->numofqps) ) {
-	    
-	    int ne;
-	    do {
-	      ne = ibv_poll_cq(ctx->cq, 1, &wc);
-	    } while (ne == 0);
-	    tcompleted[totccnt] = get_cycles();
-        if (ne < 0) {
-	      fprintf(stderr, "poll CQ failed %d\n", ne);
-	      return 1;
-	    }
-	    if (wc.status != IBV_WC_SUCCESS) {
-	      fprintf(stderr, "Completion wth error at %s:\n",
-		      user_param->servername ? "client" : "server");
-	      fprintf(stderr, "Failed status %d: wr_id %d\n",
-		      wc.status, (int) wc.wr_id);
-	      fprintf(stderr, "qp index %d ,qp scnt=%d, qp ccnt=%d total scnt %d total ccnt %d\n",
-		      (int)wc.wr_id, ctx->scnt[(int)wc.wr_id], ctx->ccnt[(int)wc.wr_id], totscnt, totccnt);
-	      return 1;
-	    }
-	    /*here the id is the index to the qp num */
-	    ctx->ccnt[(int)wc.wr_id] = ctx->ccnt[(int)wc.wr_id]+1;
-	    totccnt += 1;
-	  }
+	while (totscnt < (user_param->iters * user_param->numofqps) ||
+		   totccnt < (user_param->iters * user_param->numofqps) ) {
+		/* main loop to run over all the qps and post each time n messages */
+		for (index =0 ; index < user_param->numofqps ; index++) {
+			ctx->wr.wr.rdma.remote_addr = rem_dest[index]->vaddr;
+			ctx->wr.wr.rdma.rkey = rem_dest[index]->rkey;
+			qp = ctx->qp[index];
+			ctx->wr.wr_id = index;
+
+			while (ctx->scnt[index] < user_param->iters &&
+				   (ctx->scnt[index] - ctx->ccnt[index]) < user_param->maxpostsofqpiniteration) {
+				if (user_param->servername)
+					tposted[totscnt] = get_cycles();
+				if (ibv_post_send(qp, &ctx->wr, &bad_wr)) {
+					fprintf(stderr, "Couldn't post send: qp index = %d qp scnt=%d total scnt %d\n",
+							index,ctx->scnt[index],totscnt);
+					return 1;
+				}     
+				ctx->scnt[index]= ctx->scnt[index]+1;
+				++totscnt;
+			}
+		}
+
+		/* finished posting now polling */
+		if (totccnt < (user_param->iters * user_param->numofqps) ) {
+			int ne;
+			do {
+				ne = ibv_poll_cq(ctx->cq, 1, &wc);
+			} while (ne == 0);
+
+			if (user_param->servername)
+				tcompleted[totccnt] = get_cycles();
+
+			if (ne < 0) {
+				fprintf(stderr, "poll CQ failed %d\n", ne);
+				return 1;
+			}
+
+			if (wc.status != IBV_WC_SUCCESS) {
+				fprintf(stderr, "Completion wth error at %s:\n",
+				user_param->servername ? "client" : "server");
+				fprintf(stderr, "Failed status %d: wr_id %d\n",
+				wc.status, (int) wc.wr_id);
+				fprintf(stderr, "qp index %d ,qp scnt=%d, qp ccnt=%d total scnt %d total ccnt %d\n",
+					    (int)wc.wr_id, ctx->scnt[(int)wc.wr_id], ctx->ccnt[(int)wc.wr_id], totscnt, totccnt);
+				return 1;
+			}
+			/*here the id is the index to the qp num */
+			ctx->ccnt[(int)wc.wr_id] = ctx->ccnt[(int)wc.wr_id]+1;
+			totccnt += 1;
+		}
 	}
 	return(0);
 }
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/write_lat/SOURCES
branches\winverbs\tests\perftest/write_lat/SOURCES
--- trunk\tests\perftest/write_lat/SOURCES	2008-12-17 11:06:44.633000000 -0800
+++ branches\winverbs\tests\perftest/write_lat/SOURCES	2009-02-23 12:22:24.365933300 -0800
@@ -10,11 +10,10 @@ USE_STL = 1
 USE_NATIVE_EH = 1
 USE_IOSTREAM = 1
 
-SOURCES =			\
-	write_lat.rc	\
-	write_lat.c
+SOURCES = write_lat.rc write_lat.c ..\perftest.c
 	
-INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user;
+INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
+		   ..\..\..\inc;..\..\..\inc\user;
 
 TARGETLIBS =						\
 	$(SDK_LIB_PATH)\kernel32.lib	\
diff -N -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\tests\perftest/write_lat/write_lat.c
branches\winverbs\tests\perftest/write_lat/write_lat.c
--- trunk\tests\perftest/write_lat/write_lat.c	2008-12-17 11:06:44.820500000 -0800
+++ branches\winverbs\tests\perftest/write_lat/write_lat.c	2009-02-24 11:09:57.794388000 -0800
@@ -38,6 +38,7 @@
 #include <time.h>
 
 #include "..\..\..\etc\user\getopt.c"
+#include "perftest.h"
 #include <infiniband/verbs.h>
 
 #define PINGPONG_RDMA_WRID	3
@@ -87,20 +88,6 @@ struct pingpong_dest {
 	unsigned long long vaddr;
 };
 
-static __inline UINT64 get_cycles()
-{
-	LARGE_INTEGER counter;
-	QueryPerformanceCounter(&counter);
-	return counter.QuadPart;
-}
-
-static __inline UINT64 get_freq()
-{
-	LARGE_INTEGER freq;
-	QueryPerformanceFrequency(&freq);
-	return freq.QuadPart;
-}
-
 static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port)
 {
 	struct ibv_port_attr attr;
@@ -583,30 +570,6 @@ static void usage(const char *argv0)
 	printf("  -V            display version number\n");
 }
 
-/*
- * When there is an
- *	odd number of samples, the median is the middle number.
- * 	even number of samples, the median is the mean of the
- *		two middle numbers.
- *
- */
-static __inline cycles_t get_median(int n, cycles_t delta[])
-{
-	if ((n - 1) % 2)
-		return(delta[n / 2] + delta[n / 2 - 1]) / 2;
-	else
-		return delta[n / 2];
-}
-
-static int __cdecl cycles_compare(const void * aptr, const void * bptr)
-{
-	const cycles_t *a = aptr;
-	const cycles_t *b = bptr;
-	if (*a < *b) return -1;
-	if (*a > *b) return 1;
-	return 0;
-}
-
 static void print_report(struct report_options * options,
 			 unsigned int iters, cycles_t *tstamp,int size)
 {
@@ -711,7 +674,8 @@ static int run_iter(struct pingpong_cont
 
 		if (scnt < user_param->iters) {
 			struct ibv_send_wr *bad_wr;
-			tstamp[scnt] = get_cycles();
+			if (user_param->servername)
+				tstamp[scnt] = get_cycles();
 
 			*post_buf = (char)++scnt;
 





More information about the ofw mailing list