#xen #trace #parser #analyzer #xentrace

xentrace-parser

A XenTrace files parser with a study purpose

31 releases (2 stable)

Uses new Rust 2021

new 1.1.0 Jan 24, 2023
0.10.4 Jul 12, 2022
0.3.4 Oct 6, 2021
0.1.4 Jun 6, 2021

#2 in #xen

46 downloads per month

LGPL-2.1-or-later

1MB
503 lines

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

This library parses XenTrace binary files by producing a list of events 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.56.1+)

Usage

use xentrace_parser::{
    record::{Domain, DomainKind, Event, Record/*, EventCode*/},
    Trace,
};

fn main() -> Result<()> {
    let trace = Trace::try_from("/path/to/trace.xen.dat")?;

    // let path: Path = todo!();
    // let trace = Trace::try_from(path)?;

    // let file: File = todo!();
    // let trace = Trace::from(file);

    // let file: File = todo!();
    // let bufreader: BufReader<File> = BufReader::new(file);
    // let trace = Trace::from(bufreader);

    for record in trace.iter() {
        let _cpu: u16 = record.cpu(); // Host CPU
        let domain: &Domain = record.domain();
        let _dom_kind: DomainKind = domain.kind();
        let _event: &Event = record.event();

        println!("{:?}", r);
    }

    println!(); // Blank

    let rec_count = trace.record_count();
    let cpu_count = trace.cpu_count();

    println!("Records count: {:?}", rec_count);
    println!("Host CPU count:  {:?}", cpu_count);

    Ok(())
}

This example could be started from the repo's root directory with: cargo run --example simple_print

License

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

No runtime deps