Note: I know about the commands like top
but I am interested in knowing the number of bytes written to memory and also rewrites (number of times storing to the memory happened)
Asked
Active
Viewed 126 times
1

Greg Askew
- 35,880
- 5
- 54
- 82

NUPUR AGRAWAL
- 11
- 1
-
Take a look at vmstat command and also at the ps command which has parameters about process memory usage. – Ptit Xav Mar 05 '23 at 12:01
-
I don't think such statistics are available as they would have a big effect on performance. – Tero Kilkanen Mar 05 '23 at 14:00
-
Here's an older question that looks relevant: https://stackoverflow.com/questions/19457342/trying-to-trap-all-memory-reads-writes-on-a-linux-machine – Juraj Martinka Mar 05 '23 at 16:59
-
What problem are you solving? Which tool to use depends on if you are a developer who can tolerate massive overhead to prove memory use correctness (Valgrind) or a production system that needs to run at a usable speed while sampling (Linux perf_events) – John Mahowald Mar 06 '23 at 06:07
-
I tried using perf mem but it doesn't reflect anything in terms of bytes (memory). – NUPUR AGRAWAL Mar 07 '23 at 04:04
1 Answers
0
There are some per-CPU/per-socket counters which can be useful, e.g. this set of notes among other things points to https://github.com/intel/pcm. It has a tool to measure per-socket memory bandwidth on Intel processors.
If you are investigating some specific application you may pin it to a specific core, make sure nothing else runs on it and use per-socket stats provided by Intel's tool.

rvs
- 4,125
- 1
- 27
- 31