Commit 6ade1ae8 authored by Cole Robinson's avatar Cole Robinson Committed by Radim Krčmář

tools/kvm_stat: Fix python3 syntax

$ 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: default avatarCole Robinson <crobinso@redhat.com>
Tested-by: default avatarStefan Raspl <stefan.raspl@linux.vnet.ibm.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent 8566ac8b
......@@ -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 = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment