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

Method default_method

src/brpc/builtin/threads_service.cpp:30–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace brpc {
29
30void ThreadsService::default_method(::google::protobuf::RpcController* cntl_base,
31 const ::brpc::ThreadsRequest*,
32 ::brpc::ThreadsResponse*,
33 ::google::protobuf::Closure* done) {
34 ClosureGuard done_guard(done);
35 Controller *cntl = static_cast<Controller*>(cntl_base);
36 cntl->http_response().set_content_type("text/plain");
37 butil::IOBuf& resp = cntl->response_attachment();
38
39 std::string cmd = butil::string_printf("pstack %lld", (long long)getpid());
40 butil::Timer tm;
41 tm.start();
42 butil::IOBufBuilder pstack_output;
43 const int rc = butil::read_command_output(pstack_output, cmd.c_str());
44 if (rc < 0) {
45 LOG(ERROR) << "Fail to popen `" << cmd << "'";
46 return;
47 }
48 pstack_output.move_to(resp);
49 tm.stop();
50 resp.append(butil::string_printf("\n\ntime=%" PRId64 "ms", tm.m_elapsed()));
51}
52
53} // namespace brpc

Callers

nothing calls this directly

Calls 9

string_printfFunction · 0.85
read_command_outputFunction · 0.85
set_content_typeMethod · 0.80
m_elapsedMethod · 0.80
startMethod · 0.45
c_strMethod · 0.45
move_toMethod · 0.45
stopMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected