use <pre>
for codeblock formatting in jemalloc stats, link to ffi func
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
9f5d7b0761
commit
8f17d965b2
2 changed files with 9 additions and 3 deletions
|
@ -369,7 +369,12 @@ default = [
|
|||
backend_sqlite = ["sqlite"]
|
||||
backend_rocksdb = ["rocksdb"]
|
||||
rocksdb = ["rust-rocksdb"]
|
||||
jemalloc = ["tikv-jemalloc-sys", "tikv-jemalloc-ctl", "tikv-jemallocator", "rust-rocksdb/jemalloc"]
|
||||
jemalloc = [
|
||||
"tikv-jemalloc-sys",
|
||||
"tikv-jemalloc-ctl",
|
||||
"tikv-jemallocator",
|
||||
"rust-rocksdb/jemalloc",
|
||||
]
|
||||
jemalloc_prof = ["tikv-jemalloc-sys/profiling"]
|
||||
sqlite = ["rusqlite", "parking_lot", "thread_local"]
|
||||
systemd = ["sd-notify"]
|
||||
|
|
|
@ -31,11 +31,12 @@ pub(crate) fn memory_stats() -> String {
|
|||
let opaque: *mut c_void = &mut str as *mut _ as *mut c_void;
|
||||
let opts_p: *const c_char = std::ffi::CString::new(opts_s).expect("cstring").into_raw() as *const c_char;
|
||||
|
||||
// SAFETY: calls malloc_stats_print() with our string instance which must remain in this frame.
|
||||
// SAFETY: calls malloc_stats_print() with our string instance which must remain
|
||||
// in this frame. https://docs.rs/tikv-jemalloc-sys/latest/tikv_jemalloc_sys/fn.malloc_stats_print.html
|
||||
unsafe { ffi::malloc_stats_print(Some(malloc_stats_cb), opaque, opts_p) };
|
||||
|
||||
str.truncate(MAX_LENGTH);
|
||||
format!("<code>{str}</code>")
|
||||
format!("<pre><code>{str}</code></pre>")
|
||||
}
|
||||
|
||||
extern "C" fn malloc_stats_cb(opaque: *mut c_void, msg: *const c_char) {
|
||||
|
|
Loading…
Add table
Reference in a new issue