fxprof_processed_profile/frame.rs
1use bitflags::bitflags;
2
3use crate::category::CategoryPairHandle;
4use crate::global_lib_table::LibraryHandle;
5use crate::profile::StringHandle;
6
7/// A part of the information about a single stack frame.
8#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)]
9pub enum Frame {
10 /// A code address taken from the instruction pointer.
11 ///
12 /// This code address will be resolved to a library-relative address using
13 /// the library mappings on the process which were specified using
14 /// [`Profile::add_lib_mapping`](crate::Profile::add_lib_mapping).
15 InstructionPointer(u64),
16 /// A code address taken from a return address
17 ///
18 /// This code address will be resolved to a library-relative address using
19 /// the library mappings on the process which were specified using
20 /// [`Profile::add_lib_mapping`](crate::Profile::add_lib_mapping).
21 ReturnAddress(u64),
22 /// A relative address taken from the instruction pointer which
23 /// has already been resolved to a `LibraryHandle`.
24 RelativeAddressFromInstructionPointer(LibraryHandle, u32),
25 /// A relative address taken from a return address which
26 /// has already been resolved to a `LibraryHandle`.
27 RelativeAddressFromReturnAddress(LibraryHandle, u32),
28 /// A string, containing an index returned by Profile::intern_string
29 Label(StringHandle),
30}
31
32/// All the information about a single stack frame.
33#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)]
34pub struct FrameInfo {
35 /// The absolute address or label of this frame.
36 pub frame: Frame,
37 /// The category pair of this frame.
38 pub category_pair: CategoryPairHandle,
39 /// The flags of this frame. Use `FrameFlags::empty()` if unsure.
40 pub flags: FrameFlags,
41}
42
43bitflags! {
44 /// Flags for a stack frame.
45 #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
46 pub struct FrameFlags: u32 {
47 /// Set on frames which are JavaScript functions.
48 const IS_JS = 0b00000001;
49
50 /// Set on frames which are not strictly JavaScript functions but which
51 /// should be included in the JS-only call tree, such as DOM API calls.
52 const IS_RELEVANT_FOR_JS = 0b00000010;
53 }
54}