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 // The fields below have been introduced in v42. 89 90 // The bugreport_score, as set in TraceConfig.bugreport_score. 91 optional int32 bugreport_score = 9; 92 93 // As per TraceConfig.bugreport_filename. 94 optional string bugreport_filename = 10; 95 96 // If true, the session is in the STARTED state. If false the session is in 97 // any other state (see `state` field). 98 optional bool is_started = 11; 99 } 100 101 // Lists all the producers connected. 102 repeated Producer producers = 1; 103 104 // Lists the data sources available. 105 repeated DataSource data_sources = 2; 106 107 // Lists the tracing sessions active AND owned by a consumer that has the same 108 // UID of the caller (or all of them if the caller is root). 109 // Introduced in v24 / Android T. 110 repeated TracingSession tracing_sessions = 6; 111 112 // This is always set to true from v24 and beyond. This flag is only used to 113 // tell the difference between: (1) talking to a recent service which happens 114 // to have no tracing session active; (2) talking to an older version of the 115 // service which will never report any tracing session. 116 optional bool supports_tracing_sessions = 7; 117 118 // Total number of tracing sessions. 119 optional int32 num_sessions = 3; 120 121 // Number of tracing sessions in the started state. Always <= num_sessions. 122 optional int32 num_sessions_started = 4; 123 124 // The version of traced (the same returned by `traced --version`). 125 // This is a human readable string with and its format varies depending on 126 // the build system and the repo (standalone vs AOSP). 127 // This is intended for human debugging only. 128 optional string tracing_service_version = 5; 129} 130