• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18option optimize_for = LITE_RUNTIME;
19
20import "perfetto/trace/track_event/debug_annotation.proto";
21import "perfetto/trace/track_event/task_execution.proto";
22import "perfetto/trace/track_event/track_event.proto";
23
24package perfetto.protos;
25
26// ------------------------------ DATA INTERNING: ------------------------------
27// Interning indexes are built up gradually by adding the entries contained in
28// each TracePacket of the same packet sequence (packets emitted by the same
29// producer and TraceWriter, see |trusted_packet_sequence_id|). Thus, packets
30// can only refer to interned data from other packets in the same sequence.
31//
32// The writer will emit new entries when it encounters new internable values
33// that aren't yet in the index. Data in current and subsequent TracePackets can
34// then refer to the entry by its position (interning ID, abbreviated "iid") in
35// its index. An interning ID with value 0 is considered invalid (not set).
36//
37// Because of the incremental build-up, the interning index will miss data when
38// TracePackets are lost, e.g. because a chunk was overridden in the central
39// ring buffer. To avoid invalidation of the whole trace in such a case, the
40// index is periodically reset (see |incremental_state_cleared| in TracePacket).
41// When packet loss occurs, the reader will only lose interning data up to the
42// next reset.
43// -----------------------------------------------------------------------------
44
45// Message that contains new entries for the interning indices of a packet
46// sequence.
47//
48// The writer will usually emit new entries in the same TracePacket that first
49// refers to them (since the last reset of interning state). They may also be
50// emitted proactively in advance of referring to them in later packets.
51//
52// Next id: 5.
53message InternedData {
54  // Each field's message type needs to specify an |iid| field, which is the ID
55  // of the entry in the field's interning index. Each field constructs its own
56  // index, thus interning IDs are scoped to the tracing session and field
57  // (usually as a counter for efficient var-int encoding). It is illegal to
58  // override entries in an index (using the same iid for two different values)
59  // within the same tracing session, even after a reset of the emitted
60  // interning state.
61  repeated EventCategory event_categories = 1;
62  repeated LegacyEventName legacy_event_names = 2;
63  repeated DebugAnnotationName debug_annotation_names = 3;
64  repeated SourceLocation source_locations = 4;
65  // Note: field IDs up to 15 should be used for frequent data only.
66}
67