MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / record_function_for_perf

Method record_function_for_perf

cranelift/jit/src/backend.rs:293–308  ·  view source on GitHub ↗
(&self, ptr: *const u8, size: usize, name: &str)

Source from the content-addressed store, hash-verified

291 }
292
293 fn record_function_for_perf(&self, ptr: *const u8, size: usize, name: &str) {
294 // The Linux perf tool supports JIT code via a /tmp/perf-$PID.map file,
295 // which contains memory regions and their associated names. If we
296 // are profiling with perf and saving binaries to PERF_BUILDID_DIR
297 // for post-profile analysis, write information about each function
298 // we define.
299 if cfg!(unix) && ::std::env::var_os("PERF_BUILDID_DIR").is_some() {
300 let mut map_file = ::std::fs::OpenOptions::new()
301 .create(true)
302 .append(true)
303 .open(format!("/tmp/perf-{}.map", ::std::process::id()))
304 .unwrap();
305
306 let _ = writeln!(map_file, "{:x} {:x} {}", ptr as usize, size, name);
307 }
308 }
309
310 /// Finalize all functions and data objects that are defined but not yet finalized.
311 /// All symbols referenced in their bodies that are declared as needing a definition

Callers 2

define_function_bytesMethod · 0.80

Calls 6

newFunction · 0.50
is_someMethod · 0.45
unwrapMethod · 0.45
openMethod · 0.45
appendMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected