StatsComputer

utils. StatsComputer

A class that helps compute statistics for the packets sent between a sender and a receiver.

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.

Source:

Members

(readonly) acksReceivedOkRate :number

The acks per second correctly received by the sender in the last interval.

Source:

(readonly) acksReceivedRate :number

The acks per second received by the sender in the last interval.

Source:

(readonly) acksSentRate :number

The acks per second sent by the receiver in the last interval.

Source:

(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.

Source:

(readonly) pktsConfirmedRate :number

The packets per second confirmed to the sender in the last interval.

Source:

(readonly) pktsReceivedOkRate :number

The packets per second correctly received by the receiver in the last interval.

Source:

(readonly) pktsReceivedRate :number

The packets per second received by the receiver in the last interval.

Source:

(readonly) pktsReSentRate :number

The packets per second re-sent by the sender in the last interval.

Source:

(readonly) pktsSentRate :number

The packets per second sent by the sender in the last interval.

Source:

(readonly) totalAcksReceived :number

The total number of acknowledgments received by the sender.

Source:

(readonly) totalAcksReceivedOk :number

The total number of acknowledgments correctly received by the sender. The definition of a correcly received packet depends on each protocol.

Source:

(readonly) totalAcksReceivedOkRate :number

The acks per second correctly received by the sender since the start.

Source:

(readonly) totalAcksReceivedRate :number

The acks per second received by the sender since the start.

Source:

(readonly) totalAcksSent :number

The total number of acknowledgments sent by the receiver.

Source:

(readonly) totalAcksSentRate :number

The acks per second sent by the receiver since the start.

Source:

(readonly) totalPktsConfirmed :number

The total number of packets confirmed to the sender.

Source:

(readonly) totalPktsConfirmedRate :number

The packets per second confirmed to the sender since the start.

Source:

(readonly) totalPktsReceived :number

The total packets received by the receiver.

Source:

(readonly) totalPktsReceivedOk :number

The total number of correct packets received by the receiver. The definition of a correcly received packet depends on each protocol.

Source:

(readonly) totalPktsReceivedOkRate :number

The packets per second correctly received by the receiver since the start.

Source:

(readonly) totalPktsReceivedRate :number

The packets per second received by the receiver since the start.

Source:

(readonly) totalPktsReSent :number

The total number of packets re-sent by the sender.

Source:

(readonly) totalPktsReSentRate :number

The packets per second re-sent by the sender since the start.

Source:

(readonly) totalPktsSent :number

The total packets sent by the sender.

Source:

(readonly) totalPktsSentRate :number

The packets per second sent by the sender since the start.

Source:

Methods

onUpdate()

A callback that is called every time an update of the statistics occurs.

Source:

pause()

Pauses the computer.

Source:

pktConfirmed()

Increases the count of confirmed packets.

Source:

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.

Source:

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.

Source:

resume()

Resumes the computer.

Source:

start()

Starts the computer.

Source:

stop()

Stops the computer.

Source: