Hoa Nguyen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/44447 )

Change subject: util: Make o3-pipeview Python3 compatible
......................................................................

util: Make o3-pipeview Python3 compatible

Change-Id: I48cb0bfb784eafe2057eb1095e6aad7abf9a1bc9
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
---
M util/o3-pipeview.py
1 file changed, 6 insertions(+), 9 deletions(-)



diff --git a/util/o3-pipeview.py b/util/o3-pipeview.py
index 2401e8f..11e86a7 100755
--- a/util/o3-pipeview.py
+++ b/util/o3-pipeview.py
@@ -148,10 +148,6 @@
         fields = line.split(':')


-#Sorts out instructions according to sequence number
-def compare_by_sn(a, b):
-    return cmp(a['sn'], b['sn'])
-
 # Puts new instruction into the print queue.
# Sorts out and prints instructions when their number reaches threshold value def queue_inst(outfile, inst, cycle_time, width, color, timestamps, store_completions):
@@ -164,7 +160,8 @@
 # Sorts out and prints instructions in print queue
def print_insts(outfile, cycle_time, width, color, timestamps, store_completions, lower_threshold):
     global insts
-    insts['queue'].sort(compare_by_sn)
+    # sort the list of insts by sequence numbers
+    insts['queue'].sort(key=lambda inst: inst['sn'])
     while len(insts['queue']) > lower_threshold:
         print_item=insts['queue'].pop(0)
# As the instructions are processed out of order the main loop starts
@@ -223,7 +220,7 @@
     # Print

     time_width = width * cycle_time
-    base_tick = (inst['fetch'] / time_width) * time_width
+    base_tick = (inst['fetch'] // time_width) * time_width

     # Find out the time of the last event - it may not
     # be 'retire' if the instruction is not comlpeted.
@@ -237,7 +234,7 @@
     if ((last_event_time - inst['fetch']) < time_width):
         num_lines = 1 # compact form
     else:
-        num_lines = ((last_event_time - base_tick) / time_width) + 1
+        num_lines = ((last_event_time - base_tick) // time_width) + 1

     curr_color = termcap.Normal

@@ -267,7 +264,7 @@
             if (stages[event[2]]['name'] == 'dispatch' and
                 inst['dispatch'] == inst['issue']):
                 continue
- outfile.write(curr_color + dot * ((event[0] / cycle_time) - pos)) + outfile.write(curr_color + dot * ((event[0] // cycle_time) - pos))
             outfile.write(stages[event[2]]['color'] +
                           stages[event[2]]['shorthand'])

@@ -276,7 +273,7 @@
             else:
                 curr_color = termcap.Normal

-            pos = (event[0] / cycle_time) + 1
+            pos = (event[0] // cycle_time) + 1
         outfile.write(curr_color + dot * (width - pos) + termcap.Normal +
']-(' + str(base_tick + i * time_width).rjust(15) + ') ')
         if i == 0:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44447
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I48cb0bfb784eafe2057eb1095e6aad7abf9a1bc9
Gerrit-Change-Number: 44447
Gerrit-PatchSet: 1
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to