profiler: Respect provided output stream
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
38810b3f13
commit
aabf8faea0
@ -69,10 +69,8 @@ class Profiler(object):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def print_results(cls, stream=sys.stdout):
|
def print_results(cls, stream=sys.stdout):
|
||||||
print("Profiling results:", file=sys.stdout)
|
print("Profiling results:", file=stream)
|
||||||
results = cls._data.items()
|
results = cls._data.items()
|
||||||
results = sorted(results, key=lambda x: x[1]["time"], reverse=True)
|
results = sorted(results, key=lambda x: x[1]["time"], reverse=True)
|
||||||
for name, data in results:
|
for name, data in results:
|
||||||
print(
|
print(" %6.2f %5d %s" % (data["time"], data["calls"], name), file=stream)
|
||||||
" %6.2f %5d %s" % (data["time"], data["calls"], name), file=sys.stdout
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user