MCPcopy Create free account
hub / github.com/apache/thrift / main

Function main

test/cpp/src/StressTest.cpp:259–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257};
258
259int main(int argc, char** argv) {
260#if _WIN32
261 transport::TWinsockSingleton::create();
262#endif
263
264 int port = 9091;
265 string clientType = "regular";
266 string serverType = "thread-pool";
267 string protocolType = "binary";
268 size_t workerCount = 8;
269 size_t clientCount = 4;
270 size_t loopCount = 50000;
271 TType loopType = T_VOID;
272 string callName = "echoVoid";
273 bool runServer = true;
274 bool logRequests = false;
275 string requestLogPath = "./requestlog.tlog";
276 bool replayRequests = false;
277
278 ostringstream usage;
279
280 usage << argv[0] << " [--port=<port number>] [--server] [--server-type=<server-type>] "
281 "[--protocol-type=<protocol-type>] [--workers=<worker-count>] "
282 "[--clients=<client-count>] [--loop=<loop-count>] "
283 "[--client-type=<client-type>]" << '\n'
284 << "\tclients Number of client threads to create - 0 implies no clients, i.e. "
285 "server only. Default is " << clientCount << '\n'
286 << "\thelp Prints this help text." << '\n'
287 << "\tcall Service method to call. Default is " << callName << '\n'
288 << "\tloop The number of remote thrift calls each client makes. Default is " << loopCount << '\n'
289 << "\tport The port the server and clients should bind to "
290 "for thrift network connections. Default is " << port << '\n'
291 << "\tserver Run the Thrift server in this process. Default is " << runServer << '\n'
292 << "\tserver-type Type of server, \"simple\" or \"thread-pool\". Default is " << serverType << '\n'
293 << "\tprotocol-type Type of protocol, \"binary\", \"ascii\", or \"xml\". Default is " << protocolType << '\n'
294 << "\tlog-request Log all request to ./requestlog.tlog. Default is " << logRequests << '\n'
295 << "\treplay-request Replay requests from log file (./requestlog.tlog) Default is " << replayRequests << '\n'
296 << "\tworkers Number of thread pools workers. Only valid "
297 "for thread-pool server type. Default is " << workerCount << '\n'
298 << "\tclient-type Type of client, \"regular\" or \"concurrent\". Default is " << clientType << '\n'
299 << '\n';
300
301 map<string, string> args;
302
303 for (int ix = 1; ix < argc; ix++) {
304
305 string arg(argv[ix]);
306
307 if (arg.compare(0, 2, "--") == 0) {
308
309 size_t end = arg.find_first_of("=", 2);
310
311 string key = string(arg, 2, end - 2);
312
313 if (end != string::npos) {
314 args[key] = string(arg, end + 1);
315 } else {
316 args[key] = "true";

Callers

nothing calls this directly

Calls 15

stringFunction · 0.85
nowFunction · 0.85
emptyMethod · 0.80
strMethod · 0.80
setChunkSizeMethod · 0.80
setMaxEventSizeMethod · 0.80
waitForServiceMethod · 0.80
runnableMethod · 0.80
processMethod · 0.65
compareMethod · 0.45
whatMethod · 0.45
seekToEndMethod · 0.45

Tested by

no test coverage detected