]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rest-bench: change command line arg for seconds
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 26 Apr 2012 23:53:36 +0000 (16:53 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Fri, 4 May 2012 22:53:26 +0000 (15:53 -0700)
seconds should be a param, not a command.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
src/tools/rest_bench.cc

index 44d2800461b7358334515e6e0169c004a0fce028..3aeaf747092c2e1a7ea29a7f9660275ea551c2ec 100644 (file)
 void usage(ostream& out)
 {
   out <<                                       \
-"usage: rest_bench [options] <seconds> <write|seq>\n"
+"usage: rest-bench [options] <write|seq>\n"
 "BENCHMARK OPTIONS\n"
+"   --seconds\n"
+"        benchmak length (default: 60)\n"
 "   -t concurrent_operations\n"
 "   --concurrent-ios=concurrent_operations\n"
 "        select bucket by name\n"
@@ -488,6 +490,7 @@ int main(int argc, const char **argv)
   std::string proto_str;
   int concurrent_ios = 16;
   int op_size = 1 << 22;
+  int seconds = 60;
 
 
   for (i = args.begin(); i != args.end(); ) {
@@ -528,6 +531,8 @@ int main(int argc, const char **argv)
       }
     } else if (ceph_argparse_witharg(args, i, &val, "-t", "--concurrent-ios", (char*)NULL)) {
       concurrent_ios = strtol(val.c_str(), NULL, 10);
+    } else if (ceph_argparse_witharg(args, i, &val, "--seconds", (char*)NULL)) {
+      seconds = strtol(val.c_str(), NULL, 10);
     } else if (ceph_argparse_witharg(args, i, &val, "-b", "--block-size", (char*)NULL)) {
       op_size = strtol(val.c_str(), NULL, 10);
     } else {
@@ -541,15 +546,14 @@ int main(int argc, const char **argv)
     cerr << "rest-bench: bucket not specified" << std::endl;
     usage_exit();
   }
-  if (args.size() < 2)
+  if (args.size() < 1)
     usage_exit();
-  int seconds = atoi(args[0]);
   int operation = 0;
-  if (strcmp(args[1], "write") == 0)
+  if (strcmp(args[0], "write") == 0)
     operation = OP_WRITE;
-  else if (strcmp(args[1], "seq") == 0)
+  else if (strcmp(args[0], "seq") == 0)
     operation = OP_SEQ_READ;
-  else if (strcmp(args[1], "rand") == 0)
+  else if (strcmp(args[0], "rand") == 0)
     operation = OP_RAND_READ;
   else
     usage_exit();