forked from gnzlbg/jemallocator
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support prof.dump
and prof.prefix
#61
Open
yuhao-su
wants to merge
12
commits into
tikv:main
Choose a base branch
from
yuhao-su:yuhao/prof
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+214
−10
Open
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
47a5d9a
add dump and prefix
yuhao-su 374056b
add CStr Access
yuhao-su 51f8d3d
write_str_unsafe and active
yuhao-su 4914c5d
fix test
yuhao-su bb3bf17
add opt.prof
yuhao-su 4eca9c6
fix test
yuhao-su 2cbdaf2
fmt
yuhao-su a091160
Merge branch 'main' of https://github.com/tikv/jemallocator into yuha…
yuhao-su 3e66fd8
Merge remote-tracking branch 'origin/main' into yuhao/prof
TennyZhuang 8ce8ea3
sync submodule
TennyZhuang 8c062e8
remove two dump files
TennyZhuang 5084726
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
heap_v2/524288 | ||
t*: 0: 0 [0: 0] | ||
t0: 0: 0 [0: 0] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
//! `jemalloc`'s profiling utils. | ||
|
||
use crate::ffi::CStr; | ||
|
||
option! { | ||
dump[ str: b"prof.dump\0", str: 2 ] => &'static CStr | | ||
ops: w | | ||
docs: | ||
/// Dump a memory profile to the specified file, or if NULL is specified, | ||
/// to a file according to the pattern <prefix>.<pid>.<seq>.m<mseq>.heap, | ||
/// where <prefix> is controlled by the opt.prof_prefix and prof.prefix options. | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// # #[global_allocator] | ||
/// # static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; | ||
/// # | ||
/// # fn main() { | ||
/// #[cfg(feature = "profiling")] | ||
/// { | ||
/// use tikv_jemalloc_ctl::prof; | ||
/// use std::ffi::CStr; | ||
/// let dump_file_name = CStr::from_bytes_with_nul(b"dump\0").unwrap(); | ||
/// let dump = prof::dump::mib().unwrap(); | ||
/// dump.write(dump_file_name).unwrap(); | ||
/// } | ||
/// # } | ||
/// ``` | ||
mib_docs: /// See [`dump`]. | ||
} | ||
|
||
option! { | ||
prefix[ str: b"prof.prefix\0", str: 2 ] => &'static CStr | | ||
ops: w | | ||
docs: | ||
/// Set the filename prefix for profile dumps. See opt.prof_prefix for the default setting. | ||
/// | ||
/// This can be useful to differentiate profile dumps such as from forked processes. | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// # #[global_allocator] | ||
/// # static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; | ||
/// # | ||
/// # fn main() { | ||
/// #[cfg(feature = "profiling")] | ||
/// { | ||
/// use tikv_jemalloc_ctl::prof; | ||
/// use std::ffi::CStr; | ||
/// let dump_file_name = CStr::from_bytes_with_nul(b"my_prefix\0").unwrap(); | ||
/// let prefix = prof::prefix::mib().unwrap(); | ||
/// prefix.write(dump_file_name).unwrap(); | ||
/// } | ||
/// # } | ||
/// ``` | ||
mib_docs: /// See [`prefix`]. | ||
} | ||
|
||
option! { | ||
active[ str: b"prof.active\0", non_str: 2 ] => bool | | ||
ops: r, w, u | | ||
docs: | ||
/// Control whether sampling is currently active. | ||
/// | ||
/// See the `opt.prof_active` option for additional information, | ||
/// as well as the interrelated `thread.prof.active` mallctl. | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// # #[global_allocator] | ||
/// # static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; | ||
/// # | ||
/// # fn main() { | ||
/// #[cfg(feature = "profiling")] | ||
/// { | ||
/// use tikv_jemalloc_ctl::prof; | ||
/// let active = prof::active::mib().unwrap(); | ||
/// active.write(true).unwrap(); | ||
/// } | ||
/// # } | ||
/// ``` | ||
mib_docs: /// See [`active`]. | ||
} |
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,4 @@ | ||
heap_v2/524288 | ||
t*: 0: 0 [0: 0] | ||
t0: 0: 0 [0: 0] | ||
t1: 0: 0 [0: 0] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A mistake?