Skip to content

XenTrace binary file parser written in Rust with a study purpose

License

Notifications You must be signed in to change notification settings

giuseppe998e/xentrace-parser-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XenTrace binary data parser (RUST LANG) GitHub Latest Tag Crates.io Downloads

This library parses XenTrace binary files by producing a list of event records sorted by their TSC.

This is the Rust lang version of a project made for the final three-year degree exam at the University of Turin.

Dependencies

  • rust (v1.65+)

Usage

use xentrace_parser::{Result, Trace};

fn main() -> Result<()> {
    // The trace is truncated to the last readable record, returning no errors.
    let trace = Trace::from_file("/path/to/xentrace.bin")?;

    // Alternatively, you can create a trace from a bytes slice:
    // let bytes: Vec<u8> = vec![/* byte data */];
    // let trace = Trace::from_bytes(&bytes)?;

    // Alternatively, you can create a trace from a reader:
    // let file = std::fs::File::open("/path/to/xentrace.bin")?;
    // let bufreader = std::io::BufReader::new(file);
    // let trace = Trace::from_reader(bufreader);

    for record in trace.iter() {
        println!("{:?}", record);
    }

    Ok(())
}

An example debug can be started from the root directory with: cargo run --example debug_trace (only available on GitHub sources).

License

This library is released under the GNU Lesser General Public License v2.1 (or later).