MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / end

Method end

tracer/src/tracer.rs:35–57  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

33 }
34
35 fn end(&self) {
36 let end = Instant::now();
37 // SAFETY: FFI call
38 let path = format!("cloud-hypervisor-{}.trace", unsafe { libc::getpid() });
39 let mut file = File::create(&path).unwrap();
40
41 #[derive(Serialize)]
42 struct TraceReport {
43 duration: Duration,
44 events: Arc<Mutex<HashMap<String, Vec<TraceEvent>>>>,
45 }
46
47 let trace_report = TraceReport {
48 duration: end.duration_since(self.start),
49 events: self.events.clone(),
50 };
51
52 serde_json::to_writer_pretty(&file, &trace_report).unwrap();
53
54 file.flush().unwrap();
55
56 warn!("Trace output: {path}");
57 }
58
59 fn add_event(&mut self, event: TraceEvent) {
60 let current = std::thread::current();

Callers 1

endFunction · 0.45

Calls 3

createFunction · 0.85
cloneMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected