[Jifty-commit] r6264 - in jifty/trunk: bin
Jifty commits
jifty-commit at lists.jifty.org
Fri Jan 23 15:41:14 EST 2009
Author: sartak
Date: Fri Jan 23 15:41:14 2009
New Revision: 6264
Modified:
jifty/trunk/ (props changed)
jifty/trunk/bin/memory_log
Log:
r78894 at onn: sartak | 2009-01-23 15:41:04 -0500
Prettify negative numbers too
Modified: jifty/trunk/bin/memory_log
==============================================================================
--- jifty/trunk/bin/memory_log (original)
+++ jifty/trunk/bin/memory_log Fri Jan 23 15:41:14 2009
@@ -19,14 +19,15 @@
for my $hit (sort { $b->[0] <=> $a->[0] } @hits) {
my $human_readable = sub {
- my $bytes = shift;
+ my $bytes = abs(shift);
return $bytes if $bytes < 1024;
return int($bytes / 1024) . 'KB' if $bytes < 1024 ** 2;
return int($bytes / 1024**2) . 'MB' if $bytes < 1024 ** 3;
return int($bytes / 1024**3) . 'GB';
}->($hit->[0]);
- $human_readable =~ s/^(?!-)/+/; # add leading + if it's not negative
+ $human_readable = ($hit->[0] > 0 ? '+' : '-')
+ . $human_readable;
print "$hit->[1]: $human_readable\n";
}
More information about the Jifty-commit
mailing list