• 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())
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
38  // Representation of a process.
39  message Process {
40    // The UNIX process ID, aka thread group ID (as per getpid()).
41    optional int32 pid = 1;
42
43    // The parent process ID, as per getppid().
44    optional int32 ppid = 2;
45
46    // The command line for the process, as per /proc/pid/cmdline.
47    // If it is a kernel thread there will only be one cmdline field
48    // and it will contain /proc/pid/comm.
49    repeated string cmdline = 3;
50
51    // No longer used as of Apr 2018, when the dedicated |threads| field was
52    // introduced in ProcessTree.
53    repeated Thread threads_deprecated = 4 [deprecated = true];
54
55    // The uid for the process, as per /proc/pid/status.
56    optional int32 uid = 5;
57  }
58
59  // List of processes and threads in the client. These lists are incremental
60  // and not exhaustive. A process and its threads might show up separately in
61  // different ProcessTree messages. A thread might event not show up at all, if
62  // no sched_switch activity was detected, for instance:
63  // #0 { processes: [{pid: 10, ...}], threads: [{pid: 11, tgid: 10}] }
64  // #1 { threads: [{pid: 12, tgid: 10}] }
65  // #2 { processes: [{pid: 20, ...}], threads: [{pid: 13, tgid: 10}] }
66  repeated Process processes = 1;
67  repeated Thread threads = 2;
68
69  // The time at which we finish collecting this process tree;
70  // the top-level packet timestamp is the time at which
71  // we begin collection.
72  optional uint64 collection_end_timestamp = 3;
73}
74