| /* |
| * Copyright (C) 2020 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. |
| */ |
| |
| // The branch list file format is generated by the inject command. The new format is: |
| // struct BranchListFile { |
| // char magic[24] = "simpleperf:EtmBranchList"; |
| // uint32 version = 1; |
| // uint8 compressed; // 1 if compressed, otherwise 0 |
| // struct { |
| // uint32 msg_size; |
| // message BranchList msg; |
| // } msgs[]; |
| // }; |
| // The old format is a single BranchList message. |
| // |
| |
| syntax = "proto3"; |
| |
| package simpleperf.proto; |
| |
| message BranchList { |
| // Used to identify format in generated proto files. |
| // Should always be "simpleperf:EtmBranchList". |
| string magic = 1; |
| repeated ETMBinary etm_data = 2; |
| LBRData lbr_data = 3; |
| } |
| |
| message ETMBinary { |
| string path = 1; |
| string build_id = 2; |
| |
| message Address { |
| // vaddr in binary, instr addr before the first branch |
| uint64 addr = 1; |
| |
| message Branch { |
| // Each bit represents a branch: 0 for not branch, 1 for branch. |
| // Bit 0 comes first, bit 7 comes last. |
| bytes branch = 1; |
| uint32 branch_size = 2; |
| uint64 count = 3; |
| } |
| |
| repeated Branch branches = 2; |
| } |
| |
| repeated Address addrs = 3; |
| |
| enum BinaryType { |
| ELF_FILE = 0; |
| KERNEL = 1; |
| KERNEL_MODULE = 2; |
| } |
| BinaryType type = 4; |
| |
| message KernelBinaryInfo { |
| // kernel_start_addr is used to convert kernel ip address to vaddr in vmlinux. |
| // If it is zero, the Address in KERNEL binary has been converted to vaddr. Otherwise, |
| // the Address in KERNEL binary is still ip address, and need to be converted later. |
| uint64 kernel_start_addr = 1; |
| } |
| |
| KernelBinaryInfo kernel_info = 5; |
| } |
| |
| message LBRData { |
| repeated Sample samples = 1; |
| repeated Binary binaries = 2; |
| |
| message Sample { |
| // If binary_id >= 1, it refers to LBRData.binaries[binary_id - 1]. Otherwise, it's invalid. |
| uint32 binary_id = 1; |
| uint64 vaddr_in_file = 2; |
| repeated Branch branches = 3; |
| |
| message Branch { |
| // If from_binary_id >= 1, it refers to LBRData.binaries[from_binary_id - 1]. Otherwise, it's |
| // invalid. |
| uint32 from_binary_id = 1; |
| // If to_binary_id >= 1, it refers to LBRData.binaries[to_binary_id - 1]. Otherwise, it's |
| // invalid. |
| uint32 to_binary_id = 2; |
| uint64 from_vaddr_in_file = 3; |
| uint64 to_vaddr_in_file = 4; |
| } |
| } |
| |
| message Binary { |
| string path = 1; |
| string build_id = 2; |
| } |
| } |