Skip to content

Commit

Permalink
Move smaps and smaps_rollup parsing into modules
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
blt committed Dec 5, 2024
1 parent aee2f25 commit 20dd840
Show file tree
Hide file tree
Showing 4 changed files with 800 additions and 776 deletions.
6 changes: 2 additions & 4 deletions lading/src/observer/linux/procfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ use procfs::{process::Process, Current};
use rustc_hash::{FxHashMap, FxHashSet};
use tracing::{error, warn};

use memory::{Regions, Rollup};

const BYTES_PER_KIBIBYTE: u64 = 1024;

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

// This code reads smaps_rollup
let rollup = match Rollup::from_pid(pid) {
let rollup = match memory::smaps_rollup::Rollup::from_pid(pid) {
Ok(rollup) => rollup,
Err(e) => {
// We don't want to bail out entirely if we can't read smap rollup
Expand Down
Loading

0 comments on commit 20dd840

Please sign in to comment.