use clang_rt_xray::raw::{interface::*, log_interface::*}; use std::ffi::CString; fn foo() { println!("foo()"); } fn bar() { println!("bar()"); } fn baz() { println!("baz()"); } fn main() { xray_patch().unwrap(); let mode = CString::new("xray-fdr").unwrap(); // By default, FDR won't record short function calls. Make it log everything. let config = CString::new("func_duration_threshold_us=0").unwrap(); xray_log_select_mode(&mode).unwrap(); xray_log_init_mode(&mode, &config).unwrap(); foo(); xray_log_finalize().unwrap(); xray_log_flush_log().unwrap(); bar(); xray_log_init_mode(&mode, &config).unwrap(); baz(); xray_log_finalize().unwrap(); xray_log_flush_log().unwrap(); xray_unpatch().unwrap(); }