| 96 | } |
| 97 | |
| 98 | int 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 | } |
nothing calls this directly
no test coverage detected