Linux memory analysis
Jump to navigation
Jump to search
Some fancy command lines to get back information on memory usage
Get all running processes and its major page fault count
ps -eo min_flt,maj_flt,cmd,uid,gid
To run a single command and get the perfomance info, run it via the time binary like this:
/bin/time -v ls
Command being timed: "ls"
User time (seconds): 0.00
System time (seconds): 0.02
Percent of CPU this job got: 64%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0m 0.03s
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 2544
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 171
Voluntary context switches: 0
Involuntary context switches: 48
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
To get a statistical snapshot every second try the vmstat command:
/ # vmstat 1
vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 24300 6780 12 34220 2 16 2 2 1389 3275 5 10 85 0 0
0 0 24300 6668 12 34220 0 0 0 0 1357 3050 8 4 88 0 0
...