pub struct RapierDiagnosticsPlugin {
pub max_history_length: usize,
pub per_context: bool,
/* private fields */
}Expand description
Plugin registering Bevy Diagnostics measuring the simulation of every Rapier context.
The measurements are taken after each physics update that executed at least one simulation
step, from RapierContextSimulation::step_stats (which relies on Rapier’s counters) and
from the current state of the contexts. They can be displayed, for example, with Bevy’s
LogDiagnosticsPlugin.
The diagnostics at the paths of the associated constants (e.g. Self::STEP_TIME) are sums
over all the contexts (counts and timings alike), so they measure the whole physics workload
of the app. Enable Self::per_context to also measure each context separately at the paths
returned by Self::context_path, registered when a context is first measured.
Only Self::STEP_TIME and the counts are measured by default: the other timings rely on
Rapier’s internal profiler and are only registered if the profiler feature is enabled. This
plugin enables the PhysicsPipeline::counters
of every context.
Fields§
§max_history_length: usizeThe maximum number of measurements kept in the history of each diagnostic.
per_context: boolWhether each context is also measured separately, at the paths returned by
Self::context_path (default: false).
Implementations§
Source§impl RapierDiagnosticsPlugin
impl RapierDiagnosticsPlugin
Sourcepub const STEP_TIME: DiagnosticPath
pub const STEP_TIME: DiagnosticPath
Total wall-clock time spent running the simulation steps of a physics update, in milliseconds.
Sourcepub const STEPS: DiagnosticPath
pub const STEPS: DiagnosticPath
Number of simulation steps (including substeps) executed by a physics update.
Sourcepub const COLLISION_DETECTION_TIME: DiagnosticPath
pub const COLLISION_DETECTION_TIME: DiagnosticPath
Time spent on collision detection, in milliseconds (requires the profiler feature).
Sourcepub const BROAD_PHASE_TIME: DiagnosticPath
pub const BROAD_PHASE_TIME: DiagnosticPath
Time spent in the broad-phase, in milliseconds (requires the profiler feature).
Sourcepub const NARROW_PHASE_TIME: DiagnosticPath
pub const NARROW_PHASE_TIME: DiagnosticPath
Time spent in the narrow-phase, in milliseconds (requires the profiler feature).
Sourcepub const ISLAND_CONSTRUCTION_TIME: DiagnosticPath
pub const ISLAND_CONSTRUCTION_TIME: DiagnosticPath
Time spent building the simulation islands, in milliseconds (requires the profiler
feature).
Sourcepub const SOLVER_TIME: DiagnosticPath
pub const SOLVER_TIME: DiagnosticPath
Time spent in the constraints solver, in milliseconds (requires the profiler feature).
Sourcepub const CCD_TIME: DiagnosticPath
pub const CCD_TIME: DiagnosticPath
Time spent on Continuous Collision Detection, in milliseconds (requires the profiler
feature).
Sourcepub const UPDATE_TIME: DiagnosticPath
pub const UPDATE_TIME: DiagnosticPath
Time spent updating the rigid-bodies’ positions and velocities, in milliseconds (requires
the profiler feature).
Sourcepub const CCD_SUBSTEPS: DiagnosticPath
pub const CCD_SUBSTEPS: DiagnosticPath
Number of CCD substeps executed by a physics update (zero when the CCD didn’t need to act).
Sourcepub const RIGID_BODIES: DiagnosticPath
pub const RIGID_BODIES: DiagnosticPath
Number of rigid-bodies.
Sourcepub const ACTIVE_BODIES: DiagnosticPath
pub const ACTIVE_BODIES: DiagnosticPath
Number of awake (active) dynamic and kinematic rigid-bodies.
Sourcepub const COLLIDERS: DiagnosticPath
pub const COLLIDERS: DiagnosticPath
Number of colliders.
Sourcepub const IMPULSE_JOINTS: DiagnosticPath
pub const IMPULSE_JOINTS: DiagnosticPath
Number of impulse joints.
Sourcepub const MULTIBODY_JOINTS: DiagnosticPath
pub const MULTIBODY_JOINTS: DiagnosticPath
Number of multibody joints.
Sourcepub const CONTACT_PAIRS: DiagnosticPath
pub const CONTACT_PAIRS: DiagnosticPath
Number of contact pairs tracked by the narrow-phase (touching or not) after the last step.
Sourcepub const ACTIVE_CONTACT_PAIRS: DiagnosticPath
pub const ACTIVE_CONTACT_PAIRS: DiagnosticPath
Number of contact pairs with at least one active contact.
Sourcepub const CONTACT_CONSTRAINTS: DiagnosticPath
pub const CONTACT_CONSTRAINTS: DiagnosticPath
Number of contact points (soft-body contacts included) handed to the constraints solver by a physics update.
Sourcepub const SOLVER_CONSTRAINTS: DiagnosticPath
pub const SOLVER_CONSTRAINTS: DiagnosticPath
Number of contact manifolds and impulse joints handed to the constraints solver by a physics update. The contacts and joints of sleeping bodies aren’t counted.
Sourcepub const INTERSECTIONS: DiagnosticPath
pub const INTERSECTIONS: DiagnosticPath
Number of intersecting sensor pairs.
Sourcepub fn in_schedule(self, schedule: impl ScheduleLabel) -> Self
pub fn in_schedule(self, schedule: impl ScheduleLabel) -> Self
Measures the diagnostics in the given schedule (default: PostUpdate).
This should be the schedule the physics runs in (see
RapierPhysicsPlugin::in_schedule).
Sourcepub fn with_per_context_diagnostics(self, per_context: bool) -> Self
pub fn with_per_context_diagnostics(self, per_context: bool) -> Self
Also measures each context separately (see Self::per_context).
Sourcepub fn context_path(path: &DiagnosticPath, context: Entity) -> DiagnosticPath
pub fn context_path(path: &DiagnosticPath, context: Entity) -> DiagnosticPath
The path of the diagnostic measuring path (one of the associated constants, e.g.
Self::STEP_TIME) for the context context only, e.g. rapier/12v0/step_time.
These diagnostics are only measured if Self::per_context is enabled.
Trait Implementations§
Source§impl Default for RapierDiagnosticsPlugin
impl Default for RapierDiagnosticsPlugin
Source§impl Plugin for RapierDiagnosticsPlugin
impl Plugin for RapierDiagnosticsPlugin
Source§fn ready(&self, _app: &App) -> bool
fn ready(&self, _app: &App) -> bool
finish should be called.Source§fn finish(&self, _app: &mut App)
fn finish(&self, _app: &mut App)
App, once all plugins registered are ready. This can
be useful for plugins that depends on another plugin asynchronous setup, like the renderer.Source§fn cleanup(&self, _app: &mut App)
fn cleanup(&self, _app: &mut App)
Auto Trait Implementations§
impl !RefUnwindSafe for RapierDiagnosticsPlugin
impl !UnwindSafe for RapierDiagnosticsPlugin
impl Freeze for RapierDiagnosticsPlugin
impl Send for RapierDiagnosticsPlugin
impl Sync for RapierDiagnosticsPlugin
impl Unpin for RapierDiagnosticsPlugin
impl UnsafeUnpin for RapierDiagnosticsPlugin
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
impl<T> MaybeSync for T
impl<Marker, T> Plugins<Marker> for Twhere
T: Plugins<Marker>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Settings for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.