Instrumentation · class

FpsMeter

Explained in In-game tools.

class FpsMeter
import { FpsMeter } from '@driftengine/core';

Constructor

new

constructor(options?: FpsMeterOptions)
ParameterTypeDescription
options?FpsMeterOptions

Accessors

NameTypeDescription
fpsgetnumberThe rate this meter last computed, for a caller that wants the number as well as the panel.
More

Reported from outside, by a consumer that had to keep its own average beside this one to say "the preview is below rate, the export is unaffected". A class that owns an element and refuses to say what it wrote in it makes every caller measure the same thing twice.

These are what was last displayed, so they move at updateIntervalMs rather than per frame, which is the point: a figure that changes sixty times a second is not one a person reads, and a caller comparing against a budget wants the same smoothed number the panel shows.

Zero until the first update, which is a real state and not a rate.

meanMsgetnumberMean frame time in milliseconds over the window, as last displayed. See fps.
worstMsgetnumberThe slowest frame in the window in milliseconds, as last displayed. See fps.

Methods

sample

sample(frameDt: number, nowMs: number): void

Call once per rendered frame with duration in seconds.

ParameterTypeDescription
frameDtnumber
nowMsnumber

dispose

dispose(): void