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"; 18package perfetto.protos; 19 20// Metadata about the processes and threads in the trace. 21// Note: this proto was designed to be filled in by traced_probes and should 22// only be populated with accurate information coming from the system. Other 23// trace writers should prefer to fill ThreadDescriptor and ProcessDescriptor 24// in TrackDescriptor. 25message ProcessTree { 26 // Representation of a thread. 27 message Thread { 28 // The thread ID (as per gettid()) in the root PID namespace. 29 optional int32 tid = 1; 30 31 // Thread group id (i.e. the PID of the process, == TID of the main thread) 32 optional int32 tgid = 3; 33 34 // The name of the thread. 35 optional string name = 2; 36 37 // The non-root-level thread IDs if the thread runs in a PID namespace. Read 38 // from the NSpid entry of /proc/<tid>/status, with the first element (root- 39 // level thread ID) omitted. 40 repeated int32 nstid = 4; 41 } 42 43 // Representation of a process. 44 message Process { 45 // The UNIX process ID, aka thread group ID (as per getpid()) in the root 46 // PID namespace. 47 optional int32 pid = 1; 48 49 // The parent process ID, as per getppid(). 50 optional int32 ppid = 2; 51 52 // The command line for the process, as per /proc/pid/cmdline. 53 // If it is a kernel thread there will only be one cmdline field 54 // and it will contain /proc/pid/comm. 55 repeated string cmdline = 3; 56 57 // The uid for the process, as per /proc/pid/status. 58 optional int32 uid = 5; 59 60 // The non-root-level process IDs if the process runs in a PID namespace. 61 // Read from the NSpid entry of /proc/<pid>/status, with the first element 62 // (root-level process ID) omitted. 63 repeated int32 nspid = 6; 64 65 // Timestamp of when the process was created, in nanoseconds 66 // from boot. Parsed from starttime in /proc/pid/stat. 67 // Recorded if record_process_age config option is set. 68 // Resolution of "clock ticks", usually 10ms. 69 optional uint64 process_start_from_boot = 7; 70 71 // threads_deprecated 72 reserved 4; 73 } 74 75 // List of processes and threads in the client. These lists are incremental 76 // and not exhaustive. A process and its threads might show up separately in 77 // different ProcessTree messages. A thread might event not show up at all, if 78 // no sched_switch activity was detected, for instance: 79 // #0 { processes: [{pid: 10, ...}], threads: [{pid: 11, tgid: 10}] } 80 // #1 { threads: [{pid: 12, tgid: 10}] } 81 // #2 { processes: [{pid: 20, ...}], threads: [{pid: 13, tgid: 10}] } 82 repeated Process processes = 1; 83 repeated Thread threads = 2; 84 85 // The time at which we finish collecting this process tree; 86 // the top-level packet timestamp is the time at which 87 // we begin collection. 88 optional uint64 collection_end_timestamp = 3; 89} 90