Score:1

Linux: How to check total number of bytes written to memory by a process

us flag

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)

Ptit Xav avatar
pn flag
Take a look at vmstat command and also at the ps command which has parameters about process memory usage.
us flag
I don't think such statistics are available as they would have a big effect on performance.
ae flag
Here's an older question that looks relevant: https://stackoverflow.com/questions/19457342/trying-to-trap-all-memory-reads-writes-on-a-linux-machine
John Mahowald avatar
cn flag
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)
NUPUR AGRAWAL avatar
us flag
I tried using perf mem but it doesn't reflect anything in terms of bytes (memory).
Score:0
vn flag
rvs

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.