util: Port util to python3

This commit is the result of running 2to3 converter on the util
subdirectory

JIRA: https://gem5.atlassian.net/browse/GEM5-832

Change-Id: I4e7e2d2b1b99f7bcc5fe0f6dc5d25880323616eb
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/37797
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2020-11-19 18:51:13 +00:00
parent da7ce72144
commit 2a2bc262f3
58 changed files with 578 additions and 583 deletions

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python2.7
#! /usr/bin/env python3
# Copyright (c) 2005 The Regents of The University of Michigan
# All rights reserved.
@@ -39,18 +39,18 @@ def category(app,sym):
else:
name = app
if categories.has_key(name):
if name in categories:
return categories[name]
for regexp, cat in categories_re:
if regexp.match(name):
return cat
print "no match for symbol %s" % name
print("no match for symbol %s" % name)
return 'other'
try:
(opts, files) = getopt.getopt(sys.argv[1:], 'i')
except getopt.GetoptError:
print "usage", sys.argv[0], "[-i] <files>"
print("usage", sys.argv[0], "[-i] <files>")
sys.exit(2)
showidle = True
@@ -58,7 +58,7 @@ showidle = True
for o,v in opts:
if o == "-i":
showidle = False
print files
print(files)
f = open(files.pop())
total = 0
prof = {}
@@ -87,6 +87,6 @@ if showidle:
# print "%s -- %5.1f%% " % (prof[i][1], 100 * float(prof[i][0])/float(total))
for d in cats:
if prof.has_key(d):
print "%s -- %5.1f%% " % (d, 100 * float(prof[d])/float(total))
if d in prof:
print("%s -- %5.1f%% " % (d, 100 * float(prof[d])/float(total)))