Skip to content

Commit 1f5b7a8

Browse files
committed
correct rss calculation
Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
1 parent 9ba4f7e commit 1f5b7a8

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
## [0.17.2-rc3]
10+
### Changed
11+
- Correct `rss` to be reported in terms of bytes, not pages, as before.
12+
913
## [0.17.2-rc2]
1014
### Removed
1115
- Observer no longer emits tick data for kernel and user-space time.

lading/src/observer/linux.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub(crate) struct Sampler {
3434
parent: Process,
3535
num_cores: usize,
3636
ticks_per_second: u64,
37+
page_size: u64,
3738
previous_samples: FxHashMap<(i32, String), Sample>,
3839
}
3940

@@ -45,6 +46,7 @@ impl Sampler {
4546
parent,
4647
num_cores: num_cpus::get(), // Cores, logical on Linux, obeying cgroup limits if present
4748
ticks_per_second: procfs::ticks_per_second(),
49+
page_size: procfs::page_size(),
4850
previous_samples: FxHashMap::default(),
4951
})
5052
}
@@ -164,7 +166,7 @@ impl Sampler {
164166
// page. My VSize remains one page. Allocators muddy this even
165167
// further by trying to account for the behavior of the operating
166168
// system. Anyway, good luck out there. You'll be fine.
167-
let rss: u64 = stats.rss;
169+
let rss: u64 = stats.rss * self.page_size;
168170
let rsslim: u64 = stats.rsslim;
169171
let vsize: u64 = stats.vsize;
170172

0 commit comments

Comments
 (0)