Constructor
new StatsComputer(updateTime)
Creates a new StatsComputer object. The generated statistics will be updated every updateTime miliseconds.
Parameters:
Name | Type | Description |
---|---|---|
updateTime |
number |
The time in miliseconds for updating the statistics. |
Members
(readonly) acksReceivedOkRate :number
The acks per second correctly received by the sender in the last interval.
(readonly) acksReceivedRate :number
The acks per second received by the sender in the last interval.
(readonly) acksSentRate :number
The acks per second sent by the receiver in the last interval.
(readonly) elapsedTime :number
The time in miliseconds since the start till the last interval. This is a multiple of the time given to the constructor.
(readonly) pktsConfirmedRate :number
The packets per second confirmed to the sender in the last interval.
(readonly) pktsReceivedOkRate :number
The packets per second correctly received by the receiver in the last interval.
(readonly) pktsReceivedRate :number
The packets per second received by the receiver in the last interval.
(readonly) pktsReSentRate :number
The packets per second re-sent by the sender in the last interval.
(readonly) pktsSentRate :number
The packets per second sent by the sender in the last interval.
(readonly) totalAcksReceived :number
The total number of acknowledgments received by the sender.
(readonly) totalAcksReceivedOk :number
The total number of acknowledgments correctly received by the sender. The definition of a correcly received packet depends on each protocol.
(readonly) totalAcksReceivedOkRate :number
The acks per second correctly received by the sender since the start.
(readonly) totalAcksReceivedRate :number
The acks per second received by the sender since the start.
(readonly) totalAcksSent :number
The total number of acknowledgments sent by the receiver.
(readonly) totalAcksSentRate :number
The acks per second sent by the receiver since the start.
(readonly) totalPktsConfirmed :number
The total number of packets confirmed to the sender.
(readonly) totalPktsConfirmedRate :number
The packets per second confirmed to the sender since the start.
(readonly) totalPktsReceived :number
The total packets received by the receiver.
(readonly) totalPktsReceivedOk :number
The total number of correct packets received by the receiver. The definition of a correcly received packet depends on each protocol.
(readonly) totalPktsReceivedOkRate :number
The packets per second correctly received by the receiver since the start.
(readonly) totalPktsReceivedRate :number
The packets per second received by the receiver since the start.
(readonly) totalPktsReSent :number
The total number of packets re-sent by the sender.
(readonly) totalPktsReSentRate :number
The packets per second re-sent by the sender since the start.
(readonly) totalPktsSent :number
The total packets sent by the sender.
(readonly) totalPktsSentRate :number
The packets per second sent by the sender since the start.
Methods
onUpdate()
A callback that is called every time an update of the statistics occurs.
pause()
Pauses the computer.
pktConfirmed()
Increases the count of confirmed packets.
pktReceived(packet, isOK)
Counts and clasifies a packet received by a sender or a receiver.
Parameters:
Name | Type | Description |
---|---|---|
packet |
Packet |
The packet to add to the statistics. |
isOK |
boolean |
true if the packet was correctly received by the node, false otherwise. |
pktSent(packet)
Counts and clasifies a packet sent by a sender or a receiver.
Parameters:
Name | Type | Description |
---|---|---|
packet |
Packet |
The packet to add to the statistics. |
resume()
Resumes the computer.
start()
Starts the computer.
stop()
Stops the computer.