pub fn trace_thread<P: AsRef<Path>>(output_dir: P) -> Result<(), Box<dyn Error>>
Expand description
Start tracking current thread only
Enables memory tracking for the calling thread only. Use this when you want to track specific threads rather than the entire application.
§Arguments
output_dir
- Directory where tracking data will be stored
§Returns
Result indicating success or error during thread tracker initialization
§Example
use memscope_rs::lockfree::api::trace_thread;
std::thread::spawn(|| {
if let Err(e) = trace_thread("./thread_analysis") {
eprintln!("Error starting thread tracking: {}", e);
}
// This thread's allocations are now tracked
});