Function telemetry_snapshot

Source
pub fn telemetry_snapshot() -> RetainedTelemetry
Expand description

Snapshot retained usage, limits, buffer capacities and rejection counters.

Does not clear counters, prune the registry, finalize draws, or change mesh lifetimes. After thread/renderer initialization this allocates nothing: it scans at most the mesh limit of registry entries and copies frame counters.

use ferravex_render::{mesh::Mesh3d, Mat4, Vec3, WHITE,
    retained::{ResidentMesh, draw_resident_checked, reset_telemetry,
               telemetry_snapshot}};
reset_telemetry();
let mesh = ResidentMesh::try_new(&Mesh3d::cuboid(Vec3::ONE, WHITE).mesh)?;
draw_resident_checked(&mesh, Mat4::IDENTITY)?;
assert!(draw_resident_checked(&mesh, Mat4::ZERO).is_err());
let sample = telemetry_snapshot();
assert_eq!(sample.instances, 1);
assert_eq!(sample.draws, 1);
assert!(sample.buffers.instances >= sample.instances);
assert!(sample.mesh_bytes <= sample.mesh_byte_limit);
assert_eq!(sample.rejections.draw_validation, 1);