misc: Use python f-strings for string formatting
This patch has been generated by applying flynt to the gem5 repo (ext has been excluded) JIRA: https://gem5.atlassian.net/browse/GEM5-831 Change-Id: I0935db6223d5426b99515959bde78e374cbadb04 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68957 Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
@@ -383,7 +383,7 @@ def timestampList(x):
|
||||
|
||||
def writeBinary(outfile, binary_list):
|
||||
for i in binary_list:
|
||||
outfile.write("%c" % i)
|
||||
outfile.write(f"{i:c}")
|
||||
|
||||
|
||||
############################################################
|
||||
@@ -751,7 +751,7 @@ def parseProcessInfo(task_file):
|
||||
if len(unified_event_list) == num_events:
|
||||
print("Truncating at", num_events, "events!")
|
||||
break
|
||||
print("Found %d events." % len(unified_event_list))
|
||||
print(f"Found {len(unified_event_list)} events.")
|
||||
|
||||
for process in process_list:
|
||||
if process.pid > 9990: # fix up framebuffer ticks
|
||||
@@ -1012,8 +1012,7 @@ def readGem5Stats(stats, gem5_stats_file):
|
||||
sim_freq = int(m.group(1)) # ticks in 1 sec
|
||||
ticks_in_ns = int(sim_freq / 1e9)
|
||||
print(
|
||||
"Simulation frequency found! 1 tick == %e sec\n"
|
||||
% (1.0 / sim_freq)
|
||||
f"Simulation frequency found! 1 tick == {1.0 / sim_freq:e} sec\n"
|
||||
)
|
||||
|
||||
# Final tick in gem5 stats: current absolute timestamp
|
||||
@@ -1145,7 +1144,7 @@ def doCapturedXML(output_path, stats):
|
||||
s.set("title", stat.group)
|
||||
s.set("name", stat_name)
|
||||
s.set("color", "0x00000000")
|
||||
s.set("key", "0x%08x" % stat.key)
|
||||
s.set("key", f"0x{stat.key:08x}")
|
||||
s.set("type", stat_name)
|
||||
s.set("event", "0x00000000")
|
||||
if stat.per_cpu:
|
||||
@@ -1354,7 +1353,7 @@ output_path = args.output_path
|
||||
# Make sure input path exists
|
||||
####
|
||||
if not os.path.exists(input_path):
|
||||
print("ERROR: Input path %s does not exist!" % input_path)
|
||||
print(f"ERROR: Input path {input_path} does not exist!")
|
||||
sys.exit(1)
|
||||
|
||||
####
|
||||
@@ -1389,7 +1388,7 @@ gem5_stats_file = input_path + "/stats.txt.gz"
|
||||
if not os.path.exists(gem5_stats_file):
|
||||
gem5_stats_file = input_path + "/stats.txt"
|
||||
if not os.path.exists(gem5_stats_file):
|
||||
print("ERROR: stats.txt[.gz] file does not exist in %s!" % input_path)
|
||||
print(f"ERROR: stats.txt[.gz] file does not exist in {input_path}!")
|
||||
sys.exit(1)
|
||||
|
||||
readGem5Stats(stats, gem5_stats_file)
|
||||
|
||||
Reference in New Issue
Block a user