Skip to main content

Class: PerfDevPlugin

@geenee/bodyrenderers-common.PerfDevPlugin

Performance metrics plugin

Simple plugin measuring basic performance metrics of a renderer (fps). Executes provided callback when metrics are updated (every 30 rendered frames).

Hierarchy

  • Plugin<any>

    PerfDevPlugin

Constructors

constructor

new PerfDevPlugin(callback)

Constructor

Parameters

NameTypeDescription
callback(fps: number) => voidCallback method

Overrides

Plugin.constructor

Properties

callback

Protected callback: (fps: number) => void

Type declaration

▸ (fps): void

Callback method

Parameters
NameType
fpsnumber
Returns

void


fpsCount

Protected fpsCount: number = 0

Frame counter


fpsStart

Protected fpsStart: number

Start of measurement interval


loaded

loaded: boolean

Loaded state

Inherited from

Plugin.loaded


ordinal

ordinal: number

Ordinal number

Inherited from

Plugin.ordinal


renderer

Protected Optional renderer: Renderer<any>

Renderer loaded the plugin

Inherited from

Plugin.renderer

Methods

dispose

dispose(): void

Dispose video plugin

Returns

void

Inherited from

Plugin.dispose


load

load(renderer): Promise<void>

Initialize plugin

Resets performance counters.

Parameters

NameTypeDescription
rendererRenderer<any>Renderer this plugin is attached to

Returns

Promise<void>

Promise resolving when initialization is finished

Overrides

Plugin.load


setupCamera

setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin's pipeline.

Parameters

NameTypeDescription
rationumberAspect ration of input video
anglenumberVertical field of view in radians

Returns

void

Inherited from

Plugin.setupCamera


setupVideo

setupVideo(size): void

Set video size

Could be overridden to adjust plugin's pipeline.

Parameters

NameTypeDescription
sizeSizeResolution of input video

Returns

void

Inherited from

Plugin.setupVideo


unload

unload(): void

Reset plugin

Releases all resources/instances created in load(). Overridden by derived classes for particular task.

Returns

void

Inherited from

Plugin.unload


update

update(result, stream): Promise<void>

Update

Evaluates metrics and increments counters. Every N rendered frames executes callback on current measurements of performance metrics.

Parameters

NameTypeDescription
resultanyResults of video processing
streamHTMLCanvasElementCaptured video frame

Returns

Promise<void>

Promise resolving when update is finished

Overrides

Plugin.update