| /* |
| * Copyright (C) 2016 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. |
| */ |
| syntax = "proto3"; |
| |
| package profiler.proto; |
| option java_package = "com.android.tools.profiler.proto"; |
| option java_outer_classname = "Profiler"; |
| |
| import "common.proto"; |
| |
| service ProfilerService { |
| // Start a new session. As a side effect, this also starts all profilers for |
| // the PID being targeted by this session. |
| // If a session with the same PID is already running, this method will |
| // essentially be a no-op (except it will move the session to the top of the |
| // sorted-by-recency list). |
| rpc BeginSession(BeginSessionRequest) returns (BeginSessionResponse) { |
| } |
| |
| // Stop a target session (if currently running). As a side effect, |
| // this also stops all profilers for the PID being targeted by this session. |
| rpc EndSession(EndSessionRequest) returns (EndSessionResponse) { |
| } |
| |
| // Import a session |
| rpc ImportSession(ImportSessionRequest) returns (ImportSessionResponse) { |
| } |
| |
| // Request a session's meta data by ID. |
| // Metadatas are only used on Studio-side to retrieve display-related info. |
| rpc GetSessionMetaData(GetSessionMetaDataRequest) |
| returns (GetSessionMetaDataResponse) { |
| } |
| |
| // Requests all sessions in the time range from |start_timestamp| (exclusive) |
| // to |end_timestamp| (inclusive), or mathematically written as the interval |
| // (start_timestamp, end_timestamp]. Results will be returned ordered by |
| // recency (most recent first). |
| rpc GetSessions(GetSessionsRequest) returns (GetSessionsResponse) { |
| } |
| |
| // Delete a session by ID. If it is currently running, |EndSession| will |
| // automatically be called on it. |
| rpc DeleteSession(DeleteSessionRequest) returns (DeleteSessionResponse) { |
| } |
| } |
| |
| message BeginSessionRequest { |
| message JvmtiConfig { |
| // True if an jvmti agent should be attached, false otherwise. |
| bool attach_agent = 1; |
| // TODO(b/65458869): Remove when moving process discovery to perfd. |
| string agent_lib_file_name = 2; |
| // Path to the agent config file |
| string agent_config_path = 3; |
| // True if live allocation is used, false otherwise. |
| bool live_allocation_enabled = 4; |
| } |
| |
| int64 device_id = 1; |
| int32 pid = 2; |
| JvmtiConfig jvmti_config = 3; |
| int64 request_time_epoch_ms = 4; |
| string session_name = 5; |
| // See SdkConstans.CPU_ARCH_* |
| string process_abi = 6; |
| } |
| |
| message BeginSessionResponse { |
| Session session = 1; |
| } |
| |
| message EndSessionRequest { |
| int64 session_id = 1; |
| // TODO remove when device_id can be queried from |
| // session_id on Studio-side. |
| int64 device_id = 2; |
| // TODO this is a stopgap measure to set the session's |
| // end timestamp if the device has been disconnected, |
| // and we have to set the end timestamp from Studio-side. |
| int64 end_timestamp = 3; |
| } |
| |
| message EndSessionResponse { |
| Session session = 1; |
| } |
| |
| message ImportSessionRequest { |
| Session session = 1; |
| string session_name = 2; |
| int64 start_timestamp_epoch_ms = 3; |
| SessionMetaData.SessionType sessionType = 4; |
| } |
| |
| message ImportSessionResponse { |
| enum Status { |
| UNSPECIFIED = 0; |
| SUCCESS = 1; |
| FAILURE = 2; |
| } |
| Status status = 1; |
| } |
| |
| message GetSessionMetaDataRequest { |
| // This is expected to be a valid session's id, otherwise a |
| // a default GetSessionMetaDataResponse instance will be returned. |
| int64 session_id = 1; |
| } |
| |
| message GetSessionMetaDataResponse { |
| SessionMetaData data = 1; |
| } |
| |
| message GetSessionsRequest { |
| int64 start_timestamp = 1; |
| int64 end_timestamp = 2; |
| } |
| |
| message GetSessionsResponse { |
| repeated Session sessions = 1; |
| } |
| |
| message DeleteSessionRequest { |
| int64 session_id = 1; |
| } |
| |
| message DeleteSessionResponse { |
| } |