MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / read_process_majflt

Method read_process_majflt

nodedb/src/data/io/prefetch.rs:190–195  ·  view source on GitHub ↗

Read the process's major page faults from `/proc/self/stat`. Returns `None` on non-Linux or if the file can't be read.

()

Source from the content-addressed store, hash-verified

188 ///
189 /// Returns `None` on non-Linux or if the file can't be read.
190 pub fn read_process_majflt() -> Option<u64> {
191 let stat = std::fs::read_to_string("/proc/self/stat").ok()?;
192 // Field 12 (0-indexed) is majflt.
193 let fields: Vec<&str> = stat.split_whitespace().collect();
194 fields.get(11)?.parse::<u64>().ok()
195 }
196}
197
198#[cfg(test)]

Callers

nothing calls this directly

Calls 3

collectMethod · 0.80
okMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected