mirror of
https://github.com/ceph/ceph
synced 2024-12-19 01:46:00 +00:00
CrushTester: clean up output interface
Multiple accessors. Init in ctor. Avoid temp vars in crushtool. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
dba70eedbe
commit
eaad984545
@ -25,6 +25,8 @@ class CrushTester {
|
||||
float mark_down_percentage;
|
||||
int mark_down_start;
|
||||
int down_range;
|
||||
|
||||
public:
|
||||
bool output_utilization;
|
||||
bool output_utilization_all;
|
||||
bool output_statistics;
|
||||
@ -44,20 +46,30 @@ public:
|
||||
down_range_marked(false),
|
||||
mark_down_percentage(0.0),
|
||||
mark_down_start(0),
|
||||
down_range(1)
|
||||
down_range(1),
|
||||
output_utilization(false),
|
||||
output_utilization_all(false),
|
||||
output_statistics(false),
|
||||
output_bad_mappings(false),
|
||||
output_choose_tries(false)
|
||||
{ }
|
||||
|
||||
void set_output(bool set_output_utilization,
|
||||
bool set_output_utilization_all,
|
||||
bool set_output_statistics,
|
||||
bool set_output_bad_mappings,
|
||||
bool set_output_choose_tries) {
|
||||
output_utilization = set_output_utilization;
|
||||
output_utilization_all = set_output_utilization_all;
|
||||
output_statistics = set_output_statistics;
|
||||
output_bad_mappings = set_output_bad_mappings;
|
||||
output_choose_tries = set_output_choose_tries;
|
||||
void set_output_utilization(bool b) {
|
||||
output_utilization = b;
|
||||
}
|
||||
void set_output_utilization_all(bool b) {
|
||||
output_utilization_all = b;
|
||||
}
|
||||
void set_output_statistics(bool b) {
|
||||
output_statistics = b;
|
||||
}
|
||||
void set_output_bad_mappings(bool b) {
|
||||
output_bad_mappings = b;
|
||||
}
|
||||
void set_output_choose_tries(bool b) {
|
||||
output_choose_tries = b;
|
||||
}
|
||||
|
||||
void set_batches(int b) {
|
||||
num_batches = b;
|
||||
}
|
||||
|
@ -118,11 +118,6 @@ int main(int argc, const char **argv)
|
||||
bool decompile = false;
|
||||
bool test = false;
|
||||
bool verbose = false;
|
||||
bool output_utilization = false;
|
||||
bool output_utilization_all = false;
|
||||
bool output_statistics = false;
|
||||
bool output_bad_mappings = false;
|
||||
bool output_choose_tries = false;
|
||||
|
||||
bool reweight = false;
|
||||
int add_item = -1;
|
||||
@ -169,15 +164,15 @@ int main(int argc, const char **argv)
|
||||
} else if (ceph_argparse_flag(args, i, "-v", "--verbose", (char*)NULL)) {
|
||||
verbose = true;
|
||||
} else if (ceph_argparse_flag(args, i, "--output_utilization", (char*)NULL)) {
|
||||
output_utilization = true;
|
||||
tester.set_output_utilization(true);
|
||||
} else if (ceph_argparse_flag(args, i, "--output_utilization_all", (char*)NULL)) {
|
||||
output_utilization_all = true;
|
||||
tester.set_output_utilization_all(true);
|
||||
} else if (ceph_argparse_flag(args, i, "--output_statistics", (char*)NULL)) {
|
||||
output_statistics = true;
|
||||
tester.set_output_statistics(true);
|
||||
} else if (ceph_argparse_flag(args, i, "--output_bad_mappings", (char*)NULL)) {
|
||||
output_bad_mappings = true;
|
||||
tester.set_output_bad_mappings(true);
|
||||
} else if (ceph_argparse_flag(args, i, "--output_choose_tries", (char*)NULL)) {
|
||||
output_choose_tries = true;
|
||||
tester.set_output_choose_tries(true);
|
||||
} else if (ceph_argparse_witharg(args, i, &val, "-c", "--compile", (char*)NULL)) {
|
||||
srcfn = val;
|
||||
compile = true;
|
||||
@ -601,8 +596,6 @@ int main(int argc, const char **argv)
|
||||
}
|
||||
|
||||
if (test) {
|
||||
tester.set_output(output_utilization, output_utilization_all, output_statistics,
|
||||
output_bad_mappings, output_choose_tries);
|
||||
int r = tester.test();
|
||||
if (r < 0)
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user