diff options
| author | Thierry Berger <contact@thierryberger.com> | 2024-11-19 16:33:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-19 16:33:26 +0100 |
| commit | 510237cc29ebc667a8c158ef0340b7d1aa669a72 (patch) | |
| tree | 772daf3fac2e463eba254900001fce5a659f2f92 /src/dynamics/joint | |
| parent | ff79f4c67478f8c8045464cac22f9e57388cd4a0 (diff) | |
| download | rapier-510237cc29ebc667a8c158ef0340b7d1aa669a72.tar.gz rapier-510237cc29ebc667a8c158ef0340b7d1aa669a72.tar.bz2 rapier-510237cc29ebc667a8c158ef0340b7d1aa669a72.zip | |
Profiling support (#743)
Diffstat (limited to 'src/dynamics/joint')
5 files changed, 14 insertions, 0 deletions
diff --git a/src/dynamics/joint/impulse_joint/impulse_joint_set.rs b/src/dynamics/joint/impulse_joint/impulse_joint_set.rs index 8f47e0e..093a372 100644 --- a/src/dynamics/joint/impulse_joint/impulse_joint_set.rs +++ b/src/dynamics/joint/impulse_joint/impulse_joint_set.rs @@ -244,6 +244,7 @@ impl ImpulseJointSet { /// /// If `wake_up` is set to `true`, then the bodies attached to this joint will be /// automatically woken up during the next timestep. + #[profiling::function] pub fn insert( &mut self, body1: RigidBodyHandle, @@ -329,6 +330,7 @@ impl ImpulseJointSet { /// /// If `wake_up` is set to `true`, then the bodies attached to this joint will be /// automatically woken up. + #[profiling::function] pub fn remove(&mut self, handle: ImpulseJointHandle, wake_up: bool) -> Option<ImpulseJoint> { let id = self.joint_ids.remove(handle.0)?; let endpoints = self.joint_graph.graph.edge_endpoints(id)?; @@ -356,6 +358,7 @@ impl ImpulseJointSet { /// The provided rigid-body handle is not required to identify a rigid-body that /// is still contained by the `bodies` component set. /// Returns the (now invalid) handles of the removed impulse_joints. + #[profiling::function] pub fn remove_joints_attached_to_rigid_body( &mut self, handle: RigidBodyHandle, diff --git a/src/dynamics/joint/multibody_joint/multibody.rs b/src/dynamics/joint/multibody_joint/multibody.rs index f05ce75..cb25624 100644 --- a/src/dynamics/joint/multibody_joint/multibody.rs +++ b/src/dynamics/joint/multibody_joint/multibody.rs @@ -489,6 +489,7 @@ impl Multibody { } /// Computes the constant terms of the dynamics. + #[profiling::function] pub(crate) fn update_dynamics(&mut self, dt: Real, bodies: &mut RigidBodySet) { /* * Compute velocities. @@ -1094,6 +1095,7 @@ impl Multibody { /// is the sum of the current position of `self` and this `displacement`. // TODO: this shares a lot of code with `forward_kinematics` and `update_body_jacobians`, except // that we are only traversing a single kinematic chain. Could this be refactored? + #[profiling::function] pub fn forward_kinematics_single_branch( &self, bodies: &RigidBodySet, diff --git a/src/dynamics/joint/multibody_joint/multibody_ik.rs b/src/dynamics/joint/multibody_joint/multibody_ik.rs index b5e0de6..6923eec 100644 --- a/src/dynamics/joint/multibody_joint/multibody_ik.rs +++ b/src/dynamics/joint/multibody_joint/multibody_ik.rs @@ -64,6 +64,7 @@ impl Multibody { /// desired transform. /// /// The displacement calculated by this function is added to the `displacement` vector. + #[profiling::function] pub fn inverse_kinematics_delta_with_jacobian( jacobian: &Jacobian<Real>, desired_movement: &SpacialVector<Real>, @@ -88,6 +89,7 @@ impl Multibody { /// can be moved through the inverse-kinematics process. Any joint for which `joint_can_move` /// returns `false` will have its corresponding displacement constrained to 0. /// Set the closure to `|_| true` if all the joints are free to move. + #[profiling::function] pub fn inverse_kinematics( &self, bodies: &RigidBodySet, diff --git a/src/dynamics/joint/multibody_joint/multibody_joint.rs b/src/dynamics/joint/multibody_joint/multibody_joint.rs index 179b061..4785c38 100644 --- a/src/dynamics/joint/multibody_joint/multibody_joint.rs +++ b/src/dynamics/joint/multibody_joint/multibody_joint.rs @@ -86,6 +86,7 @@ impl MultibodyJoint { } /// Integrate the position of this multibody_joint. + #[profiling::function] pub fn integrate(&mut self, dt: Real, vels: &[Real]) { let locked_bits = self.data.locked_axes.bits(); let mut curr_free_dof = 0; diff --git a/src/dynamics/joint/multibody_joint/multibody_joint_set.rs b/src/dynamics/joint/multibody_joint/multibody_joint_set.rs index de1748c..d315729 100644 --- a/src/dynamics/joint/multibody_joint/multibody_joint_set.rs +++ b/src/dynamics/joint/multibody_joint/multibody_joint_set.rs @@ -153,6 +153,7 @@ impl MultibodyJointSet { } /// Inserts a new multibody_joint into this set. + #[profiling::function] fn do_insert( &mut self, body1: RigidBodyHandle, @@ -213,6 +214,7 @@ impl MultibodyJointSet { } /// Removes a multibody_joint from this set. + #[profiling::function] pub fn remove(&mut self, handle: MultibodyJointHandle, wake_up: bool) { if let Some(removed) = self.rb2mb.get(handle.0).copied() { let multibody = self.multibodies.remove(removed.multibody.0).unwrap(); @@ -259,6 +261,7 @@ impl MultibodyJointSet { } /// Removes all the multibody_joints from the multibody the given rigid-body is part of. + #[profiling::function] pub fn remove_multibody_articulations(&mut self, handle: RigidBodyHandle, wake_up: bool) { if let Some(removed) = self.rb2mb.get(handle.0).copied() { // Remove the multibody. @@ -281,6 +284,7 @@ impl MultibodyJointSet { } /// Removes all the multibody joints attached to a rigid-body. + #[profiling::function] pub fn remove_joints_attached_to_rigid_body(&mut self, rb_to_remove: RigidBodyHandle) { // TODO: optimize this. if let Some(link_to_remove) = self.rb2mb.get(rb_to_remove.0).copied() { @@ -412,6 +416,7 @@ impl MultibodyJointSet { } /// Iterates through all the joints attached to the given rigid-body. + #[profiling::function] pub fn attached_joints( &self, rb: RigidBodyHandle, @@ -441,6 +446,7 @@ impl MultibodyJointSet { /// Iterate through the handles of all the rigid-bodies attached to this rigid-body /// by an enabled multibody_joint. + #[profiling::function] pub fn bodies_attached_with_enabled_joint( &self, body: RigidBodyHandle, |
