1681-engine / index / FrameSampler
Class: FrameSampler ​
Defined in: src/diagnostics/FrameSampler.ts:24
Measures how a game really runs on a player's device: each frame costs one number pushed on an array, and every windowMs the window is summed into a FrameSummary handed to onSample — FPS, the 1% low, the 95th-percentile frame, hitches. The engine sends nothing anywhere: what the game does with a sample (a readout, a report to its server) is the callback's.
Constructors ​
Constructor ​
new FrameSampler(onSample, options?): FrameSampler;Defined in: src/diagnostics/FrameSampler.ts:31
Parameters ​
| Parameter | Type |
|---|---|
onSample | (summary) => void |
options | FrameSamplerOptions |
Returns ​
FrameSampler
Methods ​
attach() ​
attach(ticker): () => void;Defined in: src/diagnostics/FrameSampler.ts:66
Feeds the sampler from a Pixi ticker, after the render; returns the detach.
Parameters ​
| Parameter | Type |
|---|---|
ticker | Ticker |
Returns ​
() => void
push() ​
push(deltaMs): void;Defined in: src/diagnostics/FrameSampler.ts:44
One frame of deltaMs; sums the window once it is full.
Parameters ​
| Parameter | Type |
|---|---|
deltaMs | number |
Returns ​
void
reset() ​
reset(): void;Defined in: src/diagnostics/FrameSampler.ts:60
Starts a fresh window, dropping what was counted (after a scene change, say).
Returns ​
void