diff --git a/xprof/perfetto_prunned.proto b/xprof/perfetto_prunned.proto index 0f9de5e6..855efc2e 100644 --- a/xprof/perfetto_prunned.proto +++ b/xprof/perfetto_prunned.proto @@ -1,32 +1,7 @@ -// AUTOGENERATED - DO NOT EDIT -// --------------------------- -// This file has been generated by -// AOSP://external/perfetto/tools/gen_merged_protos -// merging the perfetto config protos. -// This fused proto is intended to be copied in: -// - Android tree, for statsd. -// - Google internal repos. - syntax = "proto2"; - +// "There Is a Light That Never Goes Out" +// https://android.googlesource.com/platform/external/perfetto/+/refs/heads/master/protos/perfetto/trace/ package perfetto_pruned; -// Begin of protos/perfetto/common/track_event_descriptor.proto - -message TrackEventCategory { - optional string name = 1; - optional string description = 2; - repeated string tags = 3; -} - -message TrackEventDescriptor { - repeated TrackEventCategory available_categories = 1; -} - -message DataSourceDescriptor { - optional TrackEventDescriptor track_event_descriptor = 6 [lazy = true]; - -} -// Begin of protos/perfetto/common/builtin_clock.proto enum BuiltinClock { BUILTIN_CLOCK_UNKNOWN = 0; @@ -37,655 +12,74 @@ enum BuiltinClock { BUILTIN_CLOCK_MONOTONIC_RAW = 5; BUILTIN_CLOCK_BOOTTIME = 6; BUILTIN_CLOCK_MAX_ID = 63; - - reserved 7, 8; - - // An internal CL (ag/16521245) has taken this for BUILTIN_CLOCK_TSC. - // That might get upstreamed later on. Avoid diverging on this ID in future. - reserved 9; + reserved 7, 8, 9; } -message TrackEventConfig { - // The following fields define the set of enabled trace categories. Each list - // item is a glob. - // - // Default: [] - repeated string disabled_categories = 1; - - // Default: [] - repeated string enabled_categories = 2; - - // Default: ["slow", "debug"] - repeated string disabled_tags = 3; - - // Default: [] - repeated string enabled_tags = 4; - - // Default: false (i.e. enabled by default) - optional bool disable_incremental_timestamps = 5; - - // Allows to specify a custom unit different than the default (ns). - // Also affects thread timestamps if enable_thread_time_sampling = true. - // A multiplier of 1000 means that a timestamp = 3 should be interpreted as - // 3000 ns = 3 us. - // Default: 1 (if unset, it should be read as 1). - optional uint64 timestamp_unit_multiplier = 6; - -} - -// End of protos/perfetto/config/track_event/track_event_config.proto - -// Begin of protos/perfetto/config/data_source_config.proto - -// The configuration that is passed to each data source when starting tracing. -// Next id: 124 -message DataSourceConfig { - // Data source unique name, e.g., "linux.ftrace". This must match - // the name passed by the data source when it registers (see - // RegisterDataSource()). - optional string name = 1; - - // Data source name: track_event - optional TrackEventConfig track_event_config = 113 [lazy = true]; - // optional string legacy_config = 1000; - - // This field is only used for testing. - //optional TestConfig for_testing = 1001; - - // Was |for_testing|. Caused more problems then found. - reserved 268435455; +message ProcessDescriptor { + optional int32 pid = 1; + optional string process_name = 6; } -// Next id: 38. -message TraceConfig { - message BufferConfig { - optional uint32 size_kb = 1; - - // |page_size|, now deprecated. - reserved 2; - - // |optimize_for|, now deprecated. - reserved 3; - - enum FillPolicy { - UNSPECIFIED = 0; - - // Default behavior. The buffer operates as a conventional ring buffer. - // If the writer is faster than the reader (or if the reader reads only - // after tracing is stopped) newly written packets will overwrite old - // packets. - RING_BUFFER = 1; - - // Behaves like RING_BUFFER as long as there is space in the buffer or - // the reader catches up with the writer. As soon as the writer hits - // an unread chunk, it stops accepting new data in the buffer. - DISCARD = 2; - } - optional FillPolicy fill_policy = 4; - } - repeated BufferConfig buffers = 1; - - optional int64 trace_uuid_msb = 27 [deprecated = true]; - optional int64 trace_uuid_lsb = 28 [deprecated = true]; - +message TracePacketDefaults { + optional uint32 timestamp_clock_id = 58; } -// A snapshot of clock readings to allow for trace alignment. -message ClockSnapshot { - message Clock { - // DEPRECATED. This enum has moved to ../common/builtin_clock.proto. - enum BuiltinClocks { - UNKNOWN = 0; - REALTIME = 1; - REALTIME_COARSE = 2; - MONOTONIC = 3; - MONOTONIC_COARSE = 4; - MONOTONIC_RAW = 5; - BOOTTIME = 6; - BUILTIN_CLOCK_MAX_ID = 63; - - reserved 7, 8; - } - - // Clock IDs have the following semantic: - // [1, 63]: Builtin types, see BuiltinClock from - // ../common/builtin_clock.proto. - // [64, 127]: User-defined clocks. These clocks are sequence-scoped. They - // are only valid within the same |trusted_packet_sequence_id| - // (i.e. only for TracePacket(s) emitted by the same TraceWriter - // that emitted the clock snapshot). - // [128, MAX]: Reserved for future use. The idea is to allow global clock - // IDs and setting this ID to hash(full_clock_name) & ~127. - optional uint32 clock_id = 1; - // Absolute timestamp. Unit is ns unless specified otherwise by the - // unit_multiplier_ns field below. - optional uint64 timestamp = 2; - - // When true each TracePacket's timestamp should be interpreted as a delta - // from the last TracePacket's timestamp (referencing this clock) emitted by - // the same packet_sequence_id. Should only be used for user-defined - // sequence-local clocks. The first packet timestamp after each - // ClockSnapshot that contains this clock is relative to the |timestamp| in - // the ClockSnapshot. - optional bool is_incremental = 3; - - // Allows to specify a custom unit different than the default (ns) for this - // clock domain. A multiplier of 1000 means that a timestamp = 3 should be - // interpreted as 3000 ns = 3 us. All snapshots for the same clock within a - // trace need to use the same unit. - optional uint64 unit_multiplier_ns = 4; - } - repeated Clock clocks = 1; - - // The authoritative clock domain for the trace. Defaults to BOOTTIME, but can - // be overridden in TraceConfig's builtin_data_sources. Trace processor will - // attempt to translate packet/event timestamps from various data sources (and - // their chosen clock domains) to this domain during import. - optional BuiltinClock primary_trace_clock = 2; -} -/* -message FieldOptions { - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - optional bool packed = 2; -} -*/ -// Describes a oneof. -message OneofDescriptorProto { - optional string name = 1; - optional OneofOptions options = 2; +message ThreadDescriptor { + optional int32 pid = 1; + optional int32 tid = 2; + optional string thread_name = 5; } -// Describes an enum type. -message EnumDescriptorProto { - optional string name = 1; - - repeated EnumValueDescriptorProto value = 2; - - reserved 3; - reserved 4; - - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - repeated string reserved_name = 5; +message CounterDescriptor { } -// Describes a value within an enum. -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - - reserved 3; +message TrackDescriptor { + optional uint64 uuid = 1; + optional uint64 parent_uuid = 5; + optional string name = 2; + optional ProcessDescriptor process = 3; + optional ThreadDescriptor thread = 4; + optional CounterDescriptor counter = 8; } -message OneofOptions { - reserved 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} -// Next reserved id: 13 (up to 15). Next id: 50. message TrackEvent { - // Names of categories of the event. In the client library, categories are a - // way to turn groups of individual events on or off. - // interned EventCategoryName. - repeated uint64 category_iids = 3; - // non-interned variant. - repeated string categories = 22; - // Optional name of the event for its display in trace viewer. May be left - // unspecified for events with typed arguments. - // - // Note that metrics should not rely on event names, as they are prone to - // changing. Instead, they should use typed arguments to identify the events - // they are interested in. - oneof name_field { - // interned EventName. - uint64 name_iid = 10; - // non-interned variant. - string name = 23; - } - - // TODO(eseckler): Support using binary symbols for category/event names. - - // Type of the TrackEvent (required if |phase| in LegacyEvent is not set). enum Type { - TYPE_UNSPECIFIED = 0; - - TYPE_SLICE_BEGIN = 1; TYPE_SLICE_END = 2; - - // Instant events are nestable events without duration. They can be children - // of slice events on the same track. - TYPE_INSTANT = 3; - - // Event that provides a value for a counter track. |track_uuid| should - // refer to a counter track and |counter_value| set to the new value. Note - // that most other TrackEvent fields (e.g. categories, name, ..) are not - // supported for TYPE_COUNTER events. See also CounterDescriptor. TYPE_COUNTER = 4; } - optional Type type = 9; - // Identifies the track of the event. The default value may be overridden - // using TrackEventDefaults, e.g., to specify the track of the TraceWriter's - // sequence (in most cases sequence = one thread). If no value is specified - // here or in TrackEventDefaults, the TrackEvent will be associated with an - // implicit trace-global track (uuid 0). See TrackDescriptor::uuid. + optional Type type = 9; optional uint64 track_uuid = 11; - // A new value for a counter track. |track_uuid| should refer to a track with - // a CounterDescriptor, and |type| should be TYPE_COUNTER. For a more - // efficient encoding of counter values that are sampled at the beginning/end - // of a slice, see |extra_counter_values| and |extra_counter_track_uuids|. - // Counter values can optionally be encoded in as delta values (positive or - // negative) on each packet sequence (see CounterIncrementalBase). + oneof name_field { + string name = 23; + } + oneof counter_value_field { int64 counter_value = 30; double double_counter_value = 44; } - - // --------------------------------------------------------------------------- - // TrackEvent arguments: - // --------------------------------------------------------------------------- - - // This field is used only if the source location represents the function that - // executes during this event. - - // Extension range for future use. - extensions 1000 to 9899; - // Reserved for Perfetto unit and integration tests. - extensions 9900 to 10000; - - // --------------------------------------------------------------------------- - // Deprecated / legacy event fields, which will be removed in the future: - // --------------------------------------------------------------------------- - - // Deprecated. Use the |timestamp| and |timestamp_clock_id| fields in - // TracePacket instead. - // -} - -// Default values for fields of all TrackEvents on the same packet sequence. -// Should be emitted as part of TracePacketDefaults whenever incremental state -// is cleared. It's defined here because field IDs should match those of the -// corresponding fields in TrackEvent. -message TrackEventDefaults { - optional uint64 track_uuid = 11; - repeated uint64 extra_counter_track_uuids = 31; - repeated uint64 extra_double_counter_track_uuids = 45; - - // TODO(eseckler): Support default values for more TrackEvent fields. -} - -// -------------------- -// Interned data types: -// -------------------- - -message EventCategory { - optional uint64 iid = 1; - optional string name = 2; -} - -message EventName { - optional uint64 iid = 1; - optional string name = 2; -} - -// Begin of protos/perfetto/trace/ps/process_tree.proto - -// Metadata about the processes and threads in the trace. -// Note: this proto was designed to be filled in by traced_probes and should -// only be populated with accurate information coming from the system. Other -// trace writers should prefer to fill ThreadDescriptor and ProcessDescriptor -// in TrackDescriptor. -message ProcessTree { - // Representation of a thread. - message Thread { - // The thread ID (as per gettid()) in the root PID namespace. - optional int32 tid = 1; - - // Thread group id (i.e. the PID of the process, == TID of the main thread) - optional int32 tgid = 3; - - // The name of the thread. - optional string name = 2; - - // The non-root-level thread IDs if the thread runs in a PID namespace. Read - // from the NSpid entry of /proc//status, with the first element (root- - // level thread ID) omitted. - repeated int32 nstid = 4; - } - - // Representation of a process. - message Process { - // The UNIX process ID, aka thread group ID (as per getpid()) in the root - // PID namespace. - optional int32 pid = 1; - - // The parent process ID, as per getppid(). - optional int32 ppid = 2; - - // The command line for the process, as per /proc/pid/cmdline. - // If it is a kernel thread there will only be one cmdline field - // and it will contain /proc/pid/comm. - // repeated string cmdline = 3; - - // No longer used as of Apr 2018, when the dedicated |threads| field was - // introduced in ProcessTree. - //repeated Thread threads_deprecated = 4 [deprecated = true]; - - // The uid for the process, as per /proc/pid/status. - optional int32 uid = 5; - - // The non-root-level process IDs if the process runs in a PID namespace. - // Read from the NSpid entry of /proc//status, with the first element ( - // root-level process ID) omitted. - repeated int32 nspid = 6; - } - - // List of processes and threads in the client. These lists are incremental - // and not exhaustive. A process and its threads might show up separately in - // different ProcessTree messages. A thread might event not show up at all, if - // no sched_switch activity was detected, for instance: - // #0 { processes: [{pid: 10, ...}], threads: [{pid: 11, tgid: 10}] } - // #1 { threads: [{pid: 12, tgid: 10}] } - // #2 { processes: [{pid: 20, ...}], threads: [{pid: 13, tgid: 10}] } - repeated Process processes = 1; - repeated Thread threads = 2; - - // The time at which we finish collecting this process tree; - // the top-level packet timestamp is the time at which - // we begin collection. - optional uint64 collection_end_timestamp = 3; -} - -message TracePacketDefaults { - optional uint32 timestamp_clock_id = 58; - - // Default values for TrackEvents (e.g. default track). - optional TrackEventDefaults track_event_defaults = 11; - - // Defaults for perf profiler packets (PerfSample). - // optional PerfSampleDefaults perf_sample_defaults = 12; -} -// End of protos/perfetto/trace/trace_packet_defaults.proto - -// Begin of protos/perfetto/trace/trace_uuid.proto - -// A random unique ID that identifies the trace. -// This message has been introduced in v32. Prior to that, the UUID was -// only (optionally) present in the TraceConfig.trace_uuid_msb/lsb fields. -// This has been moved to a standalone packet to deal with new use-cases for -// go/gapless-aot, where the same tracing session can be serialized several -// times, in which case the UUID is changed on each snapshot and does not match -// the one in the TraceConfig. -message TraceUuid { - optional int64 msb = 1; - optional int64 lsb = 2; -} - -// End of protos/perfetto/trace/trace_uuid.proto - -// Begin of protos/perfetto/trace/track_event/process_descriptor.proto - -// Describes a process's attributes. Emitted as part of a TrackDescriptor, -// usually by the process's main thread. -// -// Next id: 9. -message ProcessDescriptor { - optional int32 pid = 1; - repeated string cmdline = 2; - optional string process_name = 6; - - optional int32 process_priority = 5; - // Process start time in nanoseconds. - // The timestamp refers to the trace clock by default. Other clock IDs - // provided in TracePacket are not supported. - optional int64 start_timestamp_ns = 7; - - // Labels can be used to further describe properties of the work performed by - // the process. For example, these can be used by Chrome renderer process to - // provide titles of frames being rendered. - repeated string process_labels = 8; -} - -// End of protos/perfetto/trace/track_event/process_descriptor.proto - -// Begin of protos/perfetto/trace/track_event/thread_descriptor.proto - -// Describes a thread's attributes. Emitted as part of a TrackDescriptor, -// usually by the thread's trace writer. -// -// Next id: 9. -message ThreadDescriptor { - optional int32 pid = 1; - optional int32 tid = 2; - - optional string thread_name = 5; - - // --------------------------------------------------------------------------- - // Deprecated / legacy fields, which will be removed in the future: - // --------------------------------------------------------------------------- - - optional int64 reference_timestamp_us = 6; - - // Absolute reference values. Clock values in subsequent TrackEvents can be - // encoded accumulatively and relative to these. This reduces their var-int - // encoding size. - // TODO(eseckler): Deprecated. Replace these with ClockSnapshot encoding. - optional int64 reference_thread_time_us = 7; - optional int64 reference_thread_instruction_count = 8; - - // To support old UI. New UI should determine default sorting by thread_type. - optional int32 legacy_sort_index = 3; -} - -message CounterDescriptor { - // Built-in counters, usually with special meaning in the client library, - // trace processor, legacy JSON format, or UI. Trace processor will infer a - // track name from the enum value if none is provided in TrackDescriptor. - enum BuiltinCounterType { - COUNTER_UNSPECIFIED = 0; - - // Thread-scoped counters. The thread's track should be specified via - // |parent_uuid| in the TrackDescriptor for such a counter. - - // implies UNIT_TIME_NS. - COUNTER_THREAD_TIME_NS = 1; - - // implies UNIT_COUNT. - COUNTER_THREAD_INSTRUCTION_COUNT = 2; - } - - // Type of the values for the counters - to supply lower granularity units, - // see also |unit_multiplier|. - enum Unit { - UNIT_UNSPECIFIED = 0; - UNIT_TIME_NS = 1; - UNIT_COUNT = 2; - UNIT_SIZE_BYTES = 3; - // TODO(eseckler): Support more units as necessary. - } - - // For built-in counters (e.g. thread time). Custom user-specified counters - // (e.g. those emitted by TRACE_COUNTER macros of the client library) - // shouldn't set this, and instead provide a counter name via TrackDescriptor. - optional BuiltinCounterType type = 1; - - // Names of categories of the counter (usually for user-specified counters). - // In the client library, categories are a way to turn groups of individual - // counters (or events) on or off. - repeated string categories = 2; - - // Type of the counter's values. Built-in counters imply a value for this - // field. - optional Unit unit = 3; - - // In order to use a unit not defined as a part of |Unit|, a free-form unit - // name can be used instead. - optional string unit_name = 6; - // TODO(eseckler): Support arguments describing the counter (?). - // repeated DebugAnnotation debug_annotations; -} -// As a fallback, TrackEvents emitted without an explicit track association will -// be associated with an implicit trace-global track (uuid = 0), see also -// |TrackEvent::track_uuid|. It is possible but not necessary to emit a -// TrackDescriptor for this implicit track. -// -// Next id: 10. -message TrackDescriptor { - // Unique ID that identifies this track. This ID is global to the whole trace. - // Producers should ensure that it is unlikely to clash with IDs emitted by - // other producers. A value of 0 denotes the implicit trace-global track. - // - // For example, legacy TRACE_EVENT macros may use a hash involving the async - // event id + id_scope, pid, and/or tid to compute this ID. - optional uint64 uuid = 1; - - // A parent track reference can be used to describe relationships between - // tracks. For example, to define an asynchronous track which is scoped to a - // specific process, specify the uuid for that process's process track here. - // Similarly, to associate a COUNTER_THREAD_TIME_NS counter track with a - // thread, specify the uuid for that thread's thread track here. - optional uint64 parent_uuid = 5; - - // Name of the track. Optional - if unspecified, it may be derived from the - // process/thread name (process/thread tracks), the first event's name (async - // tracks), or counter name (counter tracks). - optional string name = 2; - - // Associate the track with a process, making it the process-global track. - // There should only be one such track per process (usually for instant - // events; trace processor uses this fact to detect pid reuse). If you need - // more (e.g. for asynchronous events), create child tracks using parent_uuid. - // - // Trace processor will merge events on a process track with slice-type events - // from other sources (e.g. ftrace) for the same process into a single - // timeline view. - optional ProcessDescriptor process = 3; - // optional ChromeProcessDescriptor chrome_process = 6; - - // Associate the track with a thread, indicating that the track's events - // describe synchronous code execution on the thread. There should only be one - // such track per thread (trace processor uses this fact to detect tid reuse). - // - // Trace processor will merge events on a thread track with slice-type events - // from other sources (e.g. ftrace) for the same thread into a single timeline - // view. - optional ThreadDescriptor thread = 4; - // optional ChromeThreadDescriptor chrome_thread = 7; - - // Descriptor for a counter track. If set, the track will only support - // TYPE_COUNTER TrackEvents (and values provided via TrackEvent's - // |extra_counter_values|). - optional CounterDescriptor counter = 8; - - // If true, forces Trace Processor to use separate tracks for track events - // and system events for the same thread. - // Track events timestamps in Chrome have microsecond resolution, while - // system events use nanoseconds. It results in broken event nesting when - // track events and system events share a track. - optional bool disallow_merging_with_system_tracks = 9; } -// End of protos/perfetto/trace/track_event/track_descriptor.proto - -// Next id: 95. message TracePacket { - // The timestamp of the TracePacket. - // The clock domain definition in ClockSnapshot can also override: - // - The unit (default: 1ns). - // - The absolute vs delta encoding (default: absolute timestamp). optional uint64 timestamp = 8; - // Specifies the ID of the clock used for the TracePacket |timestamp|. Can be - // one of the built-in types from ClockSnapshot::BuiltinClocks, or a - // producer-defined clock id. - // If unspecified and if no default per-sequence value has been provided via - // TracePacketDefaults, it defaults to BuiltinClocks::BOOTTIME. - optional uint32 timestamp_clock_id = 58; - oneof data { -// ProcessTree process_tree = 2; - //ProcessStats process_stats = 9; - //InodeFileMap inode_file_map = 4; - //ChromeEventBundle chrome_events = 5; - // ClockSnapshot clock_snapshot = 6; - //SysStats sys_stats = 7; TrackEvent track_event = 11; - - // IDs up to 15 are reserved. They take only one byte to encode their - // preamble so should be used for frequent events. - - TraceUuid trace_uuid = 89; - TraceConfig trace_config = 33; - - // UiState ui_state = 78; - - - // Only used by TrackEvent. TrackDescriptor track_descriptor = 60; - - // Deprecated, use TrackDescriptor instead. - ProcessDescriptor process_descriptor = 43; - - // Deprecated, use TrackDescriptor instead. - ThreadDescriptor thread_descriptor = 44; - - // This field is emitted at periodic intervals (~10s) and - // contains always the binary representation of the UUID - // {82477a76-b28d-42ba-81dc-33326d57a079}. This is used to be able to - // efficiently partition long traces without having to fully parse them. - // bytes synchronization_marker = 36; - - //TestEvent for_testing = 900; - //gpu_freq.Packet gpu_freq_packet = 1001; } - // TODO(eseckler): Emit this field in a PacketSequenceDescriptor message - // instead. - oneof optional_trusted_uid { int32 trusted_uid = 3; }; - - // Service-assigned identifier of the packet sequence this packet belongs to. - // Uniquely identifies a producer + writer pair within the tracing session. A - // value of zero denotes an invalid ID. Keep in sync with - // TrustedPacket.trusted_packet_sequence_id. oneof optional_trusted_packet_sequence_id { uint32 trusted_packet_sequence_id = 10; } - // Trusted process id of the producer which generated this packet, written by - // the service. - optional int32 trusted_pid = 79; - - optional uint32 sequence_flags = 13; - - // TracePacketDefaults always override the global defaults for any future - // packet on this sequence (regardless of SEQ_NEEDS_INCREMENTAL_STATE). - optional TracePacketDefaults trace_packet_defaults = 59; - - // When packet loss occurs, incrementally emitted data (including interned - // data) on the sequence should be considered invalid up until the next packet - // with SEQ_INCREMENTAL_STATE_CLEARED set. + required TracePacketDefaults trace_packet_defaults = 59; optional bool previous_packet_dropped = 42; - // Given that older SDK versions do not support this flag, this flag not - // being present for a particular sequence does not necessarily imply data - // loss. - optional bool first_packet_on_sequence = 87; } -// End of protos/perfetto/trace/trace_packet.proto - -// Begin of protos/perfetto/trace/trace.proto - message Trace { repeated TracePacket packet = 1; - - // Do NOT add any other field here. } -// End of protos/perfetto/trace/trace.proto +