From 510237cc29ebc667a8c158ef0340b7d1aa669a72 Mon Sep 17 00:00:00 2001 From: Thierry Berger Date: Tue, 19 Nov 2024 16:33:26 +0100 Subject: Profiling support (#743) --- src/control/character_controller.rs | 5 +++++ src/control/ray_cast_vehicle_controller.rs | 3 +++ 2 files changed, 8 insertions(+) (limited to 'src/control') diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs index 0b086fb..ba0baeb 100644 --- a/src/control/character_controller.rs +++ b/src/control/character_controller.rs @@ -211,6 +211,7 @@ impl KinematicCharacterController { } /// Computes the possible movement for a shape. + #[profiling::function] pub fn move_shape( &self, dt: Real, @@ -430,6 +431,7 @@ impl KinematicCharacterController { self.offset.eval(up_extends) + 0.05 } + #[profiling::function] fn detect_grounded_status_and_apply_friction( &self, dt: Real, @@ -657,6 +659,7 @@ impl KinematicCharacterController { Vector2::new(side_extent, up_extent) } + #[profiling::function] fn handle_stairs( &self, bodies: &RigidBodySet, @@ -817,6 +820,7 @@ impl KinematicCharacterController { /// impulses to the rigid-bodies surrounding the character shape at the time of the collisions. /// Note that the impulse calculation is only approximate as it is not based on a global /// constraints resolution scheme. + #[profiling::function] pub fn solve_character_collision_impulses<'a>( &self, dt: Real, @@ -846,6 +850,7 @@ impl KinematicCharacterController { /// impulses to the rigid-bodies surrounding the character shape at the time of the collision. /// Note that the impulse calculation is only approximate as it is not based on a global /// constraints resolution scheme. + #[profiling::function] fn solve_single_character_collision_impulse( &self, dt: Real, diff --git a/src/control/ray_cast_vehicle_controller.rs b/src/control/ray_cast_vehicle_controller.rs index 98b6339..eaa506b 100644 --- a/src/control/ray_cast_vehicle_controller.rs +++ b/src/control/ray_cast_vehicle_controller.rs @@ -321,6 +321,7 @@ impl DynamicRayCastVehicleController { wheel.wheel_axle_ws = chassis_transform * wheel.axle_cs; } + #[profiling::function] fn ray_cast( &mut self, bodies: &RigidBodySet, @@ -403,6 +404,7 @@ impl DynamicRayCastVehicleController { } /// Updates the vehicle’s velocity based on its suspension, engine force, and brake. + #[profiling::function] pub fn update_vehicle( &mut self, dt: Real, @@ -531,6 +533,7 @@ impl DynamicRayCastVehicleController { } } + #[profiling::function] fn update_friction(&mut self, bodies: &mut RigidBodySet, colliders: &ColliderSet, dt: Real) { let num_wheels = self.wheels.len(); -- cgit