Skip to content

Commit

Permalink
better output formatting
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@23248 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 21, 2019
1 parent a952edc commit a17d88f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/unittests/unit/net/protocol_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def test_encoders_and_compressors(self):
assert items

def test_read_speed(self):
print("\n")
total_size = 0
total_elapsed = 0
n_packets = 0
Expand All @@ -137,10 +138,10 @@ def test_read_speed(self):
total_size += size
total_elapsed += elapsed
n_packets += n
log.info("\n%-9s incoming packet processing speed:\t%iMB/s",
self.protocol_class.TYPE, total_size/total_elapsed//1024//1024)
log.info("\n%-9s packet parsed per second:\t\t%i",
self.protocol_class.TYPE, n_packets/elapsed)
print("%-9s incoming packet processing speed:\t%iMB/s" % (
self.protocol_class.TYPE, total_size/total_elapsed//1024//1024))
print("%-9s packet parsed per second:\t\t%i" % (
self.protocol_class.TYPE, n_packets/elapsed))


def do_test_read_speed(self, pixel_data_size=2**18, N=100):
Expand Down Expand Up @@ -199,6 +200,7 @@ def repeat_list(self, items, N=100):
return l

def test_format_thread(self):
print("\n")
packets = self.make_test_packets()
N = 1000
many = self.repeat_list(packets, N)
Expand Down Expand Up @@ -230,9 +232,9 @@ def process_packet_cb(proto, packet):
total_size = sum(len(packet) for packet in conn.write_data)
elapsed = end-start
log("bytes=%s, elapsed=%s", total_size, elapsed)
log.info("\n%-9s format thread:\t\t\t%iMB/s", protocol.TYPE, int(total_size/elapsed//1024//1024))
print("%-9s format thread:\t\t\t%iMB/s" % (protocol.TYPE, int(total_size/elapsed//1024//1024)))
n_packets = len(packets)*N
log.info("\n%-9s packets formatted per second:\t\t%i", protocol.TYPE, int(n_packets/elapsed))
print("%-9s packets formatted per second:\t\t%i" % (protocol.TYPE, int(n_packets/elapsed)))
assert conn.write_data


Expand Down

0 comments on commit a17d88f

Please sign in to comment.