blob: 9fed2d09a3d9414a71fe7c20e39098e65016db7b [file] [log] [blame]
/*
* 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 = "Agent";
import "memory.proto";
import "common.proto";
service AgentService {
// A simple ping mechanism to notify perfd of the agent's existence, vice
// versa.
rpc HeartBeat(HeartBeatRequest) returns (HeartBeatResponse) {}
rpc SendEvent(SendEventRequest) returns (EmptyResponse) {}
rpc SendPayload(SendPayloadRequest) returns (EmptyResponse) {}
}
message HeartBeatRequest {
// The process' id. Note that the agent's pid is the same as the pid we use
// for the heartbeat because the agent resides within the process being
// profiled.
int32 pid = 1;
}
message HeartBeatResponse {}
message SendEventRequest {
// The event. It contains the id of the process that generated the Event.
Event event = 1;
}
message SendPayloadRequest {
// string id of the payload (e.g. file name)
string name = 1;
// byte content of the payload.
bytes payload = 2;
// whether the data is partial and more content should be expected
bool is_partial = 3;
}
// TODO b/120504084 replace with google.protobuf.empty
// Currently there are multiple locations where the well known protos
// exists in our codebase. One inside our prebuilt maven repo, the other
// one in the external protobuf repo. For some reason it is not as simple
// as including @protobuf_repo//:well_known_protos in cc_grpc_proto_library
// rule, so more investigation is needed.
message EmptyResponse {}
enum SocketType {
UNSPECIFIED_SOCKET = 0;
ABSTRACT_SOCKET = 1;
}
// Proto used for configuring perfd + perfa.
// The message itself is created and pushed to device from Studio
// and can be access via profiler::Config::Instance().
message AgentConfig {
message MemoryConfig {
// equivalent to profiler.livealloc flag in Studio.
bool use_live_alloc = 1;
// the maximum depth of allocation stack traces to record.
int32 max_stack_depth = 2;
// Enable tracking of creation and deletion of globla JNI references.
bool track_global_jni_refs = 3;
// Path to the app dir: usually /data/app/
string app_dir = 4;
// The allocation sampling rate to use when starting a profiling session.
AllocationSamplingRate sampling_rate = 5;
}
message CpuConfig {
// Waiting time in Seconds for ART when stopping the ongoing ART profiling.
int32 art_stop_timeout_sec = 1;
// equivalent to StudioFlags.PROFILER_SIMPLEPERF_HOST
bool simpleperf_host = 2;
}
MemoryConfig mem_config = 1;
// Which socket type we are using when setting up our service
// if the device is O+ we use service_socket_name and
// ABSTRACT_SOCKET. If the device is pre O we use
// UNSPECIFIED_SOCKET and use the service_address.
SocketType socket_type = 2;
// address used for legacy devices (Nougat or older).
string service_address = 3;
// address used for jvmti devices that use unix sockets.
string service_socket_name = 4;
// equivalent to StudioFlags.PROFILER_ENERGY_PROFILER_ENABLED.
bool energy_profiler_enabled = 6;
// equivalent to StudioFlags.PROFILER_CPU_API_TRACING.
bool cpu_api_tracing_enabled = 7;
// Android API level as defined in com.android.sdklib.AndroidVersion.
int32 android_feature_level = 8;
CpuConfig cpu_config = 9;
// equivalent to StudioFlags.PROFILER_UNIFIED_PIPELINE
bool unified_pipeline = 10;
}