linux_perf_data/jitdump/
mod.rs

1//! Parsing code for [jitdump][jitdump] files.
2//!
3//! jitdump files usually have the name `jit-<pid>.dump`. They are associated
4//! with a `perf.data` file via an `MMAP2` record. This means that the profiled
5//! application which creates these files must also mmap them.
6//!
7//! The file contents are binary. The file starts with a file header. The header
8//! is followed by a sequence of records.  Each record starts with a record header
9//! with the record type, a timestamp, and the full size of the record.
10//!
11//! [jitdump]: https://raw.githubusercontent.com/torvalds/linux/master/tools/perf/Documentation/jitdump-specification.txt
12//!
13//! # Example
14//!
15//! ```
16//! use linux_perf_data::jitdump::{JitDumpReader, JitDumpRecord};
17//!
18//! # fn wrapper() -> Result<(), Box<dyn std::error::Error>> {
19//! let file = std::fs::File::open("jit-12345.dump")?;
20//! let mut reader = JitDumpReader::new(file)?;
21//! println!("jitdump header: {:?}", reader.header());
22//!
23//! while let Some(raw_record) = reader.next_record()? {
24//!     let timestamp = raw_record.timestamp;
25//!     match raw_record.parse()? {
26//!         JitDumpRecord::CodeLoad(record) => {
27//!             println!("{timestamp:016} LOAD {record:?}");
28//!         }
29//!         JitDumpRecord::CodeMove(record) => {
30//!             println!("{timestamp:016} MOVE {record:?}");
31//!         }
32//!         JitDumpRecord::CodeDebugInfo(record) => {
33//!             println!("{timestamp:016} DEBUG_INFO {record:?}");
34//!         }
35//!         JitDumpRecord::CodeClose => {
36//!             println!("{timestamp:016} CLOSE");
37//!         }
38//!         JitDumpRecord::CodeUnwindingInfo(record) => {
39//!             println!("{timestamp:016} UNWINDING_Info {record:?}");
40//!         }
41//!         JitDumpRecord::Other(record) => {
42//!             println!("{timestamp:016} {} {record:?}", record.record_type.0);
43//!         }
44//!     }
45//! }
46//! # Ok(())
47//! # }
48//! ```
49
50mod buffered_reader;
51mod error;
52mod header;
53mod jitdump_reader;
54mod read_exact;
55mod record;
56mod records;
57
58pub use error::*;
59pub use header::*;
60pub use jitdump_reader::*;
61pub use record::*;
62pub use records::*;