- 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);
+ my $timespan = $cur{$timestamp} - $last{$timestamp};
+ my $rtot = ($cur{$read_bytes} - $last{$read_bytes}) / (1 << 20);
+ my $riops = ($cur{"read_ops"} - $last{"read_ops"}) / $timespan;
+ my $rrate = $rtot / $timespan;
+ my $wtot = ($cur{$write_bytes} - $last{$write_bytes}) / (1 << 20);
+ my $wiops = ($cur{"write_ops"} - $last{"write_ops"}) / $timespan;
+ my $wrate = $wtot / $timespan;
+
+ # this is printed once per screen, like vmstat/iostat
+ if ($count++ % ($height - 2) == 0) {
+ print "Timestamp Read-MiB RdMiB/s WriteMiB WrMiB/s RdIOPS WrIOPS\n";
+ print "---------- -------- ------- -------- ------- ------ ------\n";
+ if ($have_readkey) {
+ ($width, $height, $wpixels, $hpixels) = GetTerminalSize();
+ } else {
+ ($height, $width) = split / /, `stty size 2> /dev/null`;
+ #$width = 120 if ! $width
+ }
+ }