Skip to main content

RapierDiagnosticsPlugin

Struct RapierDiagnosticsPlugin 

Source
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: usize

The maximum number of measurements kept in the history of each diagnostic.

§per_context: bool

Whether each context is also measured separately, at the paths returned by Self::context_path (default: false).

Implementations§

Source§

impl RapierDiagnosticsPlugin

Source

pub const STEP_TIME: DiagnosticPath

Total wall-clock time spent running the simulation steps of a physics update, in milliseconds.

Source

pub const STEPS: DiagnosticPath

Number of simulation steps (including substeps) executed by a physics update.

Source

pub const COLLISION_DETECTION_TIME: DiagnosticPath

Time spent on collision detection, in milliseconds (requires the profiler feature).

Source

pub const BROAD_PHASE_TIME: DiagnosticPath

Time spent in the broad-phase, in milliseconds (requires the profiler feature).

Source

pub const NARROW_PHASE_TIME: DiagnosticPath

Time spent in the narrow-phase, in milliseconds (requires the profiler feature).

Source

pub const ISLAND_CONSTRUCTION_TIME: DiagnosticPath

Time spent building the simulation islands, in milliseconds (requires the profiler feature).

Source

pub const SOLVER_TIME: DiagnosticPath

Time spent in the constraints solver, in milliseconds (requires the profiler feature).

Source

pub const CCD_TIME: DiagnosticPath

Time spent on Continuous Collision Detection, in milliseconds (requires the profiler feature).

Source

pub const UPDATE_TIME: DiagnosticPath

Time spent updating the rigid-bodies’ positions and velocities, in milliseconds (requires the profiler feature).

Source

pub const CCD_SUBSTEPS: DiagnosticPath

Number of CCD substeps executed by a physics update (zero when the CCD didn’t need to act).

Source

pub const RIGID_BODIES: DiagnosticPath

Number of rigid-bodies.

Source

pub const ACTIVE_BODIES: DiagnosticPath

Number of awake (active) dynamic and kinematic rigid-bodies.

Source

pub const COLLIDERS: DiagnosticPath

Number of colliders.

Source

pub const IMPULSE_JOINTS: DiagnosticPath

Number of impulse joints.

Source

pub const MULTIBODY_JOINTS: DiagnosticPath

Number of multibody joints.

Source

pub const CONTACT_PAIRS: DiagnosticPath

Number of contact pairs tracked by the narrow-phase (touching or not) after the last step.

Source

pub const ACTIVE_CONTACT_PAIRS: DiagnosticPath

Number of contact pairs with at least one active contact.

Source

pub const CONTACT_CONSTRAINTS: DiagnosticPath

Number of contact points (soft-body contacts included) handed to the constraints solver by a physics update.

Source

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.

Source

pub const INTERSECTIONS: DiagnosticPath

Number of intersecting sensor pairs.

Source

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).

Source

pub fn with_per_context_diagnostics(self, per_context: bool) -> Self

Also measures each context separately (see Self::per_context).

Source

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

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Plugin for RapierDiagnosticsPlugin

Source§

fn build(&self, app: &mut App)

Configures the App to which this plugin is added.
Source§

fn ready(&self, _app: &App) -> bool

Has the plugin finished its setup? This can be useful for plugins that need something asynchronous to happen before they can finish their setup, like the initialization of a renderer. Once the plugin is ready, finish should be called.
Source§

fn finish(&self, _app: &mut App)

Finish adding this plugin to the 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)

Runs after all plugins are built and finished, but before the app schedule is executed. This can be useful if you have some resource that other plugins need during their build step, but after build you want to remove it and send it to another thread.
Source§

fn name(&self) -> &str

Configures a name for the Plugin which is primarily used for checking plugin uniqueness and debugging.
Source§

fn is_unique(&self) -> bool

If the plugin can be meaningfully instantiated several times in an App, override this method to return false.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromWorld for T
where T: Default,

Source§

fn from_world(_world: &mut World) -> T

Creates Self using default().

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> MaybeSync for T
where T: Sync + ?Sized,

Source§

impl<Marker, T> Plugins<Marker> for T
where T: Plugins<Marker>,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Settings for T
where T: 'static + Send + Sync,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more