Cleaned some lingering references to "verbose"

Signed-off-by: caleb miles <caleb.miles@inktank.com>
This commit is contained in:
caleb miles 2012-06-08 11:34:38 -07:00
parent 3876dbfdd7
commit 3eca3604f0

View File

@ -60,25 +60,22 @@ int CrushTester::test()
num_devices_active++;
// allow for the user to mark a range or a percentage of the total devices down
if (batch_mark_down) {
if (down_percentage_marked) {
for (int o = 0; o < mark_down_percentage*crush.get_max_devices(); o++) {
device_weight[(o*crush.get_max_devices()*mark_down_percentage)] = 0;
num_devices_active--;
}
} else if (down_range_marked) {
for (int o = mark_down_start; o <= (mark_down_start + down_range); o++) {
device_weight[o] = 0;
num_devices_active--;
}
}
}
// Rather than just failing when we ask for more replicas than we have buckets
//int numBuckets = crush.get_max_buckets(); // We might want to check that all these buckets are filled one day...
//int num_buckets = crush.get_bucket_size(-1); // grab the number of items in the default bucket, will have to change ID
// if (batch_mark_down) {
// if (down_percentage_marked) {
// for (int o = 0; o < mark_down_percentage*crush.get_max_devices(); o++) {
// device_weight[(o*crush.get_max_devices()*mark_down_percentage)] = 0;
// num_devices_active--;
// }
// } else if (down_range_marked) {
// for (int o = mark_down_start; o <= (mark_down_start + down_range); o++) {
// device_weight[o] = 0;
// num_devices_active--;
// }
// }
// }
// all osds in
vector<__u32> weight;
@ -87,7 +84,7 @@ int CrushTester::test()
weight.push_back(device_weight[o]);
else
weight.push_back(0x10000);
if (verbose > 3 )
if (output_utilization_all)
err << "devices weights (hex): " << hex << weight << dec << std::endl;
if (output_choose_tries)
@ -96,7 +93,7 @@ int CrushTester::test()
for (int r = min_rule; r < crush.get_max_rules() && r <= max_rule; r++) {
if (!crush.rule_exists(r)) {
if (verbose>0)
if (output_statistics)
err << "rule " << r << " dne" << std::endl;
continue;
}
@ -107,7 +104,7 @@ int CrushTester::test()
}
if (verbose>0 )
if (output_statistics)
err << "rule " << r << " (" << crush.get_rule_name(r)
<< "), x = " << min_x << ".." << max_x
<< ", numrep = " << minr << ".." << maxr
@ -144,9 +141,9 @@ int CrushTester::test()
float batch_chi_statistic_one_percent = -1.0;
if (num_batches > 1) {
// look up the chi squared statistic for the 5% and 1% confidence levels
batch_chi_statistic_five_percent = quantile(complement(chi_squared(num_batches-1), 0.05));
batch_chi_statistic_one_percent = quantile(complement(chi_squared(num_batches-1), 0.01));
// look up the chi squared statistic for the 5% and 1% confidence levels
batch_chi_statistic_five_percent = quantile(complement(chi_squared(num_batches-1), 0.05));
batch_chi_statistic_one_percent = quantile(complement(chi_squared(num_batches-1), 0.01));
}
#endif
@ -154,7 +151,7 @@ int CrushTester::test()
int total_weight = 0;
for (unsigned i = 0; i < per.size(); i++)
total_weight += weight[i];
total_weight += weight[i];
// compute the expected number of objects stored per device in the absence of weighting
float expected_objects = min(nr, num_devices_active) * num_objects;
@ -163,7 +160,7 @@ int CrushTester::test()
vector<float> proportional_weights( per.size() );
for (unsigned i = 0; i < per.size(); i++)
proportional_weights[i] = (float) weight[i] / (float) total_weight;
proportional_weights[i] = (float) weight[i] / (float) total_weight;
#ifdef HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION
@ -175,140 +172,140 @@ int CrushTester::test()
vector<float> num_objects_expected(num_devices);
for (unsigned i = 0; i < num_devices; i++)
num_objects_expected[i] = (proportional_weights[i]*expected_objects);
num_objects_expected[i] = (proportional_weights[i]*expected_objects);
for (int currentBatch = 0; currentBatch < num_batches; currentBatch++) {
if (currentBatch == (num_batches - 1)) {
batch_max = max_x;
objects_per_batch = (batch_max - batch_min + 1);
}
float batch_expected_objects = min(nr, num_devices_active) * objects_per_batch;
vector<float> batch_num_objects_expected( per.size() );
for (unsigned i = 0; i < per.size() ; i++)
batch_num_objects_expected[i] = (proportional_weights[i]*batch_expected_objects);
if (currentBatch == (num_batches - 1)) {
batch_max = max_x;
objects_per_batch = (batch_max - batch_min + 1);
}
float batch_expected_objects = min(nr, num_devices_active) * objects_per_batch;
vector<float> batch_num_objects_expected( per.size() );
for (unsigned i = 0; i < per.size() ; i++)
batch_num_objects_expected[i] = (proportional_weights[i]*batch_expected_objects);
// create a vector to hold placement results temporarily
vector<int> temporary_per ( per.size() );
vector<int> temporary_per ( per.size() );
for (int x = batch_min; x <= batch_max; x++) {
for (int x = batch_min; x <= batch_max; x++) {
// create a vector to hold the results of a CRUSH placement or RNG simulation
vector<int> out;
// create a vector to hold the results of a CRUSH placement or RNG simulation
vector<int> out;
if (use_crush) {
if (output_statistics)
err << "CRUSH"; // prepend CRUSH to placement output
crush.do_rule(r, x, out, nr, weight);
} else {
if (output_statistics)
err << "RNG"; // prepend RNG to placement output to denote simulation
if (output_statistics)
err << "CRUSH"; // prepend CRUSH to placement output
crush.do_rule(r, x, out, nr, weight);
} else {
if (output_statistics)
err << "RNG"; // prepend RNG to placement output to denote simulation
#ifdef HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION
// fill our vector with random numbers representing an OSD ID
// one day we'll worry about duplicate entries, probably
for (int j = 0; j < nr; j++)
out.push_back( dist(gen) );
// fill our vector with random numbers representing an OSD ID
// one day we'll worry about duplicate entries, probably
for (int j = 0; j < nr; j++)
out.push_back( dist(gen) );
#endif
}
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]]++;
}
batchPer[currentBatch] = temporary_per;
sizes[out.size()]++;
for (unsigned i = 0; i < out.size(); i++) {
per[out[i]]++;
temporary_per[out[i]]++;
}
batchPer[currentBatch] = temporary_per;
sizes[out.size()]++;
if (output_bad_mappings && out.size() != (unsigned)nr) {
cout << "bad mapping rule " << r << " x " << x << " num_rep " << nr << " result " << out << std::endl;
}
}
if (output_bad_mappings && out.size() != (unsigned)nr) {
cout << "bad mapping rule " << r << " x " << x << " num_rep " << nr << " result " << out << std::endl;
}
}
// compute chi squared statistic for device examining the uniformity this batch of placements
for (unsigned i = 0; i < per.size(); i++)
deviceTestChi[i] += pow( (temporary_per[i] - batch_num_objects_expected[i]), 2) / batch_num_objects_expected[i];
batch_min = batch_max + 1;
batch_max = batch_min + objects_per_batch - 1;
for (unsigned i = 0; i < per.size(); i++)
deviceTestChi[i] += pow( (temporary_per[i] - batch_num_objects_expected[i]), 2) / batch_num_objects_expected[i];
batch_min = batch_max + 1;
batch_max = batch_min + objects_per_batch - 1;
}
for (unsigned i = 0; i < per.size(); i++)
if (output_utilization && !output_statistics)
err << " device " << i
<< ":\t" << per[i]
<< std::endl;
if (output_utilization && !output_statistics)
err << " device " << i
<< ":\t" << per[i]
<< std::endl;
for (map<int,int>::iterator p = sizes.begin(); p != sizes.end(); p++)
if ( (verbose>0 ) || p->first != nr)
err << "rule " << r << " (" << crush.get_rule_name(r) << ") num_rep " << nr
<< " result size == " << p->first << ":\t"
<< p->second << "/" << (max_x-min_x+1) << std::endl;
if ( output_statistics || p->first != nr)
err << "rule " << r << " (" << crush.get_rule_name(r) << ") num_rep " << nr
<< " result size == " << p->first << ":\t"
<< p->second << "/" << (max_x-min_x+1) << std::endl;
#ifdef HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION
// compute our overall test chi squared statistic examining the final distribution of placements
for (unsigned i = 0; i < per.size(); i++)
if (num_objects_expected[i] > 0)
test_chi_statistic += pow((num_objects_expected[i] - per[i]),2) / (float) num_objects_expected[i];
if (num_objects_expected[i] > 0)
test_chi_statistic += pow((num_objects_expected[i] - per[i]),2) / (float) num_objects_expected[i];
int num_devices_failing_at_five_percent = 0;
int num_devices_failing_at_one_percent = 0;
for (unsigned i = 0; i < per.size(); i++) {
if (deviceTestChi[i] > batch_chi_statistic_five_percent)
num_devices_failing_at_five_percent++;
if (deviceTestChi[i] > batch_chi_statistic_one_percent)
num_devices_failing_at_one_percent++;
if (deviceTestChi[i] > batch_chi_statistic_five_percent)
num_devices_failing_at_five_percent++;
if (deviceTestChi[i] > batch_chi_statistic_one_percent)
num_devices_failing_at_one_percent++;
}
#endif
if (output_statistics)
for (unsigned i = 0; i < per.size(); i++) {
if (output_utilization && num_batches > 1){
if (num_objects_expected[i] > 0 && per[i] > 0) {
err << " device " << i << ":\t"
<< "\t" << " stored " << ": " << per[i]
<< "\t" << " expected " << ": " << num_objects_expected[i]
for (unsigned i = 0; i < per.size(); i++) {
if (output_utilization && num_batches > 1){
if (num_objects_expected[i] > 0 && per[i] > 0) {
err << " device " << i << ":\t"
<< "\t" << " stored " << ": " << per[i]
<< "\t" << " expected " << ": " << num_objects_expected[i]
#ifdef HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION
<< "\t" << " X^2 " << ": " << deviceTestChi[i]
<< "\t" << " critical (5% confidence) " << ": " << batch_chi_statistic_five_percent
<< "\t" << " (1% confidence) " << ": " << batch_chi_statistic_one_percent
<< "\t" << " X^2 " << ": " << deviceTestChi[i]
<< "\t" << " critical (5% confidence) " << ": " << batch_chi_statistic_five_percent
<< "\t" << " (1% confidence) " << ": " << batch_chi_statistic_one_percent
#endif
<< std::endl;
}
} else if (output_utilization_all && num_batches > 1) {
err << " device " << i << ":\t"
<< "\t" << " stored " << ": " << per[i]
<< "\t" << " expected " << ": " << num_objects_expected[i]
<< std::endl;
}
} else if (output_utilization_all && num_batches > 1) {
err << " device " << i << ":\t"
<< "\t" << " stored " << ": " << per[i]
<< "\t" << " expected " << ": " << num_objects_expected[i]
#ifdef HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION
<< "\t" << " X^2 " << ": " << deviceTestChi[i]
<< "\t" << " critical X^2 (5% confidence) " << ": " << batch_chi_statistic_five_percent
<< "\t" << " (1% confidence) " << ": " << batch_chi_statistic_one_percent
<< "\t" << " X^2 " << ": " << deviceTestChi[i]
<< "\t" << " critical X^2 (5% confidence) " << ": " << batch_chi_statistic_five_percent
<< "\t" << " (1% confidence) " << ": " << batch_chi_statistic_one_percent
#endif
<< std::endl;
}
}
<< std::endl;
}
}
#ifdef HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION
err << " chi squared = " << test_chi_statistic
<< " (vs " << chi_statistic_five_percent << " / "
<< chi_statistic_one_percent
<< " for 5% / 1% confidence level) " << std::endl;
<< " (vs " << chi_statistic_five_percent << " / "
<< chi_statistic_one_percent
<< " for 5% / 1% confidence level) " << std::endl;
//err << " total system weight (dec) = " << (total_weight / (float) 0x10000) << std::endl;
//err << " number of buckets = " << num_buckets << std::endl;
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;
err << " " << num_devices_failing_at_one_percent << "/" << num_devices_active << " ("
<< (100.0*((float) num_devices_failing_at_one_percent / (float) num_devices_active))
<< "%) devices failed testing at 1% confidence level" << std::endl;
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;
err << " " << num_devices_failing_at_one_percent << "/" << num_devices_active << " ("
<< (100.0*((float) num_devices_failing_at_one_percent / (float) num_devices_active))
<< "%) devices failed testing at 1% confidence level" << std::endl;
}
#endif
}