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 // Returns true if the process appears to be frozen (Android only). 49 // Introduced in Perfetto V49 / Android 24Q4. 50 optional bool frozen = 6; 51 } 52 53 // Describes a data source registered by a producer. Data sources are listed 54 // regardless of the fact that they are being used or not. 55 message DataSource { 56 // Descriptor passed by the data source when calling RegisterDataSource(). 57 optional DataSourceDescriptor ds_descriptor = 1; 58 59 // ID of the producer, as per Producer.id. 60 optional int32 producer_id = 2; 61 } 62 63 message TracingSession { 64 // The TracingSessionID. 65 optional uint64 id = 1; 66 67 // The Unix uid of the consumer that started the session. 68 // This is meaningful only if the caller is root. In all other cases only 69 // tracing sessions that match the caller UID will be displayed. 70 optional int32 consumer_uid = 2; 71 72 // Internal state of the tracing session. 73 // These strings are FYI only and subjected to change. 74 optional string state = 3; 75 76 // The unique_session_name as set in the trace config (might be empty). 77 optional string unique_session_name = 4; 78 79 // The number and size of each buffer. 80 repeated uint32 buffer_size_kb = 5; 81 82 // Duration, as specified in the TraceConfig.duration_ms. 83 optional uint32 duration_ms = 6; 84 85 // Number of data sources involved in the session. 86 optional uint32 num_data_sources = 7; 87 88 // Time when the session was started, in the CLOCK_REALTIME domain. 89 // Available only on Linux-based systems. 90 optional int64 start_realtime_ns = 8; 91 92 // The fields below have been introduced in v42. 93 94 // The bugreport_score, as set in TraceConfig.bugreport_score. 95 optional int32 bugreport_score = 9; 96 97 // As per TraceConfig.bugreport_filename. 98 optional string bugreport_filename = 10; 99 100 // If true, the session is in the STARTED state. If false the session is in 101 // any other state (see `state` field). 102 optional bool is_started = 11; 103 } 104 105 // Lists all the producers connected. 106 repeated Producer producers = 1; 107 108 // Lists the data sources available. 109 repeated DataSource data_sources = 2; 110 111 // Lists the tracing sessions active AND owned by a consumer that has the same 112 // UID of the caller (or all of them if the caller is root). 113 // Introduced in v24 / Android T. 114 repeated TracingSession tracing_sessions = 6; 115 116 // This is always set to true from v24 and beyond. This flag is only used to 117 // tell the difference between: (1) talking to a recent service which happens 118 // to have no tracing session active; (2) talking to an older version of the 119 // service which will never report any tracing session. 120 optional bool supports_tracing_sessions = 7; 121 122 // Total number of tracing sessions. 123 optional int32 num_sessions = 3; 124 125 // Number of tracing sessions in the started state. Always <= num_sessions. 126 optional int32 num_sessions_started = 4; 127 128 // The version of traced (the same returned by `traced --version`). 129 // This is a human readable string with and its format varies depending on 130 // the build system and the repo (standalone vs AOSP). 131 // This is intended for human debugging only. 132 optional string tracing_service_version = 5; 133} 134