Module jitdump

Source
Expand description

Parsing code for jitdump files.

jitdump files usually have the name jit-<pid>.dump. They are associated with a perf.data file via an MMAP2 record. This means that the profiled application which creates these files must also mmap them.

The file contents are binary. The file starts with a file header. The header is followed by a sequence of records. Each record starts with a record header with the record type, a timestamp, and the full size of the record.

§Example

use linux_perf_data::jitdump::{JitDumpReader, JitDumpRecord};

let file = std::fs::File::open("jit-12345.dump")?;
let mut reader = JitDumpReader::new(file)?;
println!("jitdump header: {:?}", reader.header());

while let Some(raw_record) = reader.next_record()? {
    let timestamp = raw_record.timestamp;
    match raw_record.parse()? {
        JitDumpRecord::CodeLoad(record) => {
            println!("{timestamp:016} LOAD {record:?}");
        }
        JitDumpRecord::CodeMove(record) => {
            println!("{timestamp:016} MOVE {record:?}");
        }
        JitDumpRecord::CodeDebugInfo(record) => {
            println!("{timestamp:016} DEBUG_INFO {record:?}");
        }
        JitDumpRecord::CodeClose => {
            println!("{timestamp:016} CLOSE");
        }
        JitDumpRecord::CodeUnwindingInfo(record) => {
            println!("{timestamp:016} UNWINDING_Info {record:?}");
        }
        JitDumpRecord::Other(record) => {
            println!("{timestamp:016} {} {record:?}", record.record_type.0);
        }
    }
}

Structs§

JitCodeDebugInfoEntry
An entry for a single code location (file, line, column). Used inside a JitCodeDebugInfoRecord.
JitCodeDebugInfoRecord
A parsed JIT_CODE_DEBUG_INFO record, mapping addresses to source lines.
JitCodeLoadRecord
A parsed JIT_CODE_LOAD record, for a single jitted function.
JitCodeMoveRecord
A parsed JIT_CODE_MOVE record.
JitCodeUnwindingInfoRecord
A parsed JIT_CODE_UNWINDING_INFO record, with eh_frame data for a single jitted function.
JitDumpHeader
The jitdump header.
JitDumpRawRecord
A raw jitdump record whose body hasn’t been parsed yet.
JitDumpReader
Parses a jitdump file and allows iterating over records.
JitDumpRecordHeader
The header which is at the start of every jitdump record.
JitDumpRecordType
The record type of a jitdump record.

Enums§

JitDumpError
The error type used for jitdump parsing.
JitDumpRecord
An enum carrying a parsed jitdump record.