/bevy-skills:bevy-diagnostics-profilingfrom bevy-skills
Profiles Bevy 0.20 apps using DiagnosticPath, DiagnosticsStore, info_span!, RenderDiagnosticsPlugin, and RenderDebugOverlay. Tracks custom metrics, CPU/GPU pass timings, queue/task/upload telemetry, and budgets for native, Steam Deck, or WebGPU targets.
Ships in bevy-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Diagnostics answer “what is happening over time?” Tracing answers “where did this execution spend time?” Render diagnostics expose pass-level renderer measurements. Use all three, but do not treat any one of them as proof of a bottleneck.
use bevy::{
diagnostic::{
Diagnostic, DiagnosticPath, Diagnostics, RegisterDiagnostic,
},
prelude::*,
};
const REMESH_QUEUE_DEPTH: DiagnosticPath =
DiagnosticPath::const_new("voxel/remesh_queue_depth");
#[derive(Resource, Default)]
struct RemeshQueue {
valid_jobs: usize,
}
struct VoxelDiagnosticsPlugin;
impl Plugin for VoxelDiagnosticsPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<RemeshQueue>()
.register_diagnostic(
Diagnostic::new(REMESH_QUEUE_DEPTH).with_suffix(" sections"),
)
.add_systems(Update, record_voxel_diagnostics);
}
}
fn record_voxel_diagnostics(
queue: Res<RemeshQueue>,
mut diagnostics: Diagnostics,
) {
diagnostics.add_measurement(&REMESH_QUEUE_DEPTH, || queue.valid_jobs as f64);
}
Paths are an API: use namespaced, stable names with explicit units in suffixes or
documentation. Register before recording. DiagnosticsStore provides latest and
historical/smoothed values for displays and exporters. Measurements are deferred
telemetry, not a same-system synchronisation mechanism.
FrameTimeDiagnosticsPlugin: FPS, frame time, and frame count.EntityCountDiagnosticsPlugin: live entity count.SystemInformationDiagnosticsPlugin: process/system CPU and memory on supported
native targets. It is unavailable/no-op for WASM, iOS, and dynamic-link builds.LogDiagnosticsPlugin: development output; filter paths and cadence to avoid noise.RenderDiagnosticsPlugin: CPU/GPU time per recorded render span and pipeline
statistics where the backend supports them.RenderDebugOverlayPlugin (0.20): on-screen render debug overlay, in
DefaultPlugins under the dev feature (bevy_dev_tools + render_dev_tools).
Off until RenderDebugOverlayKeybindings { enable_keybindings: true, .. }
is inserted; F1 cycles mode, F2 cycles opacity.Add RenderDiagnosticsPlugin from bevy::render::diagnostic. It creates dynamic
paths shaped like render/<span>/elapsed_cpu and, when supported,
render/<span>/elapsed_gpu plus invocation/primitive statistics.
Enable a backend in an optimised build:
cargo run --release --features bevy/trace_tracy
cargo run --release --features bevy/trace_chrome
trace_tracy_memory adds allocation tracking with extra overhead. Add coarse spans
around work whose cause matters:
use bevy::prelude::*;
fn rebuild_visible_sections() {
let _span = info_span!("rebuild_visible_sections").entered();
// measured work
}
Avoid high-cardinality span names and per-element spans. Record section/entity IDs as fields only during targeted captures. Keep a low-overhead diagnostic gauge/counter for continuous observability and switch on detailed traces for investigation.
Render, RenderGraph, and Core3d sets order with chain_weak.
A diagnostic-recording render system that relied on an earlier set finishing via
a channel or atomic needs an explicit .after(system).tracing is not a direct dependency: write bevy::log::tracing::field::Empty.RenderDebugOverlayPlugin without the dev feature; the
bevy::dev_tools module does not exist without bevy_dev_tools.Bevy 0.20 render timestamp queries and pipeline statistics are supported on Vulkan
and DX12. Metal, WebGPU, and WebGL2 expose CPU render timings only through
RenderDiagnosticsPlugin. Missing elapsed_gpu is an unsupported measurement, not
zero GPU cost. Use vendor/platform GPU profilers where available; RenderDoc is a
graphics debugger, not a performance profiler.
Profile the shipping renderer, resolution, power mode, content, and build profile. Desktop results do not establish Steam Deck or browser budgets.
| Problem | Read |
|---|---|
| Metric types, stable paths, diagnostics store, tracing spans | Diagnostics and tracing |
| Render diagnostics, backend limitations, CPU/GPU tool choice | Render and platform profiling |
| Acceptance thresholds, replay design, queue/task/upload telemetry | Budgets and telemetry |
bevy-voxel-runtime — concrete queue, stale-result, and upload metrics.bevy-rendering — renderer architecture and custom render systems.bevy-testing — deterministic benchmark replays and visual captures.bevy-migration-0-19-to-0-20 — weak ordering and render-world renames.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
32 skills in this plugin
/bevyUse when starting any Bevy task, choosing between Update and FixedUpdate, picking Cargo feature flags, or recalling which sibling skill covers ECS, assets, rendering, UI, or migration. Routes to the right Bevy 0.20 skill and pins the engine version for downstream snippets./bevy-a11yUse when designing or auditing high-standard video-game accessibility in Bevy 0.20, integrating screen readers and focus navigation, supporting adaptive controllers and complete remapping, implementing captions or audio description, checking contrast and motion safety, or building disabled-player test evidence./bevy-animationUse when wiring `AnimationPlayer` + `AnimationGraphHandle`, building an `AnimationGraph` from glTF clips, blending state-driven animations with `AnimationTransitions::play`, isolating body parts with `AnimationMask`, firing gameplay sync via `#[derive(AnimationEvent)]` + `On<E>` observers, tweening with `AnimatableCurve` / `EaseFunction` / `CubicSegment::new_bezier_easing` from `bevy::curve`, or applying the 12 Basic Principles of Animation to 3D characters in Bevy 0.20.npx claudepluginhub chrisgliddon/bevy-skills --plugin bevy-skillsOther plugins' skills for the same job