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

Function main

tools/rpc_press/rpc_press.cpp:98–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98int main(int argc, char* argv[]) {
99 // Parse gflags. We recommend you to use gflags as well
100 GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
101 // set global log option
102
103 if (FLAGS_dummy_port >= 0) {
104 brpc::StartDummyServerAt(FLAGS_dummy_port);
105 }
106
107 pbrpcframework::PressOptions options;
108 if (!set_press_options(&options)) {
109 return -1;
110 }
111 pbrpcframework::RpcPress* rpc_press = new pbrpcframework::RpcPress;
112 if (0 != rpc_press->init(&options)) {
113 LOG(FATAL) << "Fail to init rpc_press";
114 return -1;
115 }
116
117 rpc_press->start();
118 if (FLAGS_duration <= 0) {
119 while (!brpc::IsAskedToQuit()) {
120 sleep(1);
121 }
122 } else {
123 sleep(FLAGS_duration);
124 }
125 rpc_press->stop();
126 // NOTE(gejun): Can't delete rpc_press on exit. It's probably
127 // used by concurrently running done.
128 return 0;
129}

Callers

nothing calls this directly

Calls 6

StartDummyServerAtFunction · 0.85
set_press_optionsFunction · 0.85
IsAskedToQuitFunction · 0.85
initMethod · 0.45
startMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected