rxperf: use parallel connections

When the number of threads exceeds RX_MAXCALLS allocate additional
rx connection objects.

Reviewed-on: http://gerrit.openafs.org/3285
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit df682aa341)

Change-Id: Ia699fe0230e6dde2bc1f270d766f512f2693c94f
Reviewed-on: http://gerrit.openafs.org/8421
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
Jeffrey Altman 2010-11-08 11:07:14 -05:00 committed by Stephan Wiesand
parent fb95823877
commit 4c084a67e6

View File

@ -832,23 +832,6 @@ do_client(const char *server, short port, char *filename, afs_int32 command,
get_sec(0, &secureobj, &secureindex);
conn = rx_NewConnection(addr, htons(port), RX_SERVER_ID, secureobj, secureindex);
if (conn == NULL)
errx(1, "failed to contact server");
#ifdef AFS_PTHREAD_ENV
pthread_attr_init(&tattr);
pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_JOINABLE);
#endif
params->conn = conn;
params->filename = filename;
params->command = command;
params->times = times;
params->bytes = bytes;
params->sendbytes = sendbytes;
params->readbytes = readbytes;
switch (command) {
case RX_PERF_RPC:
sprintf(stamp, "RPC: threads\t%d, times\t%d, write bytes\t%d, read bytes\t%d",
@ -868,11 +851,38 @@ do_client(const char *server, short port, char *filename, afs_int32 command,
break;
}
conn = rx_NewConnection(addr, htons(port), RX_SERVER_ID, secureobj, secureindex);
if (conn == NULL)
errx(1, "failed to contact server");
#ifdef AFS_PTHREAD_ENV
pthread_attr_init(&tattr);
pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_JOINABLE);
#endif
params->conn = conn;
params->filename = filename;
params->command = command;
params->times = times;
params->bytes = bytes;
params->sendbytes = sendbytes;
params->readbytes = readbytes;
start_timer();
#ifdef AFS_PTHREAD_ENV
for ( i=0; i<threads; i++)
for ( i=0; i<threads; i++) {
pthread_create(&thread[i], &tattr, client_thread, params);
if ( (i + 1) % RX_MAXCALLS == 0 ) {
conn = rx_NewConnection(addr, htons(port), RX_SERVER_ID, secureobj, secureindex);
if (conn != NULL) {
struct client_data *new_params = malloc(sizeof(struct client_data));
memcpy(new_params, params, sizeof(struct client_data));
new_params->conn = conn;
params = new_params;
}
}
}
#else
client_thread(params);
#endif