pub struct ProfilePacket {
pub strings: Vec<InternedString>,
pub mappings: Vec<Mapping>,
pub frames: Vec<Frame>,
pub callstacks: Vec<Callstack>,
pub process_dumps: Vec<ProcessHeapSamples>,
pub continued: Option<bool>,
pub index: Option<u64>,
}Expand description
This file contains a mixture of messages emitted by various sampling profilers:
§Memory allocator profiling
ProfilePacket: The packet emitted by heapprofd, which started off as a native heap (malloc/free) profiler, but now supports custom allocators as well. Each packet contains a preaggregated state of the heap at snapshot time, which report the total allocated/free bytes per callstack (plus other info such as the number of samples). StreamingAllocation/StreamingFree: Emitted by heapprofd when configured in streaming mode (i.e. when stream_allocations = true). This is only for local testing, and doesn’t report callstacks (only address time and size of each alloc/free). It can lead to enormous traces, as it contains the stream of each alloc/free call.
§Callstack sampling
StreamingProfilePacket: The packet emitted by the chromium in-process sampling profiler, which is based on periodically sending a signal to itself, and unwinding the stack in the signal handler. Each packet contains a series of individual stack samples for a Chromium thread.
§Callstack and performance counter sampling
PerfSample: The packet emitted by traced_perf sampling performance profiler based on the perf_event_open syscall. Each packet represents an individual sample of a performance counter (which might be a timer), and optionally a callstack of the process that was scheduled at the time of the sample.
The packet emitted by heapprofd for each heap snapshot. A snapshot can involve more than one ProfilePacket if the snapshot is big (when |continued| is true). The cardinality and grouping is as follows: A ProfilePacket contains:
- 1+ per-process heap snapshots (ProcessHeapSamples). Normally there is only one heap per process (the main malloc/free heap), but there can be more if the process is using the heapprofd API to profile custom allocators.
- Globally interned strings, mappings and frames (to allow de-duplicating frames/mapping in common between different processes). A ProcessHeapSamples contains:
- The process and heap identifier.
- A number of HeapSample, one for each callsite that had some alloc/frees.
- Statistics about heapprofd internals (e.g., sampling/unwinding timings). A HeapSample contains statistics about callsites:
- Total number of bytes allocated and freed from that callsite.
- Total number of alloc/free calls sampled.
- Stats at the local maximum when dump_at_max = true. See https://perfetto.dev/docs/data-sources/native-heap-profiler for more.
Fields§
§strings: Vec<InternedString>The following interning tables are only used in Android version Q. In newer versions, these tables are in InternedData (see protos/perfetto/trace/interned_data) and are shared across multiple ProfilePackets. For backwards compatibility, consumers need to first look up interned data in the tables within the ProfilePacket, and then, if they are empty, look up in the InternedData instead.
mappings: Vec<Mapping>§frames: Vec<Frame>§callstacks: Vec<Callstack>§process_dumps: Vec<ProcessHeapSamples>§continued: Option<bool>If this is true, the next ProfilePacket in this package_sequence_id is a continuation of this one. To get all samples for a process, accummulate its ProcessHeapSamples.samples until you see continued=false.
index: Option<u64>Index of this ProfilePacket on its package_sequence_id. Can be used to detect dropped data. Verify these are consecutive.
Implementations§
Trait Implementations§
Source§impl Clone for ProfilePacket
impl Clone for ProfilePacket
Source§impl Debug for ProfilePacket
impl Debug for ProfilePacket
Source§impl Default for ProfilePacket
impl Default for ProfilePacket
Source§impl Message for ProfilePacket
impl Message for ProfilePacket
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.