From: Chas Williams (CONTRACTOR) Date: Fri, 1 Oct 2010 13:40:16 +0000 (-0400) Subject: add option to rxperf to use rx_Readv() instead of rx_Read() X-Git-Tag: openafs-devel-1_5_78~95 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2dd3b7a8ec57580fb22eee22a9cbd67204b92135;p=packages%2Fo%2Fopenafs.git add option to rxperf to use rx_Readv() instead of rx_Read() rx_Readv() is a bit "faster" than rx_Read() and typically used by most afs transaction. server% rxperf server client% rxperf client -c send -s server SEND: threads 1, times 100, bytes 1048576: 2073 msec server% rxperf server -v client% rxperf client -c send -s server SEND: threads 1, times 100, bytes 1048576: 983 msec Reviewed-on: http://gerrit.openafs.org/2877 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 12e6531f0079597280e1b3961738af55d682d3f5) Change-Id: Ia54818dddd693dfe5b41e8459f55453dd1c8361f Reviewed-on: http://gerrit.openafs.org/3040 --- diff --git a/src/rx/test/rxperf.c b/src/rx/test/rxperf.c index aa408244c..0b1cc7536 100644 --- a/src/rx/test/rxperf.c +++ b/src/rx/test/rxperf.c @@ -277,18 +277,30 @@ char somebuf[RXPERF_BUFSIZE]; afs_int32 rxwrite_size = sizeof(somebuf); afs_int32 rxread_size = sizeof(somebuf); +afs_int32 use_rx_readv = 0; static int readbytes(struct rx_call *call, afs_int32 bytes) { + struct iovec tiov[RX_MAXIOVECS]; afs_int32 size; + int tnio; + int code; while (bytes > 0) { size = rxread_size; + if (size > bytes) size = bytes; - if (rx_Read(call, somebuf, size) != size) - return 1; + if (use_rx_readv) { + if (size > RX_MAX_PACKET_DATA_SIZE) + size = RX_MAX_PACKET_DATA_SIZE; + code = rx_Readv(call, tiov, &tnio, RX_MAXIOVECS, size); + } else + code = rx_Read(call, somebuf, size); + if (code != size) + return 1; + bytes -= size; } return 0; @@ -928,7 +940,7 @@ rxperf_server(int argc, char **argv) char *ptr; int ch; - while ((ch = getopt(argc, argv, "r:d:p:P:w:W:HNjm:u:4:s:S")) != -1) { + while ((ch = getopt(argc, argv, "r:d:p:P:w:W:HNjm:u:4:s:SV")) != -1) { switch (ch) { case 'd': #ifdef RXDEBUG @@ -994,6 +1006,9 @@ rxperf_server(int argc, char **argv) if (ptr && *ptr != '\0') errx(1, "can't resolve upd buffer size (Kbytes)"); break; + case 'V': + use_rx_readv = 1; + break; case 'W': maxwsize = strtol(optarg, &ptr, 0); if (ptr && *ptr != '\0') @@ -1045,7 +1060,7 @@ rxperf_client(int argc, char **argv) cmd = RX_PERF_UNKNOWN; - while ((ch = getopt(argc, argv, "T:S:R:b:c:d:p:P:r:s:w:W:f:HDNjm:u:4:t:")) != -1) { + while ((ch = getopt(argc, argv, "T:S:R:b:c:d:p:P:r:s:w:W:f:HDNjm:u:4:t:V")) != -1) { switch (ch) { case 'b': bytes = strtol(optarg, &ptr, 0); @@ -1096,6 +1111,9 @@ rxperf_client(int argc, char **argv) if (host == NULL) err(1, "strdup"); break; + case 'V': + use_rx_readv = 1; + break; case 'w': rxwrite_size = strtol(optarg, &ptr, 0); if (ptr != 0 && ptr[0] != '\0')