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

Method dump_code_load_record

crates/jit-debug/src/perf_jitdump.rs:282–316  ·  view source on GitHub ↗
(
        &mut self,
        method_name: &str,
        code: &[u8],
        timestamp: u64,
        pid: u32,
        tid: u32,
    )

Source from the content-addressed store, hash-verified

280 }
281
282 pub fn dump_code_load_record(
283 &mut self,
284 method_name: &str,
285 code: &[u8],
286 timestamp: u64,
287 pid: u32,
288 tid: u32,
289 ) -> io::Result<()> {
290 let name_len = method_name.len() + 1;
291 let size_limit = mem::size_of::<CodeLoadRecord>();
292
293 let rh = RecordHeader {
294 id: RecordId::JitCodeLoad as u32,
295 record_size: size_limit as u32 + name_len as u32 + code.len() as u32,
296 timestamp,
297 };
298
299 let clr = CodeLoadRecord {
300 header: rh,
301 pid,
302 tid,
303 virtual_address: code.as_ptr() as u64,
304 address: code.as_ptr() as u64,
305 size: code.len() as u64,
306 index: self.next_code_index(),
307 };
308
309 let mut record = Vec::new();
310 record.extend_from_slice(object::bytes_of(&clr));
311 record.extend_from_slice(method_name.as_bytes());
312 record.push(0); // null terminator for the method name
313 record.extend_from_slice(code);
314 self.maybe_atomic_write_all(&record)?;
315 Ok(())
316 }
317}
318
319impl Drop for JitDumpFile {

Callers 1

register_functionMethod · 0.80

Calls 8

OkFunction · 0.85
next_code_indexMethod · 0.80
as_bytesMethod · 0.80
newFunction · 0.50
lenMethod · 0.45
as_ptrMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected