[openib-general] Re: [openib-commits] r2480 - gen2/trunk/src/userspace/perftest

Grant Grundler iod00d at hp.com
Wed Jun 8 16:40:57 PDT 2005


On Wed, Jun 08, 2005 at 08:50:30AM +0300, Michael S. Tsirkin wrote:
> > The numbers (MByte/cycles) don't mean anything to me.
> > Can we report this as cycles/MB (or KB) instead? (aka Service Demand)
> 
> Sure. Patch?

Appended. Please apply.

> > The other metric I care about is MB/s.
> 
> Dont pass -C then.

Doh! Of course.
-C makes no sense in this context.
It's removed in the patch below.

Here is a sample output:

grundler at iota:/usr/src/openib_gen2/src/userspace/perftest$ ./rdma_bw -b -n 10000 -s 32768 10.0.0.51
  local address:  LID 0x06, QPN 0x280406, PSN 0x929ad8 RKey 0xf00434 VAddr 0x600000000001c000
  remote address: LID 0x04, QPN 0x270406, PSN 0x61c246, RKey 0xea0434 VAddr 0x600000000001c000
Bandwidth peak (#0 to #7080): 722.421 MB/sec
Bandwidth average: 721.997 MB/sec
Service Demand peak (#0 to #7080): 2027 cycles/KB
Service Demand Avg  : 2028 cycles/KB

thanks,
grant


Index: rdma_bw.c
===================================================================
--- rdma_bw.c	(revision 2570)
+++ rdma_bw.c	(working copy)
@@ -61,10 +61,6 @@
 
 static int page_size;
 
-struct report_options {
-	int cycles;   /* report delta's in cycles, not microsec's */
-};
-
 struct pingpong_context {
 	struct ibv_context *context;
 	struct ibv_pd      *pd;
@@ -422,19 +418,14 @@ static void usage(const char *argv0)
 	printf("  -t, --tx-depth=<dep>   size of tx queue (default 100)\n");
 	printf("  -n, --iters=<iters>    number of exchanges (at least 2, default 1000)\n");
 	printf("  -b, --bidirectional    measure bidirectional bandwidth (default unidirectional)\n");
-	printf("  -C, --report-cycles    report times in cpu cycle units (default seconds)\n");
-	printf("  -H, --report-histogram print out all results (default print summary only)\n");
-	printf("  -U, --report-unsorted  (implies -H) print out unsorted results (default sorted)\n");
 }
 
-static void print_report(struct report_options * options,
-			 unsigned int iters, double size, int duplex,
+static void print_report(unsigned int iters, int size, int duplex,
 			 cycles_t *tposted, cycles_t *tcompleted)
 {
 	double cycles_to_units;
-	double tsize; /* Transferred size, in megabytes */
+	unsigned long tsize;	/* Transferred size, in megabytes */
 	int i, j;
-	const char* units;
 	int opt_posted = 0, opt_completed = 0;
 	cycles_t opt_delta;
 	cycles_t t;
@@ -453,19 +444,21 @@ static void print_report(struct report_o
 			}
 		}
 
-	if (options->cycles) {
-		cycles_to_units = 1;
-		units = "cycles";
-	} else {
-		cycles_to_units = get_cpu_mhz() * 1000000;
-		units = "sec";
-	}
+	cycles_to_units = get_cpu_mhz() * 1000000;
 
 	tsize = duplex ? 2 : 1;
-	tsize = tsize * size / 0x100000;
+	tsize = tsize * size / 1024;
 
-	printf("Bandwidth peak (#%d to #%d): %g MByte/%s\n", opt_posted, opt_completed, tsize * cycles_to_units / opt_delta, units);
-	printf("Bandwidth average: %g MByte/%s\n", tsize * iters * cycles_to_units / (tcompleted[iters - 1] - tposted[0]), units);
+	printf("Bandwidth peak (#%d to #%d): %g MB/sec\n",
+			 opt_posted, opt_completed,
+			 tsize * cycles_to_units / opt_delta / 1024);
+	printf("Bandwidth average: %g MB/sec\n",
+			 tsize * iters * cycles_to_units / (tcompleted[iters - 1] - tposted[0]) / 1024);
+
+	printf("Service Demand peak (#%d to #%d): %ld cycles/KB\n",
+			 opt_posted, opt_completed, opt_delta/tsize);
+	printf("Service Demand Avg  : %ld cycles/KB\n",
+			 (tcompleted[iters - 1] - tposted[0])/(tsize * iters));
 }
 
 
@@ -480,14 +473,13 @@ int main(int argc, char *argv[])
 	char                    *servername = NULL;
 	int                      port = 18515;
 	int                      ib_port = 1;
-	int                      size = 1;
+	int                      size = 4 * 1024;
 	int                      tx_depth = 100;
 	int                      iters = 1000;
 	int                      scnt, ccnt;
 	int			 sockfd;
 	int                      duplex = 0;
 	struct ibv_qp		*qp;
-	struct report_options    report = {};
 
 	cycles_t	*tposted;
 	cycles_t	*tcompleted;
@@ -504,11 +496,10 @@ int main(int argc, char *argv[])
 			{ .name = "iters",          .has_arg = 1, .val = 'n' },
 			{ .name = "tx-depth",       .has_arg = 1, .val = 't' },
 			{ .name = "bidirectional",  .has_arg = 0, .val = 'b' },
-			{ .name = "report-cycles",  .has_arg = 0, .val = 'C' },
 			{ 0 }
 		};
 
-		c = getopt_long(argc, argv, "p:d:i:s:n:t:bC", long_options, NULL);
+		c = getopt_long(argc, argv, "p:d:i:s:n:t:b", long_options, NULL);
 		if (c == -1)
 			break;
 
@@ -565,10 +556,6 @@ int main(int argc, char *argv[])
 			duplex = 1;
 			break;
 
-		case 'C':
-			report.cycles = 1;
-			break;
-
 		default:
 			usage(argv[0]);
 			return 1;
@@ -751,7 +738,7 @@ int main(int argc, char *argv[])
 	write(sockfd, "done", sizeof "done");
 	close(sockfd);
 
-	print_report(&report, iters, size, duplex, tposted, tcompleted);
+	print_report(iters, size, duplex, tposted, tcompleted);
 
 	free(tposted);
 	free(tcompleted);



More information about the general mailing list