148f512ceSopenharmony_ci// Copyright (c) 2021-2022 Huawei Device Co., Ltd. 248f512ceSopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License"); 348f512ceSopenharmony_ci// you may not use this file except in compliance with the License. 448f512ceSopenharmony_ci// You may obtain a copy of the License at 548f512ceSopenharmony_ci// 648f512ceSopenharmony_ci// http://www.apache.org/licenses/LICENSE-2.0 748f512ceSopenharmony_ci// 848f512ceSopenharmony_ci// Unless required by applicable law or agreed to in writing, software 948f512ceSopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS, 1048f512ceSopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1148f512ceSopenharmony_ci// See the License for the specific language governing permissions and 1248f512ceSopenharmony_ci// limitations under the License. 1348f512ceSopenharmony_ci 1448f512ceSopenharmony_ci// report_sample.proto format: 1548f512ceSopenharmony_ci// char magic[10] = "HIPERF_PB_"; 1648f512ceSopenharmony_ci// LittleEndian16(version) = 1; 1748f512ceSopenharmony_ci// LittleEndian32(sample_size) 1848f512ceSopenharmony_ci// message Record(sample) 1948f512ceSopenharmony_ci// LittleEndian32(sample_size) 2048f512ceSopenharmony_ci// message Record(sample) 2148f512ceSopenharmony_ci// ... 2248f512ceSopenharmony_ci// LittleEndian32(sample_size) 2348f512ceSopenharmony_ci// message Record(sample) 2448f512ceSopenharmony_ci// LittleEndian32(0) 2548f512ceSopenharmony_ci 2648f512ceSopenharmony_cisyntax = "proto2"; 2748f512ceSopenharmony_cioption optimize_for = LITE_RUNTIME; 2848f512ceSopenharmony_cipackage OHOS.Developtools.Hiperf.Proto; 2948f512ceSopenharmony_ci 3048f512ceSopenharmony_cimessage CallStackSample { 3148f512ceSopenharmony_ci optional uint64 time = 1; 3248f512ceSopenharmony_ci optional uint32 tid = 2; 3348f512ceSopenharmony_ci 3448f512ceSopenharmony_ci message CallStackFrame { 3548f512ceSopenharmony_ci // virtual address of the instruction in symbols file 3648f512ceSopenharmony_ci optional uint64 symbols_vaddr = 1; 3748f512ceSopenharmony_ci 3848f512ceSopenharmony_ci // index of index of SymbolTableFile::id, base from 0 3948f512ceSopenharmony_ci optional uint32 symbols_file_id = 2; 4048f512ceSopenharmony_ci 4148f512ceSopenharmony_ci // index of SymbolTableFile::symbol_name, base from 0 4248f512ceSopenharmony_ci // -1 means not found 4348f512ceSopenharmony_ci optional int32 function_name_id = 3; 4448f512ceSopenharmony_ci 4548f512ceSopenharmony_ci // loaded function base vaddr 4648f512ceSopenharmony_ci optional uint64 loaded_vaddr = 4; 4748f512ceSopenharmony_ci } 4848f512ceSopenharmony_ci 4948f512ceSopenharmony_ci repeated CallStackFrame callStackFrame = 3; 5048f512ceSopenharmony_ci 5148f512ceSopenharmony_ci // not include lost 5248f512ceSopenharmony_ci optional uint64 event_count = 4; 5348f512ceSopenharmony_ci 5448f512ceSopenharmony_ci // index of ReportInfo::config_name 5548f512ceSopenharmony_ci optional uint32 config_name_id = 5; 5648f512ceSopenharmony_ci} 5748f512ceSopenharmony_ci 5848f512ceSopenharmony_cimessage SampleStatistic { 5948f512ceSopenharmony_ci optional uint64 count = 1; 6048f512ceSopenharmony_ci optional uint64 lost = 2; 6148f512ceSopenharmony_ci} 6248f512ceSopenharmony_ci 6348f512ceSopenharmony_cimessage SymbolTableFile { 6448f512ceSopenharmony_ci // unique id , start from 0 6548f512ceSopenharmony_ci optional uint32 id = 1; 6648f512ceSopenharmony_ci 6748f512ceSopenharmony_ci // symbols file path, like developtools/hiperf/hiperf 6848f512ceSopenharmony_ci optional string path = 2; 6948f512ceSopenharmony_ci 7048f512ceSopenharmony_ci // function symbol table of the file (always mangled). 7148f512ceSopenharmony_ci repeated string function_name = 3; 7248f512ceSopenharmony_ci 7348f512ceSopenharmony_ci} 7448f512ceSopenharmony_ci 7548f512ceSopenharmony_cimessage VirtualThreadInfo { 7648f512ceSopenharmony_ci optional uint32 tid = 1; 7748f512ceSopenharmony_ci optional uint32 pid = 2; 7848f512ceSopenharmony_ci optional string name = 3; 7948f512ceSopenharmony_ci} 8048f512ceSopenharmony_ci 8148f512ceSopenharmony_cimessage ReportInfo { 8248f512ceSopenharmony_ci repeated string config_name = 1; 8348f512ceSopenharmony_ci optional string workload_cmd = 2; 8448f512ceSopenharmony_ci} 8548f512ceSopenharmony_ci 8648f512ceSopenharmony_cimessage HiperfRecord { 8748f512ceSopenharmony_ci oneof RecordType { 8848f512ceSopenharmony_ci CallStackSample sample = 1; 8948f512ceSopenharmony_ci SampleStatistic statistic = 2; 9048f512ceSopenharmony_ci SymbolTableFile file = 3; 9148f512ceSopenharmony_ci VirtualThreadInfo thread = 4; 9248f512ceSopenharmony_ci ReportInfo info= 5; 9348f512ceSopenharmony_ci } 9448f512ceSopenharmony_ci} 95