1// Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. 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 14syntax = "proto3"; 15 16option java_package = "ohos.devtools.datasources.transport.grpc.service"; 17 18import "common_types.proto"; 19 20// Message define for profiler service, imported by profiler service proto file. 21// for GetCapabilities 22message GetCapabilitiesRequest { 23 uint32 request_id = 1; 24} 25 26message ProfilerPluginCapability { 27 string path = 1; 28 string name = 2; 29} 30 31message GetCapabilitiesResponse { 32 uint32 status = 1; 33 repeated ProfilerPluginCapability capabilities = 2; 34} 35 36 37// for CreateSessionRequest 38message ProfilerSessionConfig { 39 message BufferConfig { 40 enum Policy { 41 RECYCLE = 0; 42 FLATTEN = 1; 43 }; 44 uint32 pages = 1; 45 Policy policy = 2; 46 } 47 repeated BufferConfig buffers = 1; 48 49 enum Mode { 50 OFFLINE = 0; // save all plugin results to result file. 51 ONLINE = 1; // push all plugin results to host PC with streamed FetchDataResponse. 52 }; 53 Mode session_mode = 2; 54 string result_file = 3; // for OFFLINE mode, result file path 55 uint32 result_max_size = 4; // for OFFLINE mode, result file max size in KB 56 uint32 sample_duration = 5; // for OFFLINE mode, sample duration in ms 57 uint32 keep_alive_time = 6; // if set to non-zero value, session will auto-destroyed after CreateSession in ms 58 bool discard_cache_data = 7; // if set true, session will stop immediately.(cache data will be lost) 59 bool split_file = 8; // if set true, will split result_file 60 uint32 split_file_max_size_mb = 9; // limit the maximum size of a single split file, min size is 200Mb 61 uint32 split_file_max_num = 10; // limit the split file max num, default is 10 62} 63 64message CreateSessionRequest { 65 uint32 request_id = 1; 66 ProfilerSessionConfig session_config = 2; 67 repeated ProfilerPluginConfig plugin_configs = 3; 68} 69 70message CreateSessionResponse { 71 uint32 status = 1; 72 uint32 session_id = 2; 73 repeated ProfilerPluginState plugin_status = 3; 74} 75 76// for StartSession 77message StartSessionRequest { 78 uint32 request_id = 1; 79 uint32 session_id = 2; 80 repeated ProfilerPluginConfig update_configs = 3; 81} 82 83message StartSessionResponse { 84 uint32 status = 1; 85 repeated ProfilerPluginState plugin_status = 3; 86} 87 88// for FetchData 89message FetchDataRequest { 90 uint32 request_id = 1; 91 uint32 session_id = 2; 92 bytes addtion_data = 3; 93} 94 95message FetchDataResponse { 96 uint32 status = 1; 97 uint32 response_id = 2; 98 bool has_more = 3; 99 repeated ProfilerPluginData plugin_data = 4; 100} 101 102// for StopSession 103message StopSessionRequest { 104 uint32 request_id = 1; 105 uint32 session_id = 2; 106} 107 108message StopSessionResponse { 109 uint32 status = 1; 110 repeated ProfilerPluginState plugin_status = 3; 111} 112 113// for DestroySession 114message DestroySessionRequest { 115 uint32 request_id = 1; 116 uint32 session_id = 2; 117} 118 119message DestroySessionResponse { 120 uint32 status = 1; 121 repeated ProfilerPluginState plugin_status = 3; 122} 123 124// for KeepSession 125message KeepSessionRequest { 126 uint32 request_id = 1; 127 uint32 session_id = 2; 128 uint32 keep_alive_time = 3; 129} 130 131message KeepSessionResponse { 132 uint32 status = 1; 133} 134