Get desktop application:
View/edit binary Protocol Buffers messages
A simple ping mechanism to notify perfd of the agent's existence, vice versa.
(message has no fields)
Checks whether an app is being profiled using StartProfilingApp and StopProfilingApp calls in this service at a given moment, assuming no other means have been used to start or stop profiling the app (such as 'am' command line tool or through DDMS).
The given moment that this request is querying about.
True means the app in the request is being profiled by an earlier StartProfilingApp call that's successful, and a subsequent StopProfilingApp call hasn't happened.
The timestamp when the profiling started if the app is being profiled.
The timestamp when the profiling state was checked.
Requests profiler data from the app with ID being |process_id|, in the time range from |start_timestamp| (exclusive) to |end_timestamp| (inclusive), or mathematically written as in interval (start_timestamp, end_timestamp].
Use |ANY_APP| if requesting the data of any apps.
Use -2^63 if no data is too old to return.
Use 2^63 - 1 if no data is too recent to return.
Requests the state of all the threads in the given time range.
Threads with activities detected during the request range, ordered by thread id.
The snapshot of threads that were alive at the beginning of the range.
Trace ID should be unique within an app.
Type of the profiler used to obtain the trace.
Requests all the traces that overlap with a time range.
inclusive
inclusive
This RPC is implemented by perfd-host only.
(message has no fields)
Starts collecting execution metrics of a running app, such as usage info and thread states. Does nothing if the app is already being monitored. TODO(b/29258733): Support configuring sampling details.
Starts recording app stacktraces of a running app. Does nothing if the app is already being profiled with SimplePerf. Returns an error if the app is already being profiled with ART.
Returns the status and absolute path location (on device) where the trace file will be written.
Stops monitoring a running app. Does nothing if the app is not being monitored, or is not running.
Stops recording app stacktraces of a running app. Does nothing if the app is not being profiled, or is not running.
Request profiling of app (identified by its process id |process_id|) to stop.
Trace ID should be unique within an app.
TODO: remove this trace attribute after fully migrating to the new API.
Requests profiler data from the app with ID being |process_id|, in the time range from |start_timestamp| (exclusive) to |end_timestamp| (inclusive), or mathematically written as in interval (start_timestamp, end_timestamp].
Use -2^63 if no data is too old to return.
Returns graphics data from the monitored Activity. This will return no data for Activities that do not use a SurfaceView.
Requests graphics data from the app's Activity, in the time range from |start_timestamp| (exclusive) to |end_timestamp| (inclusive), or mathematically written as in interval (start_timestamp, end_timestamp].
Use -2^63 if no data is too old to return.
Use 2^63 - 1 if no data is too recent to return.
Response contains data on the frames rendered within the requested time.
Starts collecting execution metrics of a running app's SurfaceView Activity, such as frame stats. Does nothing if the app is already being monitored.
Stops monitoring a running app. Does nothing if the app is not being monitored.
Simple RPC service to send data to perfd. As events fire are triggered from the application. They will be sent to perfd and cached via this RPC.
Register a memory agent in perfd and open a stream where perfd can send control requests to the agent.
HTTP request registration data, used to communicate with perfd that a new request was just created. This also notifies the system that we are using a unique ID value to represent this request from now on in future GRPC messages associated with this connection.
A small chunk of a body of data large enough that we want to stream it in pieces instead of all at once.
An tracking message for an important moment in the lifetime of an HTTP request.
Request data of HTTP connection.
Header fields associated with this request. See also: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields.
Response data of HTTP connection.
Header fields associated with this response. See also: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_fields.
Get all sampled I/O data for an app. These include files opened, amount of bytes read/written.
exclusive
inclusive
Starts collecting I/O data of a running app. Does nothing if the app is already being monitored.
Stops monitoring a running app. Does nothing if the app is not being monitored, or is not running.
(message has no fields)
O+ studio-side only: Grabs the allocation classes and callstack info for GetAllocations results.
O+ studio-side only: Mirrors GetLegacyAllocationEvents but for O+ data. This returns a snapshot of all objects that have been allocated and free_data within the request's start and end times. Note that if an object is allocated and collected within the time range, it would not be included in the result.
The start time (id) of the tracking session from which allocation data should be returned.
inclusive;
NOTE that compared to other proto request, end_time here is exclusive as ongoing live instances are set to have a free_timestamp of Long.MAX_VALUE. This allows us to naturally query for all current live instances by passing in MAX_VALUE as the end_time, without having to special case an invalid duration value.
exclusive;
Get all memory data not related to live allocation for an app within a specified time request. These include the various memory levels, allocation count + gc events.
Get live allocation memory data for an app within a specified time request. These includes alloc events, dealloc events and callstacks
Pre-O only: Returns class names and callstacks info associated with the ids provided in the request.
Pre-O only: Used by Studio only for exporting legacy tracking data.
Pre-O only: Returns all allocation data associated with a tracking session.
exclusive
inclusive
O+ studio-side only: Fetches the class + method names associated with a |method_id| within a tracking session.
List all heap dump records for an app within a specified time request.
exclusive
inclusive
Post-O only: Resume allocation tracking when switching back. This call will retrieve class data from beginning and enable allocation callbacks.
Post-O only: Suspend allocation tracking when switching to another session to optimize the performance. This call will disable allocation callbacks and clear the event queue.
Enable or disable an allocation tracking session. Note that for pre-O, this call is handled on Studio side within the proxy layer, and allocation records are fetched upon the completion of a tracking session. For O+, this toggles live allocation tracking within the app, and allocation data is returned while the session is in progress.
Requests whether an allocation tracking session is to be enabled/disabled. If a session is already in progress, re-enabling it does nothing, this is also true for disabling a session when no tracking is in progress.
A flag to indicate whether the request is initiated via the legacy allocation tracking path. On pre-O setups, legacy tracking would simply mark the start and end times of a session. On O+ setups, perfd + the agent would perform allocation tracking.
Returns the HeapDumpInfo immediately so the caller can optionally track its completion
Requests profiler data from the app with ID being |process_id|, in the time range from |start_timestamp| (exclusive) to |end_timestamp| (inclusive), or mathematically written as in interval (start_timestamp, end_timestamp].
Gets misc metadata about a http request, given its |conn_id| and a |HttpDetailsRequest::Type|. Use |GetHttpRange| to get this ids.
Message for querying metadata about an HTTP connection (by ID). Note that if the user queries details before they are ready, they will all be set to their default values (e.g. 0, empty string, etc.). TODO: Consider adding an error boolean if client queries at the wrong time. Is it necessary / helpful?
Returns a list of HTTP requests active over some given time range. See the HttpRangeRequest message for more details. Note: HTTP requests may live across time ranges, so the same instances may be returned across multple calls to this rpc.
Request to fetch all http connections that were alive between some time range. Given a range [start, end] and requests a-f... start end a: [===========|===============|=========... b: [=======] | | c: [===|===] | d: | [=======] | e: | [===|===] f: | | [=======] Keep a, c, d, and e; exclude b and f The time range match is inclusive, so requests ending on time |start| and requests starting on time |end| will be included in the results.
Starts collecting execution metrics of a running app, such as received and transmitted states. Does nothing if the app is already being monitored.
TODO: Dig more about network collector start response.
(message has no fields)
Stops monitoring a running app. Does nothing if the app is not being monitored, or is not running.
TODO: Dig more about network collector stop response.
(message has no fields)
TODO: This is temporary, remove when moving process discovery.
Query for whether the agent is alive.
The last time a heartbeat was received from the requested agent. If no heartbeat was ever detected, this returns INT64_MIN.
Query for cached byte data associated with some ID. Other services may return an ID which can be used to fetch data using this central cache.
ID for fetching contents from a cache. The value will always be safe to use as a filename, if you want to cache the contents locally to disk for example.
Byte contents from a cache, or "" if no data was found associated with the cache key used to fetch it, or if the data was removed after some timeout.
Gets current timestamp that used in the device's profiling data. A client may use this API to relate profiling data' timestamps to other clocks such as the desktop's calendar time. TODO(b/29223899): Add device's calendar time.
What's used as timestamps in all profiler data (unless otherwise specified). (a.k.a: Timestamp from clock_gettime(CLOCK_MONOTONIC, ...), ns precision.)
The number of microseconds since the Epoch. (a.k.a: Timestamp from gettimeofday, us precision.)
Gets the currently connected devices. TODO: expand with timing information for historical requests.
(message has no fields)
Gets the running processes of a given device TODO expand with timing information for historical requests.
Gets version.
Used as request type in: InternalEventService.SendActivity
Used as field type in:
Name of the activity
Unique hash identifying this activity from similarly named ones.
Application Id this activity is associated with.
State changes for activities and fragments.
TODO: Expand this to a oneof if more components need to add specific information. Additional data needed by specific UI components
Used in:
Used in:
Used in:
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().
equivalent to profiler.jvmti flag in Studio
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.
address used for legacy devices (Nougat or older).
address used for jvmti devices that use unix sockets.
Used in:
equivalent to profiler.livealloc flag in Studio.
the maximum depth of allocation stack traces to record.
Used in:
Used in: ,
Used as response type in: MemoryService.GetAllocationContexts, MemoryService.GetLegacyAllocationContexts
O+ only. Records the timestamp of the latest class/stack entry returned by the response.
O+ only. All seen thread Ids -> Strings mapping
Proto format for handling O+ allocation data.
Used in:
If it is an allocation event, this marks the exact time when the alloc happens. If it is a deallocation event, this should match the last gc end time.
Special case for java/lang/Class object allocations. Note that a Klass event is expected to precede any Allocation which references its class via the class_tag field.
Used in:
Length for array objects. For non-arrays, set to -1.
Profiler-generated Id representing a thread. Valid id starts at 1 as 0 is used as a default no-value.
Profiler-Id representing the allocation stack. Valid id starts at 1 as 0 is used as a default no-value.
Which heap an object was allocated from. The id's are manually mapped to their corresponding names in Studio (e.g. Zygote vs App).
Entire list of methods corresponding to the allocation stack. Note that this is only used for temporary storage in perfa. When the data is sent from perfa->perfd, the list is encoded as |stack_id| above, and the encoded data is stored/sent separately using EncodedAllocationStack. First entry is top of stack.
Similar to |method_ids| above, this is only for temporary storage. The actual converted line numbers are stored/sent to studio via EncodedAllocationStack.
Temporary storage in perfa only. The thread info will be encoded into |thread_id| before transfer from perfa->perfd. The thread id -> name mapping is sent separately via ThreadInfo messages.
Used in:
The following are host/client-side only (e.g. Studio-only).
Length for array objects. For non-arrays, set to -1.
Thread + Stack Id of the allocation of the same object.
Proto format for handling stack data for both pre-O and O+.
Used in:
studio-side only - a smaller proto format to store lazy- loaded stack frame objects. This is used specifically for showing live allocation tracking data (O+ JVMTI), where an app can run up to 2M+ unique frames. Given proto objects do not support null values, each string field in StackFrame holds default values that can add up to hundreds of MBs for these apps.
Used in:
Wrapper proto for SmallFrame since oneof does not support repeated fields.
Used in:
Used in: ,
O+ only for uniquely idenfitying a method.
Pre-O only. File name info is unavailable in JVMTI. TODO: investigate/feature request.
Wrapper proto for StackFrame since oneof does not support repeated fields.
Used in:
Proto for describing an allocation tracking record. Simliar to HeapDumpInfo, an AllocationsInfo is returned if either the start_time or end_time falls within the requested time window. It is the responsibility of the requester to dedupe a completed info if there was an unfinished info that was previously sent.
Used in: ,
Used in:
Enum with default value required by proto
Indicates that a feature is not tied to any single app
Batched AllocationEvents to minimize number of grpc calls compared to transferring them individually.
Used as request type in: InternalMemoryService.RecordAllocationEvents
Used as response type in: MemoryService.GetAllocations
Used as field type in:
From Perfa->Perfd and Perfd->Studio, this marks the time(ns) when the sample was first created in the agent. Within Studio, this indicates the latest timestamp amongst the events list.
The following fields are used for transfering stack info from device to studio only. Within studio, stack info are retrieved via GetAllocationContexts.
Used in:
This is a chunk of a request (uploaded) body
This is a chunk of a response (downloaded) body
TODO: Add more essential fields.
Used as request type in: AgentService.HeartBeat
Used as field type in: , , , ,
Used in:
Used in:
Used in:
Used in:
The radio is in a high-energy state, having recently sent out some network traffic
The radio is in a low-energy state, having powered down after a period of inactivity.
Set to 3 for backwards-compatibility reasons
Protobuf requires the first enum value to be zero.
A speical value used in |process_id| field to indicate the data of all apps are requested.
CPU data of a given app process.
Used in:
Used in: , , ,
Request profiling of app (identified by its process id |process_id|) to start. INSTRUMENTED is support only when ART is the profiler.
Used as request type in: CpuService.StartProfilingApp
Used as field type in:
When using ART, the size of the in-memory buffer that holds tracing data.
When using sampling, the sampling interval in microseconds.
Used in:
Used in:
Used in:
Used in:
Used in:
CPU usage data of an app process and the entire system at a given point. CPU usage data is most valuable when app data is combined with system data, e.g., showing the CPU usage percentage number. One data consumer (e.g., an Android Studio instance) would request an app's data, and another consumer (e.g., another Android Studio instance) would request another app's. Both of them need system data. Therefore, we put system data together with every piece of app specific data. The absolute values of fields in this message are not very interesting. The difference of two instances is more useful. It can show the system- wide CPU utilization percentage and an app's CPU utilization percentage. The values of the fields may overflow their type, but the usefulness stays the same.
Used in:
Amount of time that this process has been using CPU, measured in milliseconds.
Amount of time that the entire system (including applications) has been using CPU, measured in milliseconds.
Amount of time since the system start, measured in milliseconds.
Used in: ,
e.g. 'Google', 'Motorola'
e.g. 'Nexus 5', 'Pixel XL'
unique ID for this device
e.g. '5.1.1', '8.0.0'
e.g. 19, 25
Identifies preview versions by API letter (e.g. 'O'), or '' for release
|feature_level| will either be the same as |api_level| or |api_level + 1| if the current device is a preview version. Code should check against |feature_level|, not |api_level|, to see if a feature is available in the framework or not. If |feature_level != api_level|, then |codename| will also be set.
unique ID regenerated each boot time
Used in:
e.g. emulator that is turned off
e.g. unplugged
Used as request type in: MemoryService.GetHeapDump, MemoryService.GetLegacyAllocationDump
Used as response type in: MemoryService.GetHeapDump, MemoryService.GetLegacyAllocationDump
Used in:
Used as response type in: InternalEventService.SendActivity, InternalEventService.SendSystem
(message has no fields)
Used as response type in: InternalMemoryService.RecordAllocStats, InternalMemoryService.RecordAllocationEvents, InternalMemoryService.RecordGcStats
(message has no fields)
Used as response type in: InternalNetworkService.RegisterHttpData, InternalNetworkService.SendChunk, InternalNetworkService.SendHttpEvent, InternalNetworkService.SendHttpRequest, InternalNetworkService.SendHttpResponse, InternalNetworkService.TrackThread
(message has no fields)
Proto format for storing and transmitting O+ stack data efficiently. The |stack_id| field uniquely identifies a stack within an app, each |method_id| is referenced by AllocationStack.StackFrame which contains detailed info about the method.
Used in:
The time when this stack was first seen. It should match the first AllocationEvent::Allocation that generated the stack.
Used as request type in: EventService.GetActivityData, EventService.GetSystemData
Used in:
All types of data are requested.
All system level events, touch, rotate, button presses ect...
All activity level events, created, activated, resumed, suspended ect...
All fragment events
Used in:
Used in:
Used in:
Framestats of a SurfaceView frame.
Used in:
The app draw timestamp in nanoseconds (when the app started to draw)
The vsync timestamp in nanoseconds immediately after SF submited the frame to the h/w
The timestamp in nanoseconds immediately after SF submitted the frame to the h/w
Used in: ,
TODO: unify with Thread
Used in:
Used in:
Snapshot of the threads that were alive at a given moment.
Used in:
Used in:
TODO: add more status as needed.
Used in:
Used in:
Used in:
Used in:
Graphics data of a SurfaceView frame.
Used in:
Used in:
Used in:
Proto for describing a heap dump record. A HeapDumpInfo is returned if either the start_time or end_time falls within the requested time window. e.g. An info can be returned across multiple requests: 1. When a heap dump is first triggered with start_time specified. 2. When the heap dump completes/fails with end_time specified. It is the responsibility of the requester to dedupe a completed info if there was an unfinished info that was previously sent.
Used in: , ,
An HTTP connection represents the full lifetime of a single HTTP request / response network communication.
Used in:
A unique identifer used to fetch any further details about this request. This id is guaranteed unique across all actively running apps.
Always set. Time this network request was first opened.
If not 0, time when the first byte was received. Always > start.
If not 0, time when request was closed. Always > start.
Used in:
Metadata about a sent request. This data can be queried as soon as you have a connection ID to fetch it.
Metadata about a received response. This data can be safely be queried for any connection that has its end_timestamp set to a non-zero value. (Otherwise, all the fields in the returned details will be empty) TODO: This detail type is not yet implemented.
Fetch a path to the request body which can then be fetched over adb. TODO: This detail type is not yet implemented.
Fetch a handle to the response body which can be fetched over adb. This data can be safely queried for any connection that has its end_timestamp set to a non-zero value. TODO: Can this type be combined with RESPONSE? Will reponse details be available before this is ready, or only at the same time?
Fetch accessed threads of a connection. This data can be queried as soon as you have a connection ID, however as a different thread may be added during the lifetime of the connection, it's advised to repeat the request when its end_timestamp is a non-zero value.
Used in:
Threads that access a connection. The first thread is the thread that creates the connection.
Used in:
An ID which will uniquely identify the contents of an http body. It can be used to fetch payload bytes via |ProfilerService.GetBytes|. This value will be a hash of the contents, and the same hash always indicates the same contents. This hash value calculation is independent of app, device, etc., and can always* be relied upon to indicate content equality. (*) with negligible probability of a collision Looks something like: "d652e629bcf87c998c614"
Used in:
The request's method, e.g. GET, PUT, POST, etc.
Key/value pairs associated with the request
Code stack trace for where this request was generated
Used in:
Response code, e.g. OK, 404, etc.
Key/value pairs associated with the response
Used in:
Contains for each file operated on in this period, when it was opened, closed, written to or read from.
Used in:
A FileSession represents a session of operating on a file from when it was opened until it is closed. e.g. {open, read, read, write, read, close}
Used in:
Timestamp of opening the file
Timestamp of closing the file or FUTURE if it's not closed yet
Corresponds to a single write/read system call
Used in:
Timestamp when the system call started
Timestamp when the system call ended or FUTURE if it hasn't yet
Amount of bytes read or written
has already happened at the serving time but the timestamp is not known to the I/O profiler
hasn't happened yet at the serving time
Used in:
Contains the current overall speed of writing/reading
Used in:
The speed of writing/reading in bytes/second
Used in:
Used in: ,
Used in:
Used in:
Thread information obtained from Java, which is different from the thread data we would obtain from a JNI context. See also: https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html
Used in: ,
ID of the thread obtained from Java, which is different from the thread ID obtained in a JNI context.
Name of the thread. https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#getName().
Used in:
capture_time associates with a particular tracking session. TODO: include endTime for de-allocation tracking
Used in:
Used in:
Used in:
Used in:
(message has no fields)
Used in:
(message has no fields)
Used as response type in: MemoryService.GetData, MemoryService.GetJvmtiData
end timestamp after which values are yet to be queried for
Used in: ,
Used in: ,
TODO add deallocation stats
Used in:
Used as request type in: MemoryService.GetData, MemoryService.GetJvmtiData
exclusive
inclusive
Used in:
Used in:
First enum value is required to be zero.
process_id field special value, it means these data is applicable to any app.
Used in:
All types of network data are requested.
Default network type (wifi or mobile) and radio power state. This data is device-wide and the same values will be returned across all valid |process_id| values.
Network transmitted and received speeds (in bytes / sec).
Number of open connections.
Used in:
Used in: ,
Used in:
Used in:
Used in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Used in:
TODO: Break these up into their own messages (since tx and rx speeds can have unique timestamps), unless the error we get by combining them in the same message ends up being too subtle to matter
Used in:
bytes / sec
bytes / sec
Used in:
TODO: Add support for KeyEvents, and ButtonEvents. The current setup allows for only touch.
Used as request type in: InternalEventService.SendSystem
Used as field type in:
This field stores actions triggered by an event. Actions are defined in MotionEvent.java. https://developer.android.com/reference/android/view/MotionEvent.html
Each system event message is associated with one event type.
Used in:
Used in:
Proto format for storing and transmitting O+ thread data. JVMTI provides an API to get a thread's name but not id. To avoid sending too much duplicated string datas, we encode thread names to id manually and resolve them on Studio-side.
Used in: ,
The time when this thread was first seen. It should match the first AllocationEvent::Allocation that generated the stack.
A TraceInfo contains the information regarding a trace and should be returned if its time overlaps with the one defined in a GetTraceInfoRequest.
Used in: ,
inclusive
inclusive
These threads are those having data captured by the designated trace.
Used in:
Used in: