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

Function get_tcmalloc_memory_info

src/brpc/builtin/memory_service.cpp:40–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40static 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
62static void get_jemalloc_memory_info(Controller* cntl) {
63 const brpc::URI& uri = cntl->http_request().uri();

Callers 1

default_methodMethod · 0.85

Calls 3

get_tcmalloc_num_propFunction · 0.85
getMethod · 0.45
move_toMethod · 0.45

Tested by

no test coverage detected