| 4108 | } |
| 4109 | |
| 4110 | void TabletImpl::ShowMemPool(RpcController* controller, |
| 4111 | const ::fedb::api::HttpRequest* request, |
| 4112 | ::fedb::api::HttpResponse* response, |
| 4113 | Closure* done) { |
| 4114 | brpc::ClosureGuard done_guard(done); |
| 4115 | #ifdef TCMALLOC_ENABLE |
| 4116 | brpc::Controller* cntl = static_cast<brpc::Controller*>(controller); |
| 4117 | MallocExtension* tcmalloc = MallocExtension::instance(); |
| 4118 | std::string stat; |
| 4119 | stat.resize(1024); |
| 4120 | char* buffer = reinterpret_cast<char*>(&(stat[0])); |
| 4121 | tcmalloc->GetStats(buffer, 1024); |
| 4122 | cntl->response_attachment().append( |
| 4123 | "<html><head><title>Mem Stat</title></head><body><pre>"); |
| 4124 | cntl->response_attachment().append(stat); |
| 4125 | cntl->response_attachment().append("</pre></body></html>"); |
| 4126 | #endif |
| 4127 | } |
| 4128 | |
| 4129 | void TabletImpl::CheckZkClient() { |
| 4130 | if (!zk_client_->IsConnected()) { |