-#Removed some statstics like open, close that obdfilter don't contains.
-#To add statistics parameters one need to specify parameter names in below declarations in same sequence.
-my ($read_bytes, $write_bytes, $create, $destroy, $statfs, $punch, $snapshot_time) =
- ("read_bytes", "write_bytes", "create", "destroy", "statfs", "punch", "snapshot_time");
+# Removed some statstics like open, close that obdfilter doesn't contain.
+# To add statistics parameters one needs to specify parameter names in the
+# below declarations in the same sequence.
+my ($read_bytes, $write_bytes, $create, $destroy, $statfs, $punch,
+ $snapshot_time) = ("read_bytes", "write_bytes", "create", "destroy",
+ "statfs", "punch", "snapshot_time");
- my $prevcount;
- my @iodata;
-
- seek STATS, 0, 0;
- while (<STATS>) {
- chop;
-# ($name, $cumulcount, $samples, $unit, $min, $max, $sum, $sumsquare)
- @iodata = split(/\s+/, $_);
- my $name = $iodata[0];
-
- $prevcount = $cur{$name};
- if (defined($prevcount)) {
- $last{$name} = $prevcount;
- }
- if ($name =~ /^read_bytes$/ || $name =~ /^write_bytes$/) {
- $cur{$name} = $iodata[6];
- }
- elsif ($name =~ /^snapshot_time$/) {
-# $cumulcount =~ /(\d+)/;
- $cur{$name} = $iodata[1];
- }
- else {
- $cur{$name} = $iodata[1];
- }
- }
+ my $prevcount;
+ my @iodata;
+
+ seek STATS, 0, 0;
+ while (<STATS>) {
+ chop;
+# ($name, $cumulcount, $samples, $unit, $min, $max, $sum, $sumsquare)
+ @iodata = split(/\s+/, $_);
+ my $name = $iodata[0];
+
+ $prevcount = $cur{$name};
+ if (defined($prevcount)) {
+ $last{$name} = $prevcount;
+ }
+ if ($name =~ /^read_bytes$/ || $name =~ /^write_bytes$/) {
+ $cur{$name} = $iodata[6];
+ }
+ elsif ($name =~ /^snapshot_time$/) {
+# $cumulcount =~ /(\d+)/;
+ $cur{$name} = $iodata[1];
+ } else {
+ $cur{$name} = $iodata[1];
+ }
+ }
- my $delta;
- my $data;
- my $last_time = $last{$snapshot_time};
- if (!defined($last_time)) {
- printf "Read: %-g, Write: %-g, create/destroy: %-g/%-g, stat: %-g, punch: %-g\n",
- $cur{$read_bytes}, $cur{$write_bytes},
- $cur{$create}, $cur{$destroy},
- $cur{$statfs}, $cur{$punch};
- if ($interval) {
- print "[NOTE: cx: create, dx: destroy, st: statfs, pu: punch ]\n\n";
- print "Timestamp Read-delta ReadRate Write-delta WriteRate\n";
- print "--------------------------------------------------------\n";
- }
- }
- else {
- my $timespan = $cur{$snapshot_time} - $last{$snapshot_time};
- my $rdelta = $cur{$read_bytes} - $last{$read_bytes};
- my $rrate = ($rdelta) / ($timespan * ( 1 << 20 ));
- my $wdelta = $cur{$write_bytes} - $last{$write_bytes};
- my $wrate = ($wdelta) / ($timespan * ( 1 << 20 ));
- $rdelta = ($rdelta) / (1024 * 1024);
- $wdelta = ($wdelta) / (1024 * 1024);
- # This print repeats after every interval.
- printf "%10lu %6.2fMB %6.2fMB/s %6.2fMB %6.2fMB/s",
- $cur{$snapshot_time}, $rdelta, $rrate, $wdelta, $wrate;
-
- $delta = $cur{$getattr} - $last{$getattr};
- if ( $delta != 0 ) {
- $rdelta = int ($delta/$timespan);
- print " ga:$delta,$rdelta/s";
- }
-
- for $data ( @extinfo ) {
- $delta = $cur{$data} - $last{$data};
- if ($delta != 0) {
- print " $shortname{$data}:$delta";
- }
- }
- print "\n";
- $| = 1;
- }
+ my $delta;
+ my $data;
+ my $last_time = $last{$snapshot_time};
+ if (!defined($last_time)) {
+ printf "Read: %-g, Write: %-g, create/destroy: %-g/%-g, stat: %-g, punch: %-g\n",
+ $cur{$read_bytes}, $cur{$write_bytes},
+ $cur{$create}, $cur{$destroy},
+ $cur{$statfs}, $cur{$punch};
+ if ($interval) {
+ print "[NOTE: cx: create, dx: destroy, st: statfs, pu: punch ]\n\n";
+ print "Timestamp Read-delta ReadRate Write-delta WriteRate\n";
+ print "--------------------------------------------------------\n";
+ }
+ } else {
+ my $timespan = $cur{$snapshot_time} - $last{$snapshot_time};
+ my $rdelta = $cur{$read_bytes} - $last{$read_bytes};
+ my $rrate = ($rdelta) / ($timespan * ( 1 << 20 ));
+ my $wdelta = $cur{$write_bytes} - $last{$write_bytes};
+ my $wrate = ($wdelta) / ($timespan * ( 1 << 20 ));
+ $rdelta = ($rdelta) / (1024 * 1024);
+ $wdelta = ($wdelta) / (1024 * 1024);
+ # This print repeats after every interval.
+ printf "%10lu %6.2fMB %6.2fMB/s %6.2fMB %6.2fMB/s",
+ $cur{$snapshot_time}, $rdelta, $rrate, $wdelta, $wrate;
+
+ $delta = $cur{$getattr} - $last{$getattr};
+ if ( $delta != 0 ) {
+ $rdelta = int ($delta/$timespan);
+ print " ga:$delta,$rdelta/s";
+ }
+
+ for $data ( @extinfo ) {
+ $delta = $cur{$data} - $last{$data};
+ if ($delta != 0) {
+ print " $shortname{$data}:$delta";
+ }
+ }
+ print "\n";
+ $| = 1;
+ }