forked from tikv/tikv
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapply "Enable heap profiling (#376)"
This reverts commit 88ff7b3.
- Loading branch information
Showing
7 changed files
with
87 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
proxy_components/proxy_server/src/status_server/vendored_utils.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2024 TiKV Project Authors. Licensed under Apache-2.0. | ||
|
||
use proxy_ffi::jemalloc_utils::issue_mallctl_args; | ||
use tikv_alloc::error::ProfResult; | ||
|
||
pub fn activate_prof() -> ProfResult<()> { | ||
{ | ||
let mut value: bool = true; | ||
let len = std::mem::size_of_val(&value) as u64; | ||
issue_mallctl_args( | ||
"prof.active", | ||
std::ptr::null_mut(), | ||
std::ptr::null_mut(), | ||
&mut value as *mut _ as *mut _, | ||
len, | ||
); | ||
} | ||
Ok(()) | ||
} | ||
|
||
pub fn deactivate_prof() -> ProfResult<()> { | ||
{ | ||
let mut value: bool = false; | ||
let len = std::mem::size_of_val(&value) as u64; | ||
issue_mallctl_args( | ||
"prof.active", | ||
std::ptr::null_mut(), | ||
std::ptr::null_mut(), | ||
&mut value as *mut _ as *mut _, | ||
len, | ||
); | ||
} | ||
Ok(()) | ||
} | ||
|
||
pub fn dump_prof(path: &str) -> tikv_alloc::error::ProfResult<()> { | ||
{ | ||
let mut bytes = std::ffi::CString::new(path)?.into_bytes_with_nul(); | ||
let mut ptr = bytes.as_mut_ptr() as *mut ::std::os::raw::c_char; | ||
let len = std::mem::size_of_val(&ptr) as u64; | ||
issue_mallctl_args( | ||
"prof.dump", | ||
std::ptr::null_mut(), | ||
std::ptr::null_mut(), | ||
&mut ptr as *mut _ as *mut _, | ||
len, | ||
); | ||
} | ||
Ok(()) | ||
} |