• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    // No longer used as of Apr 2018, when the dedicated |threads| field was
58    // introduced in ProcessTree.
59    repeated Thread threads_deprecated = 4 [deprecated = true];
60
61    // The uid for the process, as per /proc/pid/status.
62    optional int32 uid = 5;
63
64    // The non-root-level process IDs if the process runs in a PID namespace.
65    // Read from the NSpid entry of /proc/<pid>/status, with the first element (
66    // root-level process ID) omitted.
67    repeated int32 nspid = 6;
68  }
69
70  // List of processes and threads in the client. These lists are incremental
71  // and not exhaustive. A process and its threads might show up separately in
72  // different ProcessTree messages. A thread might event not show up at all, if
73  // no sched_switch activity was detected, for instance:
74  // #0 { processes: [{pid: 10, ...}], threads: [{pid: 11, tgid: 10}] }
75  // #1 { threads: [{pid: 12, tgid: 10}] }
76  // #2 { processes: [{pid: 20, ...}], threads: [{pid: 13, tgid: 10}] }
77  repeated Process processes = 1;
78  repeated Thread threads = 2;
79
80  // The time at which we finish collecting this process tree;
81  // the top-level packet timestamp is the time at which
82  // we begin collection.
83  optional uint64 collection_end_timestamp = 3;
84}
85