(&mut self)
| 231 | } |
| 232 | |
| 233 | pub fn process_loop_completed(&mut self) { |
| 234 | let Some(now) = crate::time::now() else { |
| 235 | return; |
| 236 | }; |
| 237 | |
| 238 | #[cfg(feature = "node_profiling")] |
| 239 | if self.is_profiling_nodes { |
| 240 | for (node, &sum) in self |
| 241 | .heap_data |
| 242 | .nodes |
| 243 | .iter_mut() |
| 244 | .zip(self.heap_data.node_cpu_sums.iter()) |
| 245 | { |
| 246 | node.cpu_usage = node.cpu_usage.max(sum); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | let overall_cpu_usage = now.duration_since(self.proc_start_instant).as_secs_f64() |
| 251 | * self.total_cpu_seconds_recip; |
| 252 | self.overall_cpu_usage = self.overall_cpu_usage.max(overall_cpu_usage); |
| 253 | |
| 254 | if self.is_profiling_bookkeeping { |
| 255 | let cpu_usage = now |
| 256 | .duration_since(self.bookkeeping_start_instant) |
| 257 | .as_secs_f64() |
| 258 | * self.total_cpu_seconds_recip; |
| 259 | self.bookkeeping_cpu_usage_sum += cpu_usage; |
| 260 | |
| 261 | self.bookkeeping_cpu_usage = self |
| 262 | .bookkeeping_cpu_usage |
| 263 | .max(self.bookkeeping_cpu_usage_sum); |
| 264 | } |
| 265 | |
| 266 | if self.buffer_tx.consumed() || self.version_counter == 0 { |
| 267 | { |
| 268 | let data = self.buffer_tx.input_buffer_mut(); |
| 269 | |
| 270 | data.version = self.version_counter; |
| 271 | data.overall_cpu_usage = self.overall_cpu_usage; |
| 272 | |
| 273 | data.engine_bookkeeping_cpu_usage = self |
| 274 | .is_profiling_bookkeeping |
| 275 | .then_some(self.bookkeeping_cpu_usage); |
| 276 | |
| 277 | #[cfg(feature = "node_profiling")] |
| 278 | if self.is_profiling_nodes { |
| 279 | if data.nodes.capacity() < self.heap_data.nodes.len() |
| 280 | && let Some(new_vec) = self |
| 281 | .heap_data |
| 282 | .triple_buf_allocations |
| 283 | .iter_mut() |
| 284 | .find(|v| v.capacity() >= self.heap_data.nodes.len()) |
| 285 | { |
| 286 | core::mem::swap(&mut data.nodes, new_vec); |
| 287 | } |
| 288 | |
| 289 | data.nodes.clear(); |
| 290 | data.nodes.extend_from_slice(&self.heap_data.nodes); |
no test coverage detected