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).
Extends
Plugin
<any
>
Constructors
new PerfDevPlugin()
new PerfDevPlugin(
callback
):PerfDevPlugin
Constructor
Parameters
• callback
Callback method
Returns
Overrides
Properties
callback()
protected
callback: (fps
) =>void
Callback method
Parameters
• fps: number
Returns
void
fpsCount
protected
fpsCount:number
=0
Frame counter
fpsStart
protected
fpsStart:number
Start of measurement interval
loaded
loaded:
boolean
Loaded state
Inherited from
ordinal
ordinal:
number
Ordinal number
Inherited from
renderer?
protected
optional
renderer:Renderer
<any
>
Renderer loaded the plugin
Inherited from
Methods
dispose()
dispose():
void
Dispose video plugin
Returns
void
Inherited from
load()
load(
renderer
):Promise
<void
>
Initialize plugin
Resets performance counters.
Parameters
• renderer: Renderer
<any
>
Renderer this plugin is attached to
Returns
Promise
<void
>
Promise resolving when initialization is finished
Overrides
setupCamera()
setupCamera(
ratio
,angle
):void
Set camera parameters
Could be overridden to adjust plugin’s pipeline.
Parameters
• ratio: number
Aspect ration of input video
• angle: number
Vertical field of view in radians
Returns
void
Inherited from
setupVideo()
setupVideo(
size
):void
Set video size
Could be overridden to adjust plugin’s pipeline.
Parameters
• size: Size
Resolution of input video
Returns
void
Inherited from
unload()
unload():
void
Reset plugin
Releases all resources/instances created in load(). Overridden by derived classes for particular task.
Returns
void
Inherited from
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
• result: any
Results of video processing
• stream: HTMLCanvasElement
Captured video frame
Returns
Promise
<void
>
Promise resolving when update is finished