Crates.io | xentrace-parser |
lib.rs | xentrace-parser |
version | 2.1.0 |
source | src |
created_at | 2021-05-29 22:09:43.92104 |
updated_at | 2024-03-27 16:04:30.738414 |
description | A XenTrace files parser with a study purpose |
homepage | |
repository | https://github.com/giuseppe998e/xentrace-parser-rs |
max_upload_size | |
id | 403654 |
size | 52,014 |
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.
rust
(v1.65+)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).
This library is released under the GNU Lesser General Public License v2.1 (or later)
.