Skip to content
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

Add more stats_print options #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion jemalloc-ctl/src/stats_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ pub struct Options {
/// This corresponds to the `m` character.
pub skip_merged_arenas: bool,

/// If set, merged information about destroyed arenas will be skipped.
///
/// This corresponds to the `d` character.
pub skip_destroyed_arenas: bool,

/// If set, information about individual arenas will be skipped.
///
/// This corresponds to the `a` character.
Expand All @@ -48,6 +53,11 @@ pub struct Options {
/// This corresponds to the `x` character.
pub skip_mutex_statistics: bool,

/// If set, extent statistics will be skipped.
///
/// This corresponds to the `e` character.
pub skip_extent_statistics: bool,

_p: (),
}

Expand Down Expand Up @@ -93,7 +103,7 @@ where
error: Ok(()),
panic: Ok(()),
};
let mut opts = [0; 8];
let mut opts = [0; 10];
let mut i = 0;
if options.json_format {
opts[i] = b'J' as c_char;
Expand All @@ -107,6 +117,10 @@ where
opts[i] = b'm' as c_char;
i += 1;
}
if options.skip_destroyed_arenas {
opts[i] = b'd' as c_char;
i += 1;
}
if options.skip_per_arena {
opts[i] = b'a' as c_char;
i += 1;
Expand All @@ -123,6 +137,10 @@ where
opts[i] = b'x' as c_char;
i += 1;
}
if options.skip_extent_statistics {
opts[i] = b'e' as c_char;
i += 1;
}
opts[i] = 0;

jemalloc_sys::malloc_stats_print(
Expand Down Expand Up @@ -155,10 +173,12 @@ mod test {
json_format: true,
skip_constants: true,
skip_merged_arenas: true,
skip_destroyed_arenas: true,
skip_per_arena: true,
skip_bin_size_classes: true,
skip_large_size_classes: true,
skip_mutex_statistics: true,
skip_extent_statistics: true,
_p: (),
};
stats_print(&mut buf, options).unwrap();
Expand Down