iostat -k 1 -x
.
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 3.00 0.00 4.00 0.00 28.00 14.00 0.01 2.50 2.50 1.00
scd0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
explanations for some fields:
mincore()
can be used to check if certain
pages are mapped in memory or not.
fincore
utility uses this system-call to check what
part of memory a file uses.
lsof
, we can check the entire
contents of the cache:
#!/bin/bash
lsof | grep REG | awk '{print($9)}' | while read fn; do
echo $fn `fincore $fn -justsummarize`
done
/usr/bin/gnome-keyring-daemon page size: 4096 bytes 56 pages, 224.0 kbytes in core for 1 file; 56.00 pages, 224.0 kbytes per file. /lib/libnss_files-2.11.1.so page size: 4096 bytes 12 pages, 48.0 kbytes in core for 1 file; 12.00 pages, 48.0 kbytes per file.
lsof
.
page1 | page2 | page3 | page4 |
---|---|---|---|
cache | disk | cache | disk |
# cat /sys/block/sda/queue/read_ahead_kb 128
# echo 256 > /sys/block/sda/queue/read_ahead_kb # cat /sys/block/sda/queue/read_ahead_kb 256
read()
will copy into a single buffer.
readv
will copy into multiple buffers.