BandwidthStatsTracker
in package
Table of Contents
- $bytesSinceLastRotation : int
- $history : array<string|int, int>
- $nextHistoryIndex : int
- $totalBytes : int
- __construct() : mixed
- add() : void
- getAverageBytes() : float
- Returns the average of all the tracked history values.
- getTotalBytes() : int
- resetHistory() : void
- rotateHistory() : void
- Adds the bytes tracked since the last rotation to the history array, overwriting an old entry.
Properties
$bytesSinceLastRotation
private
int
$bytesSinceLastRotation
= 0
$history
private
array<string|int, int>
$history
$nextHistoryIndex
private
int
$nextHistoryIndex
= 0
$totalBytes
private
int
$totalBytes
= 0
Methods
__construct()
public
__construct(int $historySize) : mixed
Parameters
- $historySize : int
Tags
Return values
mixed —add()
public
add(int $bytes) : void
Parameters
- $bytes : int
Return values
void —getAverageBytes()
Returns the average of all the tracked history values.
public
getAverageBytes() : float
Return values
float —getTotalBytes()
public
getTotalBytes() : int
Return values
int —resetHistory()
public
resetHistory() : void
Return values
void —rotateHistory()
Adds the bytes tracked since the last rotation to the history array, overwriting an old entry.
public
rotateHistory() : void
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).