Skip to content

Commit 20dd840

Browse files
committed
Move smaps and smaps_rollup parsing into modules
This commit is code reorganization. I have not done anything to change the mechanism here, just how it's used. Signed-off-by: Brian L. Troutwine <[email protected]>
1 parent aee2f25 commit 20dd840

File tree

4 files changed

+800
-776
lines changed

4 files changed

+800
-776
lines changed

lading/src/observer/linux/procfs.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ use procfs::{process::Process, Current};
1010
use rustc_hash::{FxHashMap, FxHashSet};
1111
use tracing::{error, warn};
1212

13-
use memory::{Regions, Rollup};
14-
1513
const BYTES_PER_KIBIBYTE: u64 = 1024;
1614

1715
#[derive(thiserror::Error, Debug)]
@@ -295,7 +293,7 @@ impl Sampler {
295293
if has_ptrace_perm {
296294
joinset.spawn(async move {
297295
// TODO this code reads smaps
298-
let memory_regions = match Regions::from_pid(pid) {
296+
let memory_regions = match memory::smaps::Regions::from_pid(pid) {
299297
Ok(memory_regions) => memory_regions,
300298
Err(e) => {
301299
// We don't want to bail out entirely if we can't read stats
@@ -333,7 +331,7 @@ impl Sampler {
333331
gauge!("smaps.swap.sum", &labels).set(measures.swap as f64);
334332

335333
// This code reads smaps_rollup
336-
let rollup = match Rollup::from_pid(pid) {
334+
let rollup = match memory::smaps_rollup::Rollup::from_pid(pid) {
337335
Ok(rollup) => rollup,
338336
Err(e) => {
339337
// We don't want to bail out entirely if we can't read smap rollup

0 commit comments

Comments
 (0)