blob: deec6935a6d706eaea31b43590b181779f57ca9f [file] [log] [blame]
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto2";
package perfetto.protos;
// This proto wraps a bytecode that describes how to filter proto messages.
// For the full specs of the filter bytecode see go/trace-filtering.
// In short:
// - A filter is a sequence of uint32 words.
// - Each word is (immediate value << 3) | (3-bit OPCODE)
// - Each group of words (until END_OF_MESSAGE) defines field filters for a
// message. The first message is the root message where the filtering starts
// (typically perfetto.protos.Trace).
message ProtoFilter {
enum Opcode {
// The immediate value is 0 in this case.
FILTER_OPCODE_END_OF_MESSAGE = 0;
// The immediate value is the id of the allowed field.
FILTER_OPCODE_SIMPLE_FIELD = 1;
// The immediate value is the start of the range. The next word (without
// any shifting) is the length of the range.
FILTER_OPCODE_SIMPLE_FIELD_RANGE = 2;
// The immediate value is the id of the allowed field. The next word
// (without any shifting) is the index of the filter that should be used to
// recurse into the nested message.
FILTER_OPCODE_NESTED_FIELD = 3;
}
repeated uint32 bytecode = 1 [packed = true];
}