Skip to content

BandwidthStatsTracker ​

final class · pocketmine\network\BandwidthStatsTracker · source

Methods ​

__construct() ​

php
public function __construct(int $historySize)

add() ​

php
public function add(int $bytes) : void

getAverageBytes() ​

php
public function getAverageBytes() : float

Returns the average of all the tracked history values.

getTotalBytes() ​

php
public function getTotalBytes() : int

resetHistory() ​

php
public function resetHistory() : void

rotateHistory() ​

php
public function rotateHistory() : void

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

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.