/// Register a thread with the Gecko Profiler. #[cfg(all(feature = "gecko", not(target_os = "android")))] fn register_thread(thread_name: &str) { let name = std::ffi::CString::new(thread_name).unwrap(); unsafe { // gecko_profiler_register_thread copies the passed name here.
bindings::gecko_profiler_register_thread(name.as_ptr());
}
}
/// Spawns a new thread, returning a [`JoinHandle`] for it. /// /// Wrapper around [`std::thread::spawn`], but automatically naming the thread. pubfn spawn<F, T>(name: &'static str, f: F) -> Result<JoinHandle<T>, io::Error> where
F: FnOnce() -> T + Send + 'static,
T: Send + 'static,
{
thread::Builder::new()
.name(name.to_string())
.spawn(move || {
register_thread(name); let res = f();
unregister_thread();
res
})
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet am 2026-08-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.