From: Alan J. Pippin Date: Tue, 4 Mar 2008 02:59:05 +0000 (-0700) Subject: Added ability to deal with negative data values. X-Git-Url: http://git.pippins.net/embedvideo/.git/static/images/%7Blink_ppi%7D?a=commitdiff_plain;h=f0c078cb87970f248e3d86cbc8b219d89690119d;p=zfs-nexenta%2F.git Added ability to deal with negative data values. --- diff --git a/zfs-log-parser b/zfs-log-parser index 26b0589..5c28003 100755 --- a/zfs-log-parser +++ b/zfs-log-parser @@ -37,9 +37,9 @@ sub adjust_duration { sub adjust_data { my ($data) = @_; - if($data > ($giga)) { $data = $data / $giga; $data = sprintf("%2.2fGb",$data); } - elsif($data > ($mega)) { $data = int($data / $mega); $data = "$data"."Mb"; } - elsif($data > ($kilo)) { $data = int($data / $kilo); $data = "$data"."Kb"; } + if(abs($data) > ($giga)) { $data = $data / $giga; $data = sprintf("%2.2fGb",$data); } + elsif(abs($data) > ($mega)) { $data = int($data / $mega); $data = "$data"."Mb"; } + elsif(abs($data) > ($kilo)) { $data = int($data / $kilo); $data = "$data"."Kb"; } return $data; }