3.0.ipv8.messaging.interfaces.network_stats =========================================== .. py:module:: 3.0.ipv8.messaging.interfaces.network_stats Classes ------- .. autoapisummary:: 3.0.ipv8.messaging.interfaces.network_stats.NetworkStat Module Contents --------------- .. py:class:: NetworkStat(identifier: int) Represents an individual network statistic. This is used to compose the overall community statistics. Includes the following properties for the given statistic: - identifier: char - num_up: integer - num_down: integer - bytes_up: integer - bytes_down: integer - first_measured_up: float - first_measured_down: float - last_measured_up: float - last_measured_down: float .. py:attribute:: identifier :type: int Message identifier. .. py:attribute:: num_up :type: int :value: 0 Number of messages sent. .. py:attribute:: num_down :type: int :value: 0 Number of messages received. .. py:attribute:: bytes_up :type: int :value: 0 Number of bytes sent. .. py:attribute:: bytes_down :type: int :value: 0 Number of bytes received. .. py:attribute:: first_measured_up :type: float :value: 0 Timestamp of the first message sent. .. py:attribute:: first_measured_down :type: float :value: 0 Timestamp of the first message received. .. py:attribute:: last_measured_up :type: float :value: 0 Timestamp of the most recent message sent. .. py:attribute:: last_measured_down :type: float :value: 0 Timestamp of the most recent message received. .. py:method:: add_sent_stat(timestamp: float, num_bytes: int) -> None Callback for when a message of a given number of bytes is sent at a given timestamp. .. py:method:: add_received_stat(timestamp: float, num_bytes: int) -> None Callback for when a message of a given number of bytes is received at a given timestamp. .. py:method:: to_dict() -> dict[str, int | float] Convert this statistic to a plain dictionary. .. py:method:: __str__() -> str Create a short string representation of this statistic for debugging.