| 49 | |
| 50 | impl JemallocProfCtlExt for JemallocProfCtl { |
| 51 | fn dump_stats(&mut self, json_format: bool) -> anyhow::Result<String> { |
| 52 | // Try to avoid allocations within `stats_print` |
| 53 | let mut buf = Vec::with_capacity(1 << 22); |
| 54 | let mut options = tikv_jemalloc_ctl::stats_print::Options::default(); |
| 55 | options.json_format = json_format; |
| 56 | tikv_jemalloc_ctl::stats_print::stats_print(&mut buf, options)?; |
| 57 | Ok(String::from_utf8(buf)?) |
| 58 | } |
| 59 | |
| 60 | fn stats(&self) -> anyhow::Result<JemallocStats> { |
| 61 | JemallocStats::get() |