1/* 2 * Copyright (C) 2018 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"; 18option optimize_for = LITE_RUNTIME; 19package perfetto.protos; 20 21message ProcessTree { 22 // Representation of a thread. 23 message Thread { 24 // The thread id (as per gettid()) 25 optional int32 tid = 1; 26 27 // Thread group id (i.e. the PID of the process, == TID of the main thread) 28 optional int32 tgid = 3; 29 30 // The name of the thread. 31 optional string name = 2; 32 } 33 34 // Representation of a process. 35 message Process { 36 // The UNIX process ID, aka thread group ID (as per getpid()). 37 optional int32 pid = 1; 38 39 // The parent process ID, as per getppid(). 40 optional int32 ppid = 2; 41 42 // The command line for the process, as per /proc/pid/cmdline. 43 // If it is a kernel thread there will only be one cmdline field 44 // and it will contain /proc/pid/comm. 45 repeated string cmdline = 3; 46 47 // No longer used as of Apr 2018, when the dedicated |threads| field was 48 // introduced in ProcessTree. 49 repeated Thread threads_deprecated = 4 [deprecated = true]; 50 } 51 52 // List of processes and threads in the client. These lists are incremental 53 // and not exhaustive. A process and its threads might show up separately in 54 // different ProcessTree messages. A thread might event not show up at all, if 55 // no sched_switch activity was detected, for instance: 56 // #0 { processes: [{pid: 10, ...}], threads: [{pid: 11, tgid: 10}] } 57 // #1 { threads: [{pid: 12, tgid: 10}] } 58 // #2 { processes: [{pid: 20, ...}], threads: [{pid: 13, tgid: 10}] } 59 repeated Process processes = 1; 60 repeated Thread threads = 2; 61 62 // The time at which we finish collecting this process tree; 63 // the top-level packet timestamp is the time at which 64 // we begin collection. 65 optional uint64 collection_end_timestamp = 3; 66} 67