def test_add_throughput_event_total_bytes(self): self.assertEqual(0, throughput_statistics.interval_data.total_in) throughput_statistics.add_event(NetworkDirection.INBOUND, "mock_msg", 100, "localhost 0000") throughput_statistics.add_event(NetworkDirection.INBOUND, "mock_msg", 100, "localhost 0000") self.assertEqual(200, throughput_statistics.interval_data.total_in)
def test_add_throughput_event_peer_count(self): self.assertEqual( 0, len(throughput_statistics.interval_data.peer_to_stats)) throughput_statistics.add_event(NetworkDirection.INBOUND, "mock_msg", 100, "localhost 0000") self.assertEqual( 1, len(throughput_statistics.interval_data.peer_to_stats))
def test_add_throughput_event_flush(self): self.assertEqual(1, throughput_statistics.reset) self.assertEqual(0, throughput_statistics.interval_data.total_in) throughput_statistics.add_event(Direction.INBOUND, "mock_msg", 100, "localhost 0000") self.assertEqual(100, throughput_statistics.interval_data.total_in) throughput_statistics.flush_info() self.assertEqual(0, throughput_statistics.interval_data.total_in)
def add_throughput_event( direction: NetworkDirection, msg_type: str, msg_size: int, peer_desc: str, peer_id: Optional[str] = None, ): return throughput_statistics.add_event(direction, msg_type, msg_size, peer_desc, peer_id)
def add_throughput_event(direction, msg_type, msg_size, peer_desc): return throughput_statistics.add_event(direction, msg_type, msg_size, peer_desc)