Commit 266ebdac authored by Guido van Rossum's avatar Guido van Rossum

(Apologies to Jeremy. One 'h' is enough in the getopt argument list. :-)

Sort options alphabetically.  Remove dependency between -S, -q and -v
options (-S no longer disables -q and enables -v).  Remove dependency
between -S and -h (histogram is printed regardless of dostats).
parent 6c2d38e1
......@@ -14,12 +14,12 @@
##############################################################################
"""Trace file statistics analyzer.
Usage: stats.py [-h] [-i interval] [-q] [-v] [-S] tracefile
Usage: stats.py [-h] [-i interval] [-q] [-S] [-v] tracefile
-h: print histogram
-i: summarizing interval in minutes (default 15; max 60)
-q: quiet; don't print sommaries
-q: quiet; don't print summaries
-S: don't print statistics
-v: verbose; print each record
-S: don't print statistics (turns off -q)
"""
"""File format:
......@@ -66,11 +66,13 @@ def main():
print_histogram = 0
interval = 900 # Every 15 minutes
try:
opts, args = getopt.getopt(sys.argv[1:], "hi:qvSh")
opts, args = getopt.getopt(sys.argv[1:], "hi:qSv")
except getopt.error, msg:
usage(msg)
return 2
for o, a in opts:
if o == '-h':
print_histogram = 1
if o == "-i":
interval = int(60 * float(a))
if interval <= 0:
......@@ -80,14 +82,10 @@ def main():
if o == "-q":
quiet = 1
verbose = 0
if o == "-v":
verbose = 1
if o == "-S":
dostats = 0
if o == "-v":
verbose = 1
quiet = 0
if o == '-h':
print_histogram = 1
if len(args) != 1:
usage("exactly one file argument required")
return 2
......@@ -225,6 +223,8 @@ def main():
addcommas(bycode.get(code, 0)),
code,
explain.get(code) or "*** unknown code ***")
# Print histogram
if print_histogram:
print
print "Histogram of object load frequency"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment