XRootD
Loading...
Searching...
No Matches
XrdCl::ReplayArgs Class Reference

Args parse for XrdClReplay. More...

#include <XrdClReplayArgs.hh>

Collaboration diagram for XrdCl::ReplayArgs:

Public Member Functions

 ReplayArgs (int argc, char *argv[])
bool create ()
bool json ()
bool longformat ()
std::string & path ()
bool print ()
std::vector< std::string > & regex ()
double speed ()
bool summary ()
bool suppress_error ()
bool truncate ()
void usage ()
bool verify ()

Detailed Description

Args parse for XrdClReplay.

Definition at line 35 of file XrdClReplayArgs.hh.

Constructor & Destructor Documentation

◆ ReplayArgs()

XrdCl::ReplayArgs::ReplayArgs ( int argc,
char * argv[] )
inline

Definition at line 38 of file XrdClReplayArgs.hh.

39 : option_long(false)
40 , option_summary(false)
41 , option_print(false)
42 , option_create(false)
43 , option_truncate(false)
44 , option_json(false)
45 , option_suppress_error(false)
46 , option_verify(false)
47 , option_speed(1.0)
48 {
49 while (1)
50 {
51 int option_index = 0;
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 } };
59
60 int c = getopt_long(argc, argv, "vjpctshlfr:x:", long_options, &option_index);
61 if (c == -1)
62 break;
63
64 switch (c)
65 {
66 case 'h':
67 usage();
68 break;
69
70 case 'c':
71 option_create = true;
72 option_print = true; // create mode requires to run in simulated mode (print)
73 break;
74
75 case 't':
76 option_create = true;
77 option_print = true; // truncate mode requires to run in simulated mode (print)
78 option_truncate = true;
79 break;
80
81 case 'j':
82 option_json = true;
83 break;
84
85 case 'p':
86 option_print = true;
87 break;
88
89 case 's':
90 option_summary = true;
91 break;
92
93 case 'l':
94 option_long = true;
95 break;
96
97 case 'v':
98 option_verify = true;
99 break;
100
101 case 'x':
102 option_speed = std::strtod(optarg, 0);
103 if (option_speed <= 0)
104 {
105 usage();
106 }
107 break;
108
109 case 'r':
110 option_regex.push_back(optarg);
111 break;
112
113 case 'f':
114 option_suppress_error = true;
115 break;
116
117 default:
118 usage();
119 }
120 }
121
122 if (option_json && (option_long || option_summary))
123 option_long = option_summary = true;
124
125 if (option_verify)
126 {
127 option_print = true;
128 option_create = false;
129 option_truncate = false;
130 option_json = false;
131 }
132
133 if (optind < (argc - 1))
134 {
135 usage();
136 }
137
138 if (optind == (argc -1 )) {
139 // we also accept to have no path and read from STDIN
140 _path = argv[optind];
141 }
142 }
int optind

References optind, and usage().

Here is the call graph for this function:

Member Function Documentation

◆ create()

bool XrdCl::ReplayArgs::create ( )
inline

Definition at line 191 of file XrdClReplayArgs.hh.

191{ return option_create; }

Referenced by main().

Here is the caller graph for this function:

◆ json()

bool XrdCl::ReplayArgs::json ( )
inline

Definition at line 193 of file XrdClReplayArgs.hh.

193{ return option_json; }

Referenced by main().

Here is the caller graph for this function:

◆ longformat()

bool XrdCl::ReplayArgs::longformat ( )
inline

Definition at line 188 of file XrdClReplayArgs.hh.

188{ return option_long; }

Referenced by main().

Here is the caller graph for this function:

◆ path()

std::string & XrdCl::ReplayArgs::path ( )
inline

Definition at line 198 of file XrdClReplayArgs.hh.

198{ return _path; }

Referenced by main().

Here is the caller graph for this function:

◆ print()

bool XrdCl::ReplayArgs::print ( )
inline

Definition at line 190 of file XrdClReplayArgs.hh.

190{ return option_print; }

Referenced by main().

Here is the caller graph for this function:

◆ regex()

std::vector< std::string > & XrdCl::ReplayArgs::regex ( )
inline

Definition at line 197 of file XrdClReplayArgs.hh.

197{ return option_regex; }

Referenced by main().

Here is the caller graph for this function:

◆ speed()

double XrdCl::ReplayArgs::speed ( )
inline

Definition at line 196 of file XrdClReplayArgs.hh.

196{ return option_speed; }

Referenced by main().

Here is the caller graph for this function:

◆ summary()

bool XrdCl::ReplayArgs::summary ( )
inline

Definition at line 189 of file XrdClReplayArgs.hh.

189{ return option_summary; }

Referenced by main().

Here is the caller graph for this function:

◆ suppress_error()

bool XrdCl::ReplayArgs::suppress_error ( )
inline

Definition at line 194 of file XrdClReplayArgs.hh.

194{ return option_suppress_error; }

Referenced by main().

Here is the caller graph for this function:

◆ truncate()

bool XrdCl::ReplayArgs::truncate ( )
inline

Definition at line 192 of file XrdClReplayArgs.hh.

192{ return option_truncate; }

Referenced by main().

Here is the caller graph for this function:

◆ usage()

void XrdCl::ReplayArgs::usage ( )
inline

Definition at line 144 of file XrdClReplayArgs.hh.

145 {
146 std::cerr
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"
148 << std::endl;
149 std::cerr << " -h | --help : show this help" << std::endl;
150 std::cerr
151 << " -f | --suppress : force to run all IO with all successful result status - suppress all others"
152 << std::endl;
153 std::cerr
154 << " - by default the player won't run with an unsuccessful recorded IO"
155 << std::endl;
156 std::cerr << std::endl;
157 std::cerr
158 << " -p | --print : print only mode - shows all the IO for the given replay file without actually running any IO"
159 << std::endl;
160 std::cerr
161 << " -s | --summary : print summary - shows all the aggregated IO counter summed for all files"
162 << std::endl;
163 std::cerr
164 << " -l | --long : print long - show all file IO counter for each individual file"
165 << std::endl;
166 std::cerr << " -v | --verify : verify the existence of all input files"
167 << std::endl;
168 std::cerr
169 << " -x | --speed <x> : change playback speed by factor <x> [ <x> > 0.0 ]"
170 << std::endl;
171 std::cerr
172 << " -r | --replace <a>:=<b> : replace in the argument list the string <a> with <b> "
173 << std::endl;
174 std::cerr
175 << " - option is usable several times e.g. to change storage prefixes or filenames"
176 << std::endl;
177 std::cerr << std::endl;
178 std::cerr
179 << " [recordfilename] : if a file is given, it will be used as record input otherwise STDIN is used to read records!"
180 << std::endl;
181 std::cerr
182 << "example: ... --replace file:://localhost:=root://xrootd.eu/ : redirect local file to remote"
183 << std::endl;
184 std::cerr << std::endl;
185 exit(-1);
186 }

Referenced by ReplayArgs().

Here is the caller graph for this function:

◆ verify()

bool XrdCl::ReplayArgs::verify ( )
inline

Definition at line 195 of file XrdClReplayArgs.hh.

195{ return option_verify; }

Referenced by main().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: