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/geometry | |
| parent | ff79f4c67478f8c8045464cac22f9e57388cd4a0 (diff) | |
| download | rapier-510237cc29ebc667a8c158ef0340b7d1aa669a72.tar.gz rapier-510237cc29ebc667a8c158ef0340b7d1aa669a72.tar.bz2 rapier-510237cc29ebc667a8c158ef0340b7d1aa669a72.zip | |
Profiling support (#743)
Diffstat (limited to 'src/geometry')
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs | 5 | ||||
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/sap_axis.rs | 1 | ||||
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/sap_layer.rs | 4 | ||||
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/sap_region.rs | 1 | ||||
| -rw-r--r-- | src/geometry/contact_pair.rs | 1 | ||||
| -rw-r--r-- | src/geometry/interaction_graph.rs | 2 | ||||
| -rw-r--r-- | src/geometry/mesh_converter.rs | 1 | ||||
| -rw-r--r-- | src/geometry/narrow_phase.rs | 7 |
8 files changed, 22 insertions, 0 deletions
diff --git a/src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs b/src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs index cd5ac28..197ebaf 100644 --- a/src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs +++ b/src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs @@ -254,6 +254,7 @@ impl BroadPhaseMultiSap { /// This will: /// - Remove all the subregion proxies from the larger layer. /// - Pre-insert all the smaller layer's region proxies into this layer. + #[profiling::function] fn finalize_layer_insertion(&mut self, layer_id: u8) { // Remove all the region endpoints from the larger layer. // They will be automatically replaced by the new layer's regions. @@ -289,6 +290,7 @@ impl BroadPhaseMultiSap { /// the `update` function. /// 4. All the regions from the smaller layer are added to that new /// layer. + #[profiling::function] fn ensure_layer_exists(&mut self, new_depth: i8) -> u8 { // Special case: we don't have any layers yet. if self.layers.is_empty() { @@ -473,6 +475,7 @@ impl BroadPhaseMultiSap { /// added to its larger layer so we can detect when an object /// in a larger layer may start interacting with objects in a smaller /// layer. + #[profiling::function] fn propagate_created_regions(&mut self) { let mut curr_layer = Some(self.smallest_layer); @@ -502,6 +505,7 @@ impl BroadPhaseMultiSap { } } + #[profiling::function] fn update_layers_and_find_pairs(&mut self, out_events: &mut Vec<BroadPhasePairEvent>) { if self.layers.is_empty() { return; @@ -579,6 +583,7 @@ impl BroadPhaseMultiSap { impl BroadPhase for BroadPhaseMultiSap { /// Updates the broad-phase, taking into account the new collider positions. + #[profiling::function] fn update( &mut self, dt: Real, diff --git a/src/geometry/broad_phase_multi_sap/sap_axis.rs b/src/geometry/broad_phase_multi_sap/sap_axis.rs index f1afdee..60dddd6 100644 --- a/src/geometry/broad_phase_multi_sap/sap_axis.rs +++ b/src/geometry/broad_phase_multi_sap/sap_axis.rs @@ -36,6 +36,7 @@ impl SAPAxis { self.endpoints.push(SAPEndpoint::end_sentinel()); } + #[profiling::function] pub fn batch_insert( &mut self, dim: usize, diff --git a/src/geometry/broad_phase_multi_sap/sap_layer.rs b/src/geometry/broad_phase_multi_sap/sap_layer.rs index 2620798..cadb5f1 100644 --- a/src/geometry/broad_phase_multi_sap/sap_layer.rs +++ b/src/geometry/broad_phase_multi_sap/sap_layer.rs @@ -49,6 +49,7 @@ impl SAPLayer { /// Deletes from all the regions of this layer, all the endpoints corresponding /// to subregions. Clears the arrays of subregions indices from all the regions of /// this layer. + #[profiling::function] pub fn unregister_all_subregions(&mut self, proxies: &mut SAPProxies) { for region_id in self.regions.values() { // Extract the region to make the borrow-checker happy. @@ -108,6 +109,7 @@ impl SAPLayer { /// that subregion center. Because the hierarchical grid cells have aligned boundaries /// at each depth, we have the guarantee that a given subregion will only be part of /// one region on its parent "larger" layer. + #[profiling::function] fn register_subregion( &mut self, proxy_id: BroadPhaseProxyIndex, @@ -145,6 +147,7 @@ impl SAPLayer { } } + #[profiling::function] fn unregister_subregion( &mut self, proxy_id: BroadPhaseProxyIndex, @@ -273,6 +276,7 @@ impl SAPLayer { } } + #[profiling::function] pub fn predelete_proxy(&mut self, proxies: &mut SAPProxies, proxy_index: BroadPhaseProxyIndex) { // Discretize the Aabb to find the regions that need to be invalidated. let proxy_aabb = &mut proxies[proxy_index].aabb; diff --git a/src/geometry/broad_phase_multi_sap/sap_region.rs b/src/geometry/broad_phase_multi_sap/sap_region.rs index f54b4ae..7c876c5 100644 --- a/src/geometry/broad_phase_multi_sap/sap_region.rs +++ b/src/geometry/broad_phase_multi_sap/sap_region.rs @@ -214,6 +214,7 @@ impl SAPRegion { } } + #[profiling::function] pub fn update( &mut self, proxies: &SAPProxies, diff --git a/src/geometry/contact_pair.rs b/src/geometry/contact_pair.rs index 3d4e955..3f569b2 100644 --- a/src/geometry/contact_pair.rs +++ b/src/geometry/contact_pair.rs @@ -186,6 +186,7 @@ impl ContactPair { /// /// Returns a reference to the contact, as well as the contact manifold /// it is part of. + #[profiling::function] pub fn find_deepest_contact(&self) -> Option<(&ContactManifold, &Contact)> { let mut deepest = None; diff --git a/src/geometry/interaction_graph.rs b/src/geometry/interaction_graph.rs index de2948b..4fb5054 100644 --- a/src/geometry/interaction_graph.rs +++ b/src/geometry/interaction_graph.rs @@ -96,6 +96,7 @@ impl<N: Copy, E> InteractionGraph<N, E> { } /// The interaction between the two collision objects identified by their graph index. + #[profiling::function] pub fn interaction_pair( &self, id1: ColliderGraphIndex, @@ -111,6 +112,7 @@ impl<N: Copy, E> InteractionGraph<N, E> { } /// The interaction between the two collision objects identified by their graph index. + #[profiling::function] pub fn interaction_pair_mut( &mut self, id1: ColliderGraphIndex, diff --git a/src/geometry/mesh_converter.rs b/src/geometry/mesh_converter.rs index a4c8861..cfa1391 100644 --- a/src/geometry/mesh_converter.rs +++ b/src/geometry/mesh_converter.rs @@ -53,6 +53,7 @@ pub enum MeshConverter { impl MeshConverter { /// Applies the conversion rule described by this [`MeshConverter`] to build a shape from /// the given vertex and index buffers. + #[profiling::function] pub fn convert( &self, vertices: Vec<Point<Real>>, diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index e979a2f..908f83e 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -268,6 +268,7 @@ impl NarrowPhase { // } /// Maintain the narrow-phase internal state by taking collider removal into account. + #[profiling::function] pub fn handle_user_changes( &mut self, mut islands: Option<&mut IslandManager>, @@ -321,6 +322,7 @@ impl NarrowPhase { ); } + #[profiling::function] pub(crate) fn remove_collider( &mut self, intersection_graph_id: ColliderGraphIndex, @@ -412,6 +414,7 @@ impl NarrowPhase { } } + #[profiling::function] pub(crate) fn handle_user_changes_on_colliders( &mut self, mut islands: Option<&mut IslandManager>, @@ -513,6 +516,7 @@ impl NarrowPhase { } } + #[profiling::function] fn remove_pair( &mut self, islands: Option<&mut IslandManager>, @@ -584,6 +588,7 @@ impl NarrowPhase { } } + #[profiling::function] fn add_pair(&mut self, colliders: &ColliderSet, pair: &ColliderPair) { if let (Some(co1), Some(co2)) = (colliders.get(pair.collider1), colliders.get(pair.collider2)) @@ -687,6 +692,7 @@ impl NarrowPhase { } } + #[profiling::function] pub(crate) fn compute_intersections( &mut self, bodies: &RigidBodySet, @@ -785,6 +791,7 @@ impl NarrowPhase { }); } + #[profiling::function] pub(crate) fn compute_contacts( &mut self, prediction_distance: Real, |
