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

Method default_method

src/brpc/builtin/memory_service.cpp:71–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void MemoryService::default_method(::google::protobuf::RpcController* cntl_base,
72 const ::brpc::MemoryRequest*,
73 ::brpc::MemoryResponse*,
74 ::google::protobuf::Closure* done) {
75 ClosureGuard done_guard(done);
76 auto cntl = static_cast<Controller*>(cntl_base);
77 cntl->http_response().set_content_type("text/plain");
78 butil::IOBuf& resp = cntl->response_attachment();
79
80 if (IsTCMallocEnabled()) {
81 butil::IOBufBuilder os;
82 get_tcmalloc_memory_info(resp);
83 } else if (HasJemalloc()) {
84 // support ip:port/memory?opts=Ja
85 get_jemalloc_memory_info(cntl);
86 } else {
87 resp.append("tcmalloc or jemalloc is not enabled");
88 cntl->http_response().set_status_code(HTTP_STATUS_FORBIDDEN);
89 return;
90 }
91}
92
93} // namespace brpc

Callers

nothing calls this directly

Calls 7

IsTCMallocEnabledFunction · 0.85
get_tcmalloc_memory_infoFunction · 0.85
HasJemallocFunction · 0.85
get_jemalloc_memory_infoFunction · 0.85
set_content_typeMethod · 0.80
set_status_codeMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected