summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/iostats19
1 files changed, 16 insertions, 3 deletions
diff --git a/bin/iostats b/bin/iostats
index 924c273..d55d550 100755
--- a/bin/iostats
+++ b/bin/iostats
@@ -3,8 +3,9 @@
# Usage: pipe the output of Linux's `strace' program into the stdin of
# this command, and the output of this command into gnuplot.
-$filename = shift || "tstab2.h5";
-$total = 0;
+my $filename = shift || "tstab2.h5";
+my $total = 0;
+my %What; # What{pos}{nbytes}{r|w} = naccesses
while (<>) {
if (!defined $fd) {
@@ -22,6 +23,7 @@ while (<>) {
} elsif (/^write\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ &&
$1==$fd && $3>=0) {
my $nbytes = $3;
+ $What{$pos}{$nbytes}{w}++;
printf "%d %d\n", $total, $pos;
$pos += $nbytes;
$total += $nbytes;
@@ -30,6 +32,7 @@ while (<>) {
} elsif (/^read\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ &&
$1==$fd && $3>=0) {
my $nbytes = $3;
+ $What{$pos}{$nbytes}{r}++;
printf "%d %d\n", $total, $pos;
$pos += $nbytes;
$total += $nbytes;
@@ -37,4 +40,14 @@ while (<>) {
die $_;
}
}
-
+
+
+print "="x36, "\n";
+ printf "%8s %8s %8s %8s\n","Position","NBytes","NReads","NWrites";
+for $pos (sort {$a<=>$b} keys %What) {
+ for $nbytes (sort {$a<=>$b} keys %{$What{$pos}}) {
+ printf "%8d %8d %8d %8d\n", $pos, $nbytes,
+ $What{$pos}{$nbytes}{r},
+ $What{$pos}{$nbytes}{w};
+ }
+}