]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
workloadgen: add option to specify the max number of in-flight txs.
authorJoao Eduardo Luis <joao.luis@inktank.com>
Mon, 7 May 2012 22:28:18 +0000 (15:28 -0700)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Tue, 8 May 2012 02:54:32 +0000 (19:54 -0700)
Use '--test-max-in-flight VAL' (default: 50) or check '--help' for more.
Also, allow the test to work even if we don't specify a conf file.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/test/filestore/workload_generator.cc
src/test/filestore/workload_generator.h

index f78121de1b1cc08f61c5147aada4b11faca182fa..99e57db32ca93620330d84e610c0bea56093dd65 100644 (file)
@@ -41,6 +41,7 @@ boost::scoped_ptr<WorkloadGenerator> wrkldgen;
 
 WorkloadGenerator::WorkloadGenerator(vector<const char*> args)
   : TestFileStoreState(NULL),
+    m_max_in_flight(def_max_in_flight),
     m_num_ops(-1),
     m_destroy_coll_every_nr_runs(def_destroy_coll_every_nr_runs),
     m_num_colls(def_num_colls),
@@ -69,7 +70,7 @@ WorkloadGenerator::WorkloadGenerator(vector<const char*> args)
   err = m_store->mount();
   ceph_assert(err == 0);
 
-  set_max_in_flight(max_in_flight);
+  set_max_in_flight(m_max_in_flight);
   set_num_objs_per_coll(def_num_obj_per_coll);
 
   init(m_num_colls, 0);
@@ -152,6 +153,9 @@ void WorkloadGenerator::init_args(vector<const char*> args)
     } else if (ceph_argparse_witharg(args, i, &val,
         "--test-num-ops", (char*) NULL)) {
       m_num_ops = strtoll(val.c_str(), NULL, 10);
+    } else if (ceph_argparse_witharg(args, i, &val,
+        "--test-max-in-flight", (char*) NULL)) {
+      m_max_in_flight = strtoll(val.c_str(), NULL, 10);
     } else if (ceph_argparse_witharg(args, i, &val,
         "--test-write-data-size", (char*) NULL)) {
       m_write_data_bytes = _parse_size_or_die(val);
@@ -519,6 +523,8 @@ Test-specific Options:\n\
                                       destroying a collection.\n\
   --test-num-ops VAL                  Run a certain number of operations\n\
                                       (a VAL of 0 runs the test forever)\n\
+   --test-max-in-flight VAL           Maximum number of in-flight transactions\n\
+                                      (default: 50)\n\
    --test-suppress-ops OPS            Suppress ops specified in OPS\n\
    --test-write-data-size SIZE        Specify SIZE for all data writes\n\
    --test-write-xattr-obj-size SIZE   Specify SIZE for all xattrs on objects\n\
@@ -556,7 +562,8 @@ int main(int argc, const char *argv[])
   argv_to_vec(argc, argv, args);
 
   global_init(&def_args, args,
-      CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+      CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY,
+      CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
   g_ceph_context->_conf->apply_changes(NULL);
 
index 8814df7ae51e3e620e95118ce6f418380c50526e..a1444d8ea62ad285941dd74aae10ad197ac1102b 100644 (file)
@@ -26,7 +26,7 @@ typedef boost::mt11213b rngen_t;
 
 class WorkloadGenerator : public TestFileStoreState {
  public:
-  static const int max_in_flight = 50;
+  static const int def_max_in_flight = 50;
 
   static const int def_destroy_coll_every_nr_runs = 100;
   static const int def_num_obj_per_coll = 6000;
@@ -58,6 +58,7 @@ class WorkloadGenerator : public TestFileStoreState {
 
 
  protected:
+  int m_max_in_flight;
   int m_num_ops;
   int m_destroy_coll_every_nr_runs;
   atomic_t m_nr_runs;