From 19cb87f388785d6727d30dbe3c16d87d5c2b16c8 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Thu, 4 Feb 2010 17:14:12 -0800 Subject: [PATCH] Hook synthetic NFS client into test script. --- microbench/run.sh | 5 +++++ nfs3/synclient.c | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/microbench/run.sh b/microbench/run.sh index f122370..9c40e0d 100755 --- a/microbench/run.sh +++ b/microbench/run.sh @@ -48,6 +48,11 @@ run_test() { echo "Running test" 1>&2 (cd /mnt/bluesky; $BLUESKY/microbench/readbench "$@") >results-t$1-s$BLUESKY_OPT_SYNC_FRONTENDS run_cleanup + + run_setup + echo "Running synthetic test" 1>&2 + ($BLUESKY/nfs3/synclient "$@") >results-t$1s-s$BLUESKY_OPT_SYNC_FRONTENDS + run_cleanup } benchmark_setup diff --git a/nfs3/synclient.c b/nfs3/synclient.c index fc33146..4db3cc8 100644 --- a/nfs3/synclient.c +++ b/nfs3/synclient.c @@ -35,6 +35,9 @@ /* Maximum size of a single RPC message that we will accept (8 MB). */ #define MAX_RPC_MSGSIZE (8 << 20) +int threads; +int completed = 0; + struct rpc_reply { uint32_t xid; uint32_t type; @@ -173,13 +176,17 @@ static void process_reply(NFSConnection *nfs, GString *msg) } info->end = now_hires(); - g_print("Call(XID = %d) duration: %"PRIi64" ns\n", - xid, info->end - info->start); + printf("XID %d: Time = %"PRIi64"\n", xid, info->end - info->start); if (info->callback != NULL) info->callback(nfs, info->user_data); g_hash_table_remove(nfs->xid_table, key); g_free(info); + + completed++; + if (completed == threads) { + g_main_loop_quit(main_loop); + } } static gboolean read_handler(GIOChannel *channel, @@ -266,7 +273,7 @@ static gboolean idle_handler(gpointer data) int i; g_print("Sending requests...\n"); - for (i = 0; i < 64; i++) { + for (i = 0; i < threads; i++) { char buf[64]; struct diropargs3 lookup; uint64_t rootfh = GUINT64_TO_BE(1); @@ -336,6 +343,10 @@ int main(int argc, char *argv[]) g_set_prgname("synclient"); g_print("Launching synthetic NFS RPC client...\n"); + threads = 8; + if (argc > 1) + threads = atoi(argv[1]); + main_loop = g_main_loop_new(NULL, FALSE); nfs_connect("niniel.sysnet.ucsd.edu"); -- 2.20.1