Skip to content

Commit

Permalink
tools/kvm_stat: Fix python3 syntax
Browse files Browse the repository at this point in the history
$ python3 tools/kvm/kvm_stat/kvm_stat
  File "tools/kvm/kvm_stat/kvm_stat", line 1137
    def sortkey((_k, v)):
                ^
SyntaxError: invalid syntax

Fix it in a way that's compatible with python2 and python3

Signed-off-by: Cole Robinson <[email protected]>
Tested-by: Stefan Raspl <[email protected]>
Signed-off-by: Radim Krčmář <[email protected]>
  • Loading branch information
crobinso authored and rkrcmar committed Mar 28, 2018
1 parent 8566ac8 commit 6ade1ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/kvm/kvm_stat/kvm_stat
Original file line number Diff line number Diff line change
Expand Up @@ -1134,12 +1134,14 @@ class Tui(object):
def get_sorted_events(self, stats):
""" separate parent and child events """
if self._sorting == SORT_DEFAULT:
def sortkey((_k, v)):
def sortkey(pair):
# sort by (delta value, overall value)
v = pair[1]
return (v.delta, v.value)
else:
def sortkey((_k, v)):
def sortkey(pair):
# sort by overall value
v = pair[1]
return v.value

childs = []
Expand Down

0 comments on commit 6ade1ae

Please sign in to comment.