• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6//     http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14// report_sample.proto format:
15// char magic[10] = "HIPERF_PB_";
16// LittleEndian16(version) = 1;
17// LittleEndian32(sample_size)
18// message Record(sample)
19// LittleEndian32(sample_size)
20// message Record(sample)
21// ...
22// LittleEndian32(sample_size)
23// message Record(sample)
24// LittleEndian32(0)
25
26syntax = "proto2";
27option optimize_for = LITE_RUNTIME;
28package OHOS.Developtools.Hiperf.Proto;
29
30message CallStackSample {
31  optional uint64 time = 1;
32  optional uint32 tid = 2;
33
34  message CallStackFrame {
35    // virtual address of the instruction in symbols file
36    optional uint64 symbols_vaddr = 1;
37
38    // index of index of SymbolTableFile::id, base from 0
39    optional uint32 symbols_file_id = 2;
40
41    // index of SymbolTableFile::symbol_name, base from 0
42    // -1 means not found
43    optional int32 function_name_id = 3;
44
45    // loaded function base vaddr
46    optional uint64 loaded_vaddr = 4;
47  }
48
49  repeated CallStackFrame callStackFrame = 3;
50
51  // not include lost
52  optional uint64 event_count = 4;
53
54  // index of ReportInfo::config_name
55  optional uint32 config_name_id = 5;
56}
57
58message SampleStatistic {
59  optional uint64 count = 1;
60  optional uint64 lost = 2;
61}
62
63message SymbolTableFile {
64  // unique id , start from 0
65  optional uint32 id = 1;
66
67  // symbols file path, like developtools/hiperf/hiperf
68  optional string path = 2;
69
70  // function symbol table of the file (always mangled).
71  repeated string function_name = 3;
72
73}
74
75message VirtualThreadInfo {
76  optional uint32 tid = 1;
77  optional uint32 pid = 2;
78  optional string name = 3;
79}
80
81message ReportInfo {
82  repeated string config_name = 1;
83  optional string workload_cmd = 2;
84}
85
86message HiperfRecord {
87  oneof RecordType {
88    CallStackSample sample = 1;
89    SampleStatistic statistic = 2;
90    SymbolTableFile file = 3;
91    VirtualThreadInfo thread = 4;
92    ReportInfo info= 5;
93  }
94}
95