use super::IfcAPI;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
impl IfcAPI {
#[wasm_bindgen(js_name = getPipelineDiagnostics)]
pub fn get_pipeline_diagnostics(&self) -> JsValue {
let diag = self
.pipeline_diagnostics
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
if diag.is_empty() {
return JsValue::UNDEFINED;
}
serde_wasm_bindgen::to_value(&*diag).unwrap_or(JsValue::UNDEFINED)
}
}
impl IfcAPI {
#[allow(clippy::too_many_arguments)]
pub(crate) fn record_pipeline_batch(
&self,
element_count: u64,
mesh_count: u64,
triangle_count: u64,
backstop_count: u64,
point_cache_hits: u64,
point_cache_misses: u64,
geometry_ms: u64,
diag: &ifc_lite_geometry::GeometryDiagnostics,
) {
let mut acc = self
.pipeline_diagnostics
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
acc.record_batch(
element_count,
mesh_count,
triangle_count,
backstop_count,
point_cache_hits,
point_cache_misses,
0,
geometry_ms,
diag,
);
}
pub(crate) fn reset_pipeline_diagnostics(&self) {
let mut acc = self
.pipeline_diagnostics
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
*acc = ifc_lite_processing::PipelineDiagnostics::default();
}
}