return "%s" % num
# Rounding error, return 0
- elif num > 0 and num < 1:
+ elif 0 < num < 1:
num = 0
while num > scale and index < 5:
"columns"
]
)
-
- except getopt.error, msg:
+ except getopt.error as msg:
sys.stderr.write(msg)
usage()
+ opts = None
for opt, arg in opts:
if opt in ('-x', '--extended'):
out = open(opfile, "w")
sys.stdout = out
- except:
+ except IOError:
sys.stderr.write("Cannot open %s for writing\n" % opfile)
sys.exit(1)
global v
global l2exist
- v = {}
+ v = dict()
v["time"] = time.strftime("%H:%M:%S", time.localtime())
v["hits"] = d["hits"] / sint
v["miss"] = d["misses"] / sint
v["l2bytes"] = d["l2_read_bytes"] / sint
-def sighandler(*args):
+def sighandler():
sys.exit(0)
return "%*s" % (sz, num)
# Rounding error, return 0
- elif num > 0 and num < 1:
+ elif 0 < num < 1:
num = 0
while num > scale and index < 5:
return d
+
def print_dict(d):
print_header()
- for pool in d.iterkeys():
- for objset in d[pool].iterkeys():
- for v in d[pool][objset].itervalues():
+ for pool in d.keys():
+ for objset in d[pool].keys():
+ for v in d[pool][objset].values():
print_values(v)
+
def dnodes_build_dict(filehandle):
labels = dict()
dnodes = dict()
# First 3 lines are header information, skip the first two
- for i in range(0, 2):
+ for i in range(2):
next(filehandle)
# The third line contains the labels and index locations
return dnodes
+
def types_build_dict(filehandle):
labels = dict()
types = dict()
# First 3 lines are header information, skip the first two
- for i in range(0, 2):
+ for i in range(2):
next(filehandle)
# The third line contains the labels and index locations
return types
+
def buffers_print_all(filehandle):
labels = dict()
# First 3 lines are header information, skip the first two
- for i in range(0, 2):
+ for i in range(2):
next(filehandle)
# The third line contains the labels and index locations
)
except getopt.error:
usage()
+ opts = None
for opt, arg in opts:
if opt in ('-b', '--buffers'):
try:
tmp = open(ifile, "r")
sys.stdin = tmp
- except:
+ except IOError:
sys.stderr.write("Cannot open %s for reading\n" % ifile)
sys.exit(1)