Mar
22
Who's abusing my SATA controller?
Just read this interesting post. Had to change the read command somewhat to match my dmesg format (timestamps, you know).
Anyway, here's the result:
$ su -
# /etc/init.d/syslog-ng stop
# echo 1 > /proc/sys/vm/block_dump
# echo "Wait some time here, just use your desktop as usual"
# dmesg | gawk '/(READ|WRITE|dirtied)/ {activity[$3]++} END {for (x in activity) print activity[x],x}'| sort -nr | head -n 10 | gawk '{print $2 " " $1}'
pdflush(215): 160
evolution(7736): 149
pdflush(7670): 126
firefox-bin(7748): 26
gaim(7146): 12
jfsCommit(221): 5
gconfd-2(7114): 5
mono(7200): 4
mono(7199): 4
jfsIO(220): 4
# echo 0 > /proc/sys/vm/block_dump
# /etc/init.d/syslog-ng start
# exit
Comments:
Comment from: Jeff Schroeder [Visitor]
· http://www.digitalprognosis.com

Very sweet little hack. Thanks for the awk-foo.

The number of times I've wanted something like this.
Now I just need to remember it!
Now I just need to remember it!

Comment from: Jeff Schroeder [Visitor]
· http://www.digitalprognosis.com

On Ubuntu Linux with standard syslogd, this is the proper awk command:
dmesg | awk '/(READ|WRITE|dirtied)/ {activity[$2]++} END {for (x in activity) print x, activity[x]}'| sort -nr | head -n 10
Also notice that I managed to cut out a pipe | gawk by switching the x order around.
Thanks for this awesome tip!
dmesg | awk '/(READ|WRITE|dirtied)/ {activity[$2]++} END {for (x in activity) print x, activity[x]}'| sort -nr | head -n 10
Also notice that I managed to cut out a pipe | gawk by switching the x order around.
Thanks for this awesome tip!

Comment from: Jeff Schroeder [Visitor]
· http://www.digitalprognosis.com

And as a final comment, it dawned on me that this could be somewhat less ugly in perl so here is a hacked up version in perl:
http://www.digitalprognosis.com/opensource/scripts/topio.pl
http://www.digitalprognosis.com/opensource/scripts/topio.pl
