Skip to content

WasmGPU.performanceStats

Summary

WasmGPU.performanceStats returns the currently attached performance panel. The value is null until WasmGPU.createPerformanceStats is called (or after it is destroyed). Use this accessor when you need direct access to the panel instance.

Syntax

WasmGPU.performanceStats: PerformanceStats | null
const stats = wgpu.performanceStats;

Parameters

This API does not take parameters.

Returns

PerformanceStats | null - Current stats panel instance, or null when no panel is active.

Example

const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
wgpu.createPerformanceStats({ label: "Runtime", showGpuTime: true, graph: true });
const stats = wgpu.performanceStats;
console.log(stats ? stats.element : null);

See Also