4 Linux Commands To View Page Faults Statistics
Here are four Linux commands to view page fault statistics:
vmstat- This is a versatile command that provides information on system resource utilization, including page faults. Thevmstatcommand reports the number of page faults in the "faults" column.
vmstatrnprocs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa strn 1 0 0 356428 76048 573456 0 0 3 55 2 4 1 0 99 0 0In this example, the si and so columns indicate the number of pages swapped in and out, respectively. The "faults" value is the sum of si and so.
/proc/meminfo- This is a special file in the/procfile system that contains information about the system's memory usage. You can use thegrepcommand to display the page fault statistics:
grep -E '^(Page.*Faults)' /proc/meminfornPage Faults: 9907In this example, the "Page Faults" value indicates the number of page faults that have occurred.
sar- This command provides system utilization information and can be used to display page fault statistics. To view page fault statistics withsar, you need to install thesysstatpackage.
sar -BrnLinux 4.18.0-193.19.1.el8_2.x86_64 (server) 08/02/2023 _x86_64_ (4 CPU)
05:34:01 PM pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeffrn05:34:02 PM 0.00 45.00 0.00 0.00 0.00 0.00 0.00 0.00
05:34:03 PM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
05:34:04 PM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: 0.00 22.50 0.00 0.00 0.00 0.00 0.00 0.00In this example, the "fault/s" column indicates the number of page faults per second.
mpstat- This command provides information on processor and system activity, including page fault statistics.
mpstatrnLinux 4.18.0-193.19.1.el8_2.x86_64 (server) 08/02/2023 _x86_64_ (4 CPU)
05:38:01 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idlern05:38:02 PM