From: Brian Warner Date: Wed, 19 Nov 2008 03:17:36 +0000 (-0700) Subject: cli: 'tahoe stats': add abbreviated size to the histogram. Not sure this actually... X-Git-Tag: allmydata-tahoe-1.3.0~403 X-Git-Url: https://git.rkrishnan.org/%5B/COPYING.TGPPL.html?a=commitdiff_plain;h=9871f3f1b709a67777ed2721cf4e969f55205a5a;p=tahoe-lafs%2Ftahoe-lafs.git cli: 'tahoe stats': add abbreviated size to the histogram. Not sure this actually improves things. --- diff --git a/src/allmydata/scripts/tahoe_manifest.py b/src/allmydata/scripts/tahoe_manifest.py index c7aac42c..7469f9e9 100644 --- a/src/allmydata/scripts/tahoe_manifest.py +++ b/src/allmydata/scripts/tahoe_manifest.py @@ -1,5 +1,6 @@ from allmydata.util import base32 +from allmydata.util.abbreviate import abbreviate_space_both from allmydata import uri from allmydata.scripts.slow_operation import SlowOperationRunner @@ -59,14 +60,19 @@ class StatsGrabber(SlowOperationRunner): maxlen = max([len(str(maxsize)) for (minsize, maxsize, count) in data["size-files-histogram"]]) + maxcountlen = max([len(str(count)) + for (minsize, maxsize, count) + in data["size-files-histogram"]]) minfmt = "%" + str(maxlen) + "d" maxfmt = "%-" + str(maxlen) + "d" - linefmt = minfmt + "-" + maxfmt + " : %d" + countfmt = "%-" + str(maxcountlen) + "d" + linefmt = minfmt + "-" + maxfmt + " : " + countfmt + " %s" for (minsize, maxsize, count) in data["size-files-histogram"]: if prevmax is not None and minsize != prevmax+1: print >>stdout, " "*(maxlen-1) + "..." prevmax = maxsize - print >>stdout, linefmt % (minsize, maxsize, count) + print >>stdout, linefmt % (minsize, maxsize, count, + abbreviate_space_both(maxsize)) def stats(options): return StatsGrabber().run(options)