Specifications
Analyze Collected Detailed Rate of Change Data
return @totalvals;
}
# converts to KB, MB, etc. and outputs size in readable form
sub HumanSize {# params: bytes/bits
my $bytes = shift;
my @suffixes = ('', 'K', 'M', 'G', 'T', 'P' );
my $i = 0;
while ($bytes / 1024.0 >= 1) {
$bytes /= 1024.0;
$i++;
}
return sprintf("%.1f %s", $bytes, $suffixes[$i]);
}
# convert human-readable time interval to number of seconds
sub TimeHuman {# params: human_time
my $time = shift;
my %suffixes = ('s' => 1, 'm' => 60, 'h' => 60 * 60, 'd' => 60 * 60 *
24);
$time =~ /^([0-9]*)(.*?)$/;
$time = $1;
my $suffix = (split //, $2)[0]; # first letter from suffix
if (exists $suffixes{$suffix}) {
$time *= $suffixes{$suffix};
}
return $time;
}
sub epoch {# params: date
my $date = shift;
my $seconds = `date +'%s' --date "$date" 2>&1`;
if ($? != 0) {
die "Failed to recognize time stamp: $date\n";
}
return $seconds;
}
Usage:
# ./roc-calc-diskstats <interval> <start_time> <diskstats-data-
file> [dev-list]
Usage Example (Summary only):
SteelEye Protection Suite for Linux273