feat: add some additional perf counters

This commit is contained in:
Sébastien Crozet
2024-04-07 22:16:58 +02:00
committed by Sébastien Crozet
parent e69e73e589
commit 9964007269
6 changed files with 57 additions and 33 deletions

View File

@@ -182,6 +182,12 @@ measure_method!(
stages.solver_time
);
measure_method!(ccd_started, ccd_completed, ccd_time, stages.ccd_time);
measure_method!(
query_pipeline_update_started,
query_pipeline_update_completed,
query_pipeline_update_time,
stages.query_pipeline_time
);
measure_method!(
assembly_started,
@@ -201,12 +207,6 @@ measure_method!(
velocity_update_time,
solver.velocity_update_time
);
measure_method!(
position_resolution_started,
position_resolution_completed,
position_resolution_time,
solver.position_resolution_time
);
measure_method!(
broad_phase_started,
broad_phase_completed,

View File

@@ -14,10 +14,8 @@ pub struct SolverCounters {
pub velocity_assembly_time: Timer,
/// Time spent for the update of the velocity of the bodies.
pub velocity_update_time: Timer,
/// Time spent for the assembly of all the position constraints.
pub position_assembly_time: Timer,
/// Time spent for the update of the position of the bodies.
pub position_resolution_time: Timer,
/// Time spent to write force back to user-accessible data.
pub velocity_writeback_time: Timer,
}
impl SolverCounters {
@@ -29,8 +27,7 @@ impl SolverCounters {
velocity_assembly_time: Timer::new(),
velocity_resolution_time: Timer::new(),
velocity_update_time: Timer::new(),
position_assembly_time: Timer::new(),
position_resolution_time: Timer::new(),
velocity_writeback_time: Timer::new(),
}
}
@@ -41,8 +38,7 @@ impl SolverCounters {
self.velocity_resolution_time.reset();
self.velocity_assembly_time.reset();
self.velocity_update_time.reset();
self.position_assembly_time.reset();
self.position_resolution_time.reset();
self.velocity_writeback_time.reset();
}
}
@@ -57,11 +53,10 @@ impl Display for SolverCounters {
self.velocity_resolution_time
)?;
writeln!(f, "Velocity update time: {}", self.velocity_update_time)?;
writeln!(f, "Position assembly time: {}", self.position_assembly_time)?;
writeln!(
f,
"Position resolution time: {}",
self.position_resolution_time
"Velocity writeback time: {}",
self.velocity_writeback_time
)
}
}

View File

@@ -14,6 +14,10 @@ pub struct StagesCounters {
pub solver_time: Timer,
/// Total time spent for CCD and CCD resolution.
pub ccd_time: Timer,
/// Total time spent updating the query pipeline (if provided to `PhysicsPipeline::step`).
pub query_pipeline_time: Timer,
/// Total time spent propagating user changes.
pub user_changes: Timer,
}
impl StagesCounters {
@@ -25,6 +29,8 @@ impl StagesCounters {
island_construction_time: Timer::new(),
solver_time: Timer::new(),
ccd_time: Timer::new(),
query_pipeline_time: Timer::new(),
user_changes: Timer::new(),
}
}
@@ -35,6 +41,8 @@ impl StagesCounters {
self.island_construction_time.reset();
self.solver_time.reset();
self.ccd_time.reset();
self.query_pipeline_time.reset();
self.user_changes.reset();
}
}
@@ -52,6 +60,8 @@ impl Display for StagesCounters {
self.island_construction_time
)?;
writeln!(f, "Solver time: {}", self.solver_time)?;
writeln!(f, "CCD time: {}", self.ccd_time)
writeln!(f, "CCD time: {}", self.ccd_time)?;
writeln!(f, "Query pipeline time: {}", self.query_pipeline_time)?;
writeln!(f, "User changes time: {}", self.user_changes)
}
}