MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / engine_debug_get_stats

Function engine_debug_get_stats

packages/native/src/debug.rs:318–348  ·  view source on GitHub ↗
(engine_id: u32)

Source from the content-addressed store, hash-verified

316
317#[napi(js_name = "engineDebugGetStats")]
318pub 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")]
351pub fn engine_debug_export(engine_id: u32, mut out_buf: Uint8Array) -> i32 {

Callers

nothing calls this directly

Calls 4

get_engine_guardFunction · 0.85
invalid_arg_errorFunction · 0.85
bigint_from_u64Function · 0.85
is_owner_threadMethod · 0.80

Tested by

no test coverage detected