import Stats from 'stats-gl'
const stats = new Stats({ trackGPU: true, trackCPT: true });
await stats.init(device);
document.body.appendChild(stats.dom);
function render() {
const encoder = device.createCommandEncoder();
stats.begin();
const cp = encoder.beginComputePass({
timestampWrites: stats.getTimestampWrites('compute')
});
cp.end();
const rp = encoder.beginRenderPass({
colorAttachments: [...],
timestampWrites: stats.getTimestampWrites('render')
});
rp.end();
stats.end(encoder);
device.queue.submit([encoder.finish()]);
stats.update();
requestAnimationFrame(render);
}