| 38 | } |
| 39 | |
| 40 | static void get_tcmalloc_memory_info(butil::IOBuf& out) { |
| 41 | MallocExtension* malloc_ext = MallocExtension::instance(); |
| 42 | butil::IOBufBuilder os; |
| 43 | os << "------------------------------------------------\n"; |
| 44 | get_tcmalloc_num_prop(malloc_ext, "generic.total_physical_bytes", os); |
| 45 | get_tcmalloc_num_prop(malloc_ext, "generic.current_allocated_bytes", os); |
| 46 | get_tcmalloc_num_prop(malloc_ext, "generic.heap_size", os); |
| 47 | get_tcmalloc_num_prop(malloc_ext, "tcmalloc.current_total_thread_cache_bytes", os); |
| 48 | get_tcmalloc_num_prop(malloc_ext, "tcmalloc.central_cache_free_bytes", os); |
| 49 | get_tcmalloc_num_prop(malloc_ext, "tcmalloc.transfer_cache_free_bytes", os); |
| 50 | get_tcmalloc_num_prop(malloc_ext, "tcmalloc.thread_cache_free_bytes", os); |
| 51 | get_tcmalloc_num_prop(malloc_ext, "tcmalloc.pageheap_free_bytes", os); |
| 52 | get_tcmalloc_num_prop(malloc_ext, "tcmalloc.pageheap_unmapped_bytes", os); |
| 53 | |
| 54 | int32_t len = FLAGS_max_tc_stats_buf_len; |
| 55 | std::unique_ptr<char[]> buf(new char[len]); |
| 56 | malloc_ext->GetStats(buf.get(), len); |
| 57 | os << buf.get(); |
| 58 | |
| 59 | os.move_to(out); |
| 60 | } |
| 61 | |
| 62 | static void get_jemalloc_memory_info(Controller* cntl) { |
| 63 | const brpc::URI& uri = cntl->http_request().uri(); |
no test coverage detected