• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2021 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
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 single_file_max_size_mb = 9; // limit the maximum size of a single file
61}
62
63message CreateSessionRequest {
64    uint32 request_id = 1;
65    ProfilerSessionConfig session_config = 2;
66    repeated ProfilerPluginConfig plugin_configs = 3;
67}
68
69message CreateSessionResponse {
70    uint32 status = 1;
71    uint32 session_id = 2;
72    repeated ProfilerPluginState plugin_status = 3;
73}
74
75// for StartSession
76message StartSessionRequest {
77    uint32 request_id = 1;
78    uint32 session_id = 2;
79    repeated ProfilerPluginConfig update_configs = 3;
80}
81
82message StartSessionResponse {
83    uint32 status = 1;
84    repeated ProfilerPluginState plugin_status = 3;
85}
86
87// for FetchData
88message FetchDataRequest {
89    uint32 request_id = 1;
90    uint32 session_id = 2;
91    bytes addtion_data = 3;
92}
93
94message FetchDataResponse {
95    uint32 status = 1;
96    uint32 response_id = 2;
97    bool has_more = 3;
98    repeated ProfilerPluginData plugin_data = 4;
99}
100
101// for StopSession
102message StopSessionRequest {
103    uint32 request_id = 1;
104    uint32 session_id = 2;
105}
106
107message StopSessionResponse {
108    uint32 status = 1;
109    repeated ProfilerPluginState plugin_status = 3;
110}
111
112// for DestroySession
113message DestroySessionRequest {
114    uint32 request_id = 1;
115    uint32 session_id = 2;
116}
117
118message DestroySessionResponse {
119    uint32 status = 1;
120    repeated ProfilerPluginState plugin_status = 3;
121}
122
123// for KeepSession
124message KeepSessionRequest {
125    uint32 request_id = 1;
126    uint32 session_id = 2;
127    uint32 keep_alive_time = 3;
128}
129
130message KeepSessionResponse {
131    uint32 status = 1;
132}
133