PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
pocketmine\network\BandwidthStatsTracker Class Reference
+ Collaboration diagram for pocketmine\network\BandwidthStatsTracker:

Public Member Functions

 __construct (int $historySize)
 
 add (int $bytes)
 
 getAverageBytes ()
 
 getTotalBytes ()
 
 resetHistory ()
 
 rotateHistory ()
 

Detailed Description

Definition at line 30 of file BandwidthStatsTracker.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\network\BandwidthStatsTracker::__construct ( int $historySize)

@phpstan-param positive-int $historySize

Definition at line 38 of file BandwidthStatsTracker.php.

Member Function Documentation

◆ add()

pocketmine\network\BandwidthStatsTracker::add ( int $bytes)

Definition at line 42 of file BandwidthStatsTracker.php.

◆ getAverageBytes()

pocketmine\network\BandwidthStatsTracker::getAverageBytes ( )

Returns the average of all the tracked history values.

Definition at line 63 of file BandwidthStatsTracker.php.

◆ getTotalBytes()

pocketmine\network\BandwidthStatsTracker::getTotalBytes ( )

Definition at line 47 of file BandwidthStatsTracker.php.

◆ resetHistory()

pocketmine\network\BandwidthStatsTracker::resetHistory ( )

Definition at line 67 of file BandwidthStatsTracker.php.

◆ rotateHistory()

pocketmine\network\BandwidthStatsTracker::rotateHistory ( )

Adds the bytes tracked since the last rotation to the history array, overwriting an old entry. This should be called on a regular interval that you want to collect average measurements over (e.g. if you want bytes per second, call this every second).

Definition at line 54 of file BandwidthStatsTracker.php.


The documentation for this class was generated from the following file: