pub struct ScanOptions {
pub threads: bool,
pub smaps: bool,
pub gpu: bool,
pub delayacct: bool,
}Expand description
What the front end is currently showing, and therefore what the sampler has to pay for.
§Why this is one struct rather than three setters
The per-process reads named here are not free:
threads— an extrastatread per thread (~1700 per tick on a desktop).smaps— a kernel walk over every VMA of every process (tens of ms).gpu— areaddiroffdinfoplus a read per open DRM fd, per process.
Each one used to be its own set_* method on the trait. That worked until the
third, at which point a front end had to remember to call every setter on every
change, and a forgotten one meant either a wasted scan or a column of dashes.
Passing the whole decision as one value makes both failures impossible: there
is one call, it carries everything, and a new gated read can only be added by
extending this struct — which breaks every call site until it is answered.
Fields§
§threads: boolEmit one row per thread as well as one per process.
smaps: boolRead /proc/<pid>/smaps_rollup (PSS, EPSS, private, per-process swap).
gpu: boolRead /proc/<pid>/fdinfo for drm-* keys (GPU time and percentage).
delayacct: boolRead per-task delay counters over TASKSTATS generic netlink.
Implementations§
Source§impl ScanOptions
impl ScanOptions
Sourcepub const fn none() -> Self
pub const fn none() -> Self
Everything off: the cheap scan, which is what the shipped default column set and the default header need.
pub const fn with_threads(self, on: bool) -> Self
pub const fn with_smaps(self, on: bool) -> Self
pub const fn with_gpu(self, on: bool) -> Self
pub const fn with_delayacct(self, on: bool) -> Self
Trait Implementations§
Source§impl Clone for ScanOptions
impl Clone for ScanOptions
impl Copy for ScanOptions
Source§impl Debug for ScanOptions
impl Debug for ScanOptions
Source§impl Default for ScanOptions
impl Default for ScanOptions
impl Eq for ScanOptions
Source§impl PartialEq for ScanOptions
impl PartialEq for ScanOptions
impl StructuralPartialEq for ScanOptions
Auto Trait Implementations§
impl Freeze for ScanOptions
impl RefUnwindSafe for ScanOptions
impl Send for ScanOptions
impl Sync for ScanOptions
impl Unpin for ScanOptions
impl UnsafeUnpin for ScanOptions
impl UnwindSafe for ScanOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more