vector<int> out;
if (use_crush) {
- if (verbose > 2)
+ if (output_statistics)
err << "CRUSH"; // prepend CRUSH to placement output
crush.do_rule(r, x, out, nr, weight);
} else {
- if (verbose > 2)
+ if (output_statistics)
err << "RNG"; // prepend RNG to placement output to denote simulation
#ifdef HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION
#endif
}
- if (verbose)
- if (verbose>1 )
- err << " rule " << r << " x " << x << " " << out << std::endl;
+
+ if (output_statistics)
+ err << " rule " << r << " x " << x << " " << out << std::endl;
for (unsigned i = 0; i < out.size(); i++) {
per[out[i]]++;
temporary_per[out[i]]++;
}
for (unsigned i = 0; i < per.size(); i++)
- if (verbose>1 )
+ if (output_utilization && !output_statistics)
err << " device " << i
<< ":\t" << per[i]
<< std::endl;
}
#endif
- if (verbose > 1)
+ if (output_statistics)
for (unsigned i = 0; i < per.size(); i++) {
- if (verbose < 5 ){
+ if (output_utilization && num_batches > 1){
if (num_objects_expected[i] > 0 && per[i] > 0) {
err << " device " << i << ":\t"
<< "\t" << " stored " << ": " << per[i]
#endif
<< std::endl;
}
- } else {
+ } else if (output_utilization_all && num_batches > 1) {
err << " device " << i << ":\t"
<< "\t" << " stored " << ": " << per[i]
<< "\t" << " expected " << ": " << num_objects_expected[i]
//err << " total system weight (dec) = " << (total_weight / (float) 0x10000) << std::endl;
//err << " number of buckets = " << num_buckets << std::endl;
- if (num_batches > 1) {
+ if (num_batches > 1 && output_statistics) {
err << " " << num_devices_failing_at_five_percent << "/" << num_devices_active << " ("
<< (100.0*((float) num_devices_failing_at_five_percent / (float) num_devices_active))
<< "%) devices failed testing at 5% confidence level" << std::endl;
float mark_down_percentage;
int mark_down_start;
int down_range;
+ bool output_utilization;
+ bool output_utilization_all;
+ bool output_statistics;
public:
CrushTester(CrushWrapper& c, ostream& eo, int verbosity=0)
down_range(1)
{ }
- void set_verbosity(int v) {
- verbose = v;
+ void set_output(bool set_output_utilization, bool set_output_utilization_all, bool set_output_statistics) {
+ output_utilization = set_output_utilization;
+ output_utilization_all = set_output_utilization_all;
+ output_statistics = set_output_statistics;
}
void set_batches(int b) {
num_batches = b;
cout << " [--min-rule r] [--max-rule r] [--rule r]\n";
cout << " [--num-rep n]\n";
cout << " [--batches b]\n";
- cout << " [--simulate]\n";
+ cout << " --simulate simulate placements using a RNG\n";
cout << " [--weight|-w devno weight]\n";
cout << " where weight is 0 to 1.0\n";
cout << " -i mapfn --add-item id weight name [--loc type name ...]\n";
cout << " reweight a given item (and adjust ancestor\n"
<< " weights as needed)\n";
cout << " -i mapfn --reweight recalculate all bucket weights\n";
+ cout << " --output-utilization output OSD usage\n";
+ cout << " --output utilization-all include zero weight items\n";
+ cout << " --output-statistics output chi squared statistics\n";
exit(1);
}
bool decompile = false;
bool test = false;
bool verbose = false;
+ bool output_utilization = false;
+ bool output_utilization_all = false;
+ bool output_statistics = false;
bool reweight = false;
int add_item = -1;
outfn = val;
} else if (ceph_argparse_flag(args, i, "-v", "--verbose", (char*)NULL)) {
verbose = true;
- } else if (ceph_argparse_withint(args, i, &x, &err, "-vl", "--verbose-level", (char*)NULL)) {
- if (!err.str().empty()) {
- cerr << err.str() << std::endl;
- exit(EXIT_FAILURE);
- }
- tester.set_verbosity(x);
+ } else if (ceph_argparse_flag(args, i, "--output_utilization", (char*)NULL)) {
+ output_utilization = true;
+ } else if (ceph_argparse_flag(args, i, "--output_utilization_all", (char*)NULL)) {
+ output_utilization_all = true;
+ } else if (ceph_argparse_flag(args, i, "--output_statistics", (char*)NULL)) {
+ output_statistics = true;
} else if (ceph_argparse_witharg(args, i, &val, "-c", "--compile", (char*)NULL)) {
srcfn = val;
compile = true;
}
if (test) {
+ tester.set_output(output_utilization, output_utilization_all, output_statistics);
int r = tester.test();
if (r < 0)
exit(1);