summaryrefslogtreecommitdiff
path: root/simpleperf/branch_list.proto
blob: 6d6bfb174c0129f56449e73cc92657ea4b06d71d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * 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. It contains
// 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;
  }
}