Skip to content

Commit

Permalink
workloadgen: add option to specify the max number of in-flight txs.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Joao Eduardo Luis committed May 8, 2012
1 parent 662729f commit f2a2a6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/test/filestore/workload_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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\
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/test/filestore/workload_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f2a2a6e

Please sign in to comment.