This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for traceio.stp


I found traceio.stp very useful, but it only ran for a few seconds before exiting with the error 'ERROR: MAXACTION exceeded'. With some help in the IRC channel, I've modified teh traceio.stp file to run longer as well as adding some changes that gives me more useful information. I would rather have a list of Process IDs rather than Process name (pid instead of execname) because I haev multiple qemu-dm processes that I want individual disk usage stats for.

Thanks for such a great program. I wish I had found you earlier, you are going to make so many of my weekly headaches dissapear!

Here's the diff:

--- traceio.stp.orig    2009-04-27 15:17:38.000000000 -0600
+++ traceio.stp    2009-04-27 15:18:58.000000000 -0600
@@ -10,22 +10,20 @@
global reads, writes, total_io

probe vfs.read.return {
-  reads[execname()] += $return
+  reads[pid()] += $return
+  total_io[pid()] += $return
}

probe vfs.write.return {
-  writes[execname()] += $return
+  writes[pid()] += $return
+  total_io[pid()] += $return
}

probe timer.s(1) {
-  foreach (p in reads)
-    total_io[p] += reads[p]
-  foreach (p in writes)
-    total_io[p] += writes[p]
  foreach(p in total_io- limit 10)
-    printf("%15s r: %8d KiB w: %8d KiB\n",
-           p, reads[p]/1024,
-           writes[p]/1024)
+    printf("%8d r: %8d MiB w: %8d MiB\n",
+           p, reads[p]/1024/1024,
+           writes[p]/1024/1024)
  printf("\n")
  # Note we don't zero out reads, writes and total_io,
  # so the values are cumulative since the script started.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]