iostat for user IDs
Problem
We want to know which UID is doing the most IO on the system.
Scripts
global reads, writes, total_io probe kernel.function("vfs_read") { reads[uid()] <<< $count } probe kernel.function("vfs_write") { writes[uid()] <<< $count } # print top 10 IO processes every 5 seconds probe timer.s(5) { foreach (id in reads) total_io[id] += @sum(reads[id]) foreach (id in writes) total_io[id] += @sum(writes[id]) printf ("%10s\t%10s\t%10s\n", "User ID", "KB Read", "KB Written") foreach (id in total_io- limit 10) printf("%10d\t%10d\t%10d\n", id, @count(reads[id]) ? @sum(reads[id])/1024 : 0, @count(writes[id]) ? @sum(writes[id])/1024 : 0) delete reads delete writes delete total_io print("\n") }
Output
User ID KB Read KB Written 0 65432 0 19420 54826 0 82 4864 0 65534 4864 0 501 25 68
This script is based on SystemTap High-level presentation from Linux World San Francisco August 2006