| 47 | namespace po = boost::program_options; |
| 48 | |
| 49 | int ErasureCodeBench::setup(int argc, char** argv) { |
| 50 | |
| 51 | po::options_description desc("Allowed options"); |
| 52 | desc.add_options() |
| 53 | ("help,h", "produce help message") |
| 54 | ("verbose,v", "explain what happens") |
| 55 | ("size,s", po::value<int>()->default_value(80 * 1024 * 1024), |
| 56 | "size of the buffer to be encoded") |
| 57 | ("iterations,i", po::value<int>()->default_value(100), |
| 58 | "number of encode/decode runs") |
| 59 | ("plugin,p", po::value<string>()->default_value("isa"), |
| 60 | "erasure code plugin name") |
| 61 | ("workload,w", po::value<string>()->default_value("encode"), |
| 62 | "run either encode or decode") |
| 63 | ("erasures,e", po::value<int>()->default_value(1), |
| 64 | "number of erasures when decoding") |
| 65 | ("erased", po::value<vector<int> >(), |
| 66 | "erased chunk (repeat if more than one chunk is erased)") |
| 67 | ("erasures-generation,E", po::value<string>()->default_value("random"), |
| 68 | "If set to 'random', pick the number of chunks to recover (as specified by " |
| 69 | " --erasures) at random. If set to 'exhaustive' try all combinations of erasures " |
| 70 | " (i.e. k=4,m=3 with one erasure will try to recover from the erasure of " |
| 71 | " the first chunk, then the second etc.)") |
| 72 | ("parameter,P", po::value<vector<string> >(), |
| 73 | "add a parameter to the erasure code profile") |
| 74 | ; |
| 75 | |
| 76 | po::variables_map vm; |
| 77 | po::parsed_options parsed = |
| 78 | po::command_line_parser(argc, argv).options(desc).allow_unregistered().run(); |
| 79 | po::store( |
| 80 | parsed, |
| 81 | vm); |
| 82 | po::notify(vm); |
| 83 | |
| 84 | vector<const char *> ceph_options; |
| 85 | vector<string> ceph_option_strings = po::collect_unrecognized( |
| 86 | parsed.options, po::include_positional); |
| 87 | ceph_options.reserve(ceph_option_strings.size()); |
| 88 | for (vector<string>::iterator i = ceph_option_strings.begin(); |
| 89 | i != ceph_option_strings.end(); |
| 90 | ++i) { |
| 91 | ceph_options.push_back(i->c_str()); |
| 92 | } |
| 93 | |
| 94 | cct = global_init( |
| 95 | NULL, ceph_options, CEPH_ENTITY_TYPE_CLIENT, |
| 96 | CODE_ENVIRONMENT_UTILITY, |
| 97 | CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); |
| 98 | common_init_finish(g_ceph_context); |
| 99 | g_ceph_context->_conf.apply_changes(nullptr); |
| 100 | |
| 101 | if (vm.count("help")) { |
| 102 | cout << desc << std::endl; |
| 103 | return 1; |
| 104 | } |
| 105 | |
| 106 | if (vm.count("parameter")) { |
no test coverage detected