From ba8aa58197fb14a7097629885fa9e16c4369dfe4 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 18 Nov 2009 10:08:05 -0800 Subject: [PATCH] rados: remove unused paramater, add very primitive read bench in verify step --- src/rados.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/rados.cc b/src/rados.cc index 5309aae9ec8..37be6c731e0 100644 --- a/src/rados.cc +++ b/src/rados.cc @@ -47,7 +47,7 @@ void usage() cerr << " mksnap foo -- create snap 'foo'\n"; cerr << " rmsnap foo -- remove snap 'foo'\n\n"; - cerr << " bench [-t concurrentwrites] [-b writesize] [verify] [sync]\n"; + cerr << " bench [-t concurrentwrites] [-b writesize] [verify]\n"; cerr << " default is 16 concurrent IOs and 4 MB writes size\n\n"; cerr << "Options:\n"; @@ -150,7 +150,7 @@ void *status_printer(void * data_store) { int aio_bench(Rados& rados, rados_pool_t pool, int secondsToRun, - int concurrentios, int writeSize, int readOffResults, int sync) { + int concurrentios, int writeSize, int readOffResults) { cout << "Maintaining " << concurrentios << " concurrent writes of " << writeSize << " bytes for at least " @@ -287,17 +287,29 @@ int aio_bench(Rados& rados, rados_pool_t pool, int secondsToRun, char matchName[128]; object_t oid; bufferlist actualContents; + utime_t start_time; + utime_t lat; + double total_latency = 0; + double avg_latency; + double avg_bw; for (int i = 0; i < writesCompleted; ++i ) { snprintf(matchName, 128, "Object %s:%d", iTime, i); oid = object_t(matchName); snprintf(contentsChars, writeSize, "I'm the %dth object!", i); + start_time = g_clock.now(); rados.read(pool, oid, 0, actualContents, writeSize); + lat = g_clock.now() - start_time; + total_latency += (double) lat; if (strcmp(contentsChars, actualContents.c_str()) != 0 ) { cerr << "Object " << matchName << " is not correct!"; ++errors; } actualContents.clear(); } + avg_latency = total_latency / writesCompleted; + avg_bw = writesCompleted * writeSize / (total_latency) / (1024 *1024); + cout << "read avg latency: " << avg_latency + << " read avg bw: " << avg_bw << std::endl; } double bandwidth; bandwidth = ((double)writesCompleted)*((double)writeSize)/(double)timePassed; @@ -590,17 +602,14 @@ int main(int argc, const char **argv) if (!pool || nargs.size() < 2) usage(); int seconds = atoi(nargs[1]); - int sync = 0; int verify = 0; for (unsigned i=2; i