(engine_id: u32)
| 316 | |
| 317 | #[napi(js_name = "engineDebugGetStats")] |
| 318 | pub fn engine_debug_get_stats(engine_id: u32) -> napi::Result<DebugStats> { |
| 319 | let guard = get_engine_guard(engine_id).map_err(|_| invalid_arg_error())?; |
| 320 | if !guard.slot.is_owner_thread() { |
| 321 | return Err(invalid_arg_error()); |
| 322 | } |
| 323 | |
| 324 | let mut stats = ffi::zr_debug_stats_t { |
| 325 | total_records: 0, |
| 326 | total_dropped: 0, |
| 327 | error_count: 0, |
| 328 | warn_count: 0, |
| 329 | current_ring_usage: 0, |
| 330 | ring_capacity: 0, |
| 331 | }; |
| 332 | let rc = unsafe { ffi::engine_debug_get_stats(guard.slot.engine, &mut stats as *mut _) }; |
| 333 | if rc != ffi::ZR_OK { |
| 334 | return Err(Error::new( |
| 335 | Status::GenericFailure, |
| 336 | format!("engine_debug_get_stats failed: {rc}"), |
| 337 | )); |
| 338 | } |
| 339 | |
| 340 | Ok(DebugStats { |
| 341 | totalRecords: bigint_from_u64(stats.total_records), |
| 342 | totalDropped: bigint_from_u64(stats.total_dropped), |
| 343 | errorCount: stats.error_count, |
| 344 | warnCount: stats.warn_count, |
| 345 | currentRingUsage: stats.current_ring_usage, |
| 346 | ringCapacity: stats.ring_capacity, |
| 347 | }) |
| 348 | } |
| 349 | |
| 350 | #[napi(js_name = "engineDebugExport")] |
| 351 | pub fn engine_debug_export(engine_id: u32, mut out_buf: Uint8Array) -> i32 { |
nothing calls this directly
no test coverage detected