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

Method Test

example/rdma_performance/server.cpp:40–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 ~PerfTestServiceImpl() {}
39
40 void Test(google::protobuf::RpcController* cntl_base,
41 const PerfTestRequest* request,
42 PerfTestResponse* response,
43 google::protobuf::Closure* done) {
44 brpc::ClosureGuard done_guard(done);
45 uint64_t last = g_last_time.load(butil::memory_order_relaxed);
46 uint64_t now = butil::monotonic_time_us();
47 if (now > last && now - last > 100000) {
48 if (g_last_time.exchange(now, butil::memory_order_relaxed) == last) {
49 response->set_cpu_usage(bvar::Variable::describe_exposed("process_cpu_usage"));
50 } else {
51 response->set_cpu_usage("");
52 }
53 } else {
54 response->set_cpu_usage("");
55 }
56 if (request->echo_attachment()) {
57 brpc::Controller* cntl =
58 static_cast<brpc::Controller*>(cntl_base);
59 cntl->response_attachment().append(cntl->request_attachment());
60 }
61 }
62};
63}
64

Callers 2

InitMethod · 0.45
SendRequestMethod · 0.45

Calls 4

monotonic_time_usFunction · 0.85
loadMethod · 0.45
exchangeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected