40 , option_summary(false)
42 , option_create(false)
43 , option_truncate(false)
45 , option_suppress_error(false)
46 , option_verify(false)
52 static struct option long_options[]
53 = { {
"help", no_argument, 0,
'h' }, {
"print", no_argument, 0,
'p' },
54 {
"create", no_argument, 0,
'c' }, {
"truncate", no_argument, 0,
't' },
55 {
"long", no_argument, 0,
'l' }, {
"json", no_argument, 0,
'j' },
56 {
"summary", no_argument, 0,
's' }, {
"replace", required_argument, 0,
'r' },
57 {
"suppress", no_argument, 0,
'f' }, {
"verify", no_argument, 0,
'v' },
58 {
"speed", required_argument, 0,
'x' }, { 0, 0, 0, 0 } };
60 int c = getopt_long(argc, argv,
"vjpctshlfr:x:", long_options, &option_index);
78 option_truncate =
true;
90 option_summary =
true;
102 option_speed = std::strtod(optarg, 0);
103 if (option_speed <= 0)
110 option_regex.push_back(optarg);
114 option_suppress_error =
true;
122 if (option_json && (option_long || option_summary))
123 option_long = option_summary =
true;
128 option_create =
false;
129 option_truncate =
false;
138 if (
optind == (argc -1 )) {
147 <<
"usage: xrdreplay [-p|--print] [-c|--create-data] [t|--truncate-data] [-l|--long] [-s|--summary] [-h|--help] [-r|--replace <arg>:=<newarg>] [-f|--suppress] [-v|--verify] [-x|--speed <value] p<recordfilename>]\n"
149 std::cerr <<
" -h | --help : show this help" << std::endl;
151 <<
" -f | --suppress : force to run all IO with all successful result status - suppress all others"
154 <<
" - by default the player won't run with an unsuccessful recorded IO"
156 std::cerr << std::endl;
158 <<
" -p | --print : print only mode - shows all the IO for the given replay file without actually running any IO"
161 <<
" -s | --summary : print summary - shows all the aggregated IO counter summed for all files"
164 <<
" -l | --long : print long - show all file IO counter for each individual file"
166 std::cerr <<
" -v | --verify : verify the existence of all input files"
169 <<
" -x | --speed <x> : change playback speed by factor <x> [ <x> > 0.0 ]"
172 <<
" -r | --replace <a>:=<b> : replace in the argument list the string <a> with <b> "
175 <<
" - option is usable several times e.g. to change storage prefixes or filenames"
177 std::cerr << std::endl;
179 <<
" [recordfilename] : if a file is given, it will be used as record input otherwise STDIN is used to read records!"
182 <<
"example: ... --replace file:://localhost:=root://xrootd.eu/ : redirect local file to remote"
184 std::cerr << std::endl;
190 bool print() {
return option_print; }
193 bool json() {
return option_json; }
196 double speed() {
return option_speed; }
197 std::vector<std::string>&
regex() {
return option_regex; }
198 std::string&
path() {
return _path; }
205 bool option_truncate;
207 bool option_suppress_error;
210 std::vector<std::string> option_regex;
Args parse for XrdClReplay.
ReplayArgs(int argc, char *argv[])
std::vector< std::string > & regex()