From 847678ea565f4b4ab8b9af05071d29c1a170f530 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Sun, 26 Mar 2023 00:14:05 -0700 Subject: [PATCH] improve canvas3d consoleStats --- src/mol-canvas3d/canvas3d.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/mol-canvas3d/canvas3d.ts b/src/mol-canvas3d/canvas3d.ts index de4b02bca..9e38b7613 100644 --- a/src/mol-canvas3d/canvas3d.ts +++ b/src/mol-canvas3d/canvas3d.ts @@ -615,22 +615,32 @@ namespace Canvas3D { } function consoleStats() { - console.table(scene.renderables.map(r => ({ + const items = scene.renderables.map(r => ({ drawCount: r.values.drawCount.ref.value, instanceCount: r.values.instanceCount.ref.value, materialId: r.materialId, renderItemId: r.id, - }))); - console.log(webgl.stats); + })); + + console.groupCollapsed(`${items.length} RenderItems`); + + if (items.length < 50) { + console.table(items); + } else { + console.log(items); + } + console.log(JSON.stringify(webgl.stats, undefined, 4)); const { texture, attribute, elements } = webgl.resources.getByteCounts(); - console.log({ + console.log(JSON.stringify({ texture: `${(texture / 1024 / 1024).toFixed(3)} MiB`, attribute: `${(attribute / 1024 / 1024).toFixed(3)} MiB`, elements: `${(elements / 1024 / 1024).toFixed(3)} MiB`, - }); + }, undefined, 4)); + + console.log(JSON.stringify(webgl.timer.formatedStats(), undefined, 4)); - console.log(webgl.timer.formatedStats()); + console.groupEnd(); } function add(repr: Representation.Any) { -- GitLab