xref: /aosp_15_r20/external/perfetto/protos/perfetto/trace_processor/serialization.proto (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1/*
2 * Copyright (C) 2023 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";
18
19package perfetto.protos;
20
21// This file defines the schema for {, de}serializing contents of TraceProcessor
22// storage. This schema should is not an API and should not be dependent upon -
23// it is an implementation detail of Trace Processor and can be changed at any
24// time.
25
26// Outside level schema of all serialized objects. Each self contained
27// serialized object is a separate packet and they don't depend on each other
28// for serialization.
29message SerializedTraceProcessor {
30  repeated SerializedTraceProcessorPacket packet = 1;
31}
32
33// One of independent serialized objects.
34message SerializedTraceProcessorPacket {
35  oneof packet {
36    SerializedColumn column = 1;
37  }
38}
39
40// Schema for serializing the column of Trace Processor table.
41message SerializedColumn {
42  // Schema used to store a serialized |BitVector|.
43  message BitVector {
44    optional bytes words = 1;
45    optional bytes counts = 2;
46    optional uint32 size = 3;
47  }
48  // A schema for serialization of any of the descendants of |storage::Storage|.
49  message Storage {
50    // Dummy storage should not contain any data. It's used to signify that
51    // there is a column present, and it's not usable.
52    message DummyStorage {}
53
54    // A schema for serialization of |storage::IdStorage|.
55    message IdStorage {
56      optional uint64 size = 1;
57    }
58
59    // A schema for serialization of |storage::Numeric|.
60    message NumericStorage {
61      optional bytes values = 1;
62      optional bool is_sorted = 2;
63      optional uint32 column_type = 3;
64    }
65
66    // A schema for serialization of |storage::SetIdStorage|.
67    message SetIdStorage {
68      optional bytes values = 1;
69    }
70
71    // A schema for serialization of |storage::StringStorage|.
72    message StringStorage {
73      optional bytes values = 1;
74      optional bool is_sorted = 2;
75    }
76
77    // A schema for serialization of |storage::NullOverlay|.
78    message NullOverlay {
79      optional BitVector bit_vector = 1;
80      optional Storage storage = 2;
81    }
82
83    // A schema for serialization of |storage::ArrangementOverlay|.
84    message ArrangementOverlay {
85      optional bytes values = 1;
86      optional Storage storage = 2;
87    }
88
89    // A schema for serialization of |storage::SelectorOverlay|.
90    message SelectorOverlay {
91      optional BitVector bit_vector = 1;
92      optional Storage storage = 2;
93    }
94
95    // A schema for serialization of |storage::DenseNullOverlay|.
96    message DenseNullOverlay {
97      optional BitVector bit_vector = 1;
98      optional Storage storage = 2;
99    }
100
101    oneof data {
102      DummyStorage dummy_storage = 1;
103      IdStorage id_storage = 2;
104      NumericStorage numeric_storage = 3;
105      SetIdStorage set_id_storage = 4;
106      StringStorage string_storage = 5;
107      NullOverlay null_overlay = 6;
108      ArrangementOverlay arrangement_overlay = 7;
109      SelectorOverlay selector_overlay = 8;
110      DenseNullOverlay dense_null_overlay = 9;
111    }
112  }
113
114  // Name of the table this column is part of.
115  optional string table_name = 1;
116  optional string column_name = 2;
117  optional Storage storage = 3;
118}
119