profiler: Fix sorting on Python 3

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-09-05 09:56:00 +02:00
parent 9dbf231080
commit 3ef2a65275

View File

@ -69,6 +69,6 @@ class Profiler(object):
def print_results(cls):
print("Profiling results:")
results = cls._data.items()
results.sort(lambda x, y: cmp(x[1]["time"], y[1]["time"]), reverse=True)
results = sorted(results, key=lambda x: x[1]["time"], reverse=True)
for name, data in results:
print(" %6.2f %5d %s" % (data["time"], data["calls"], name))