1/* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18 19package perfetto.protos; 20 21import "protos/perfetto/common/data_source_descriptor.proto"; 22 23// Reports the state of the tracing service. Used to gather details about the 24// data sources connected. 25// See ConsumerPort::QueryServiceState(). 26message TracingServiceState { 27 // Describes a producer process. 28 message Producer { 29 // Unique ID of the producer (monotonic counter). 30 optional int32 id = 1; 31 32 // Typically matches the process name. 33 optional string name = 2; 34 35 // Unix pid of the remote process. Supported only on Linux-based systems. 36 // Introduced in v24 / Android T. 37 optional int32 pid = 5; 38 39 // Unix uid of the remote process. 40 optional int32 uid = 3; 41 42 // The version of the client library used by the producer. 43 // This is a human readable string with and its format varies depending on 44 // the build system and the repo (standalone vs AOSP). 45 // This is intended for human debugging only. 46 optional string sdk_version = 4; 47 } 48 49 // Describes a data source registered by a producer. Data sources are listed 50 // regardless of the fact that they are being used or not. 51 message DataSource { 52 // Descriptor passed by the data source when calling RegisterDataSource(). 53 optional DataSourceDescriptor ds_descriptor = 1; 54 55 // ID of the producer, as per Producer.id. 56 optional int32 producer_id = 2; 57 } 58 59 message TracingSession { 60 // The TracingSessionID. 61 optional uint64 id = 1; 62 63 // The Unix uid of the consumer that started the session. 64 // This is meaningful only if the caller is root. In all other cases only 65 // tracing sessions that match the caller UID will be displayed. 66 optional int32 consumer_uid = 2; 67 68 // Internal state of the tracing session. 69 // These strings are FYI only and subjected to change. 70 optional string state = 3; 71 72 // The unique_session_name as set in the trace config (might be empty). 73 optional string unique_session_name = 4; 74 75 // The number and size of each buffer. 76 repeated uint32 buffer_size_kb = 5; 77 78 // Duration, as specified in the TraceConfig.duration_ms. 79 optional uint32 duration_ms = 6; 80 81 // Number of data sources involved in the session. 82 optional uint32 num_data_sources = 7; 83 84 // Time when the session was started, in the CLOCK_REALTIME domain. 85 // Available only on Linux-based systems. 86 optional int64 start_realtime_ns = 8; 87 } 88 89 // Lists all the producers connected. 90 repeated Producer producers = 1; 91 92 // Lists the data sources available. 93 repeated DataSource data_sources = 2; 94 95 // Lists the tracing sessions active AND owned by a consumer that has the same 96 // UID of the caller (or all of them if the caller is root). 97 // Introduced in v24 / Android T. 98 repeated TracingSession tracing_sessions = 6; 99 100 // This is always set to true from v24 and beyond. This flag is only used to 101 // tell the difference between: (1) talking to a recent service which happens 102 // to have no tracing session active; (2) talking to an older version of the 103 // service which will never report any tracing session. 104 optional bool supports_tracing_sessions = 7; 105 106 // Total number of tracing sessions. 107 optional int32 num_sessions = 3; 108 109 // Number of tracing sessions in the started state. Always <= num_sessions. 110 optional int32 num_sessions_started = 4; 111 112 // The version of traced (the same returned by `traced --version`). 113 // This is a human readable string with and its format varies depending on 114 // the build system and the repo (standalone vs AOSP). 115 // This is intended for human debugging only. 116 optional string tracing_service_version = 5; 117} 118