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.
$ cat /proc/sys/fs/dentry-state 17782 9733 45 0 0 0
$ cat /proc/sys/fs/inode-state 68034 21738 0 0 0 0 0
dd if=/dev/zero of=/dev/sdb bs=1MBNOTE: be careful - do this on the wrong device - and your data is gone capoot!
open()
system call.
dd if=/dev/zero of=/dev/sdb bs=1MB oflag=directNOTE: be careful - do this on the wrong device - and your data is gone capoot!
$ cat /proc/1275/io rchar: 1661777 wchar: 7431 syscr: 1240 syscw: 123 read_bytes: 7335936 write_bytes: 12288 cancelled_write_bytes: 0