//
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
// @generated from file protos/perfetto/trace/ps/process_tree.proto (package perfetto.protos, syntax proto2)
/* eslint-disable */

import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/trace/ps/process_tree.proto.
 */
export const file_protos_perfetto_trace_ps_process_tree: GenFile = /*@__PURE__*/
  fileDesc("Citwcm90b3MvcGVyZmV0dG8vdHJhY2UvcHMvcHJvY2Vzc190cmVlLnByb3RvEg9wZXJmZXR0by5wcm90b3Mi2gIKC1Byb2Nlc3NUcmVlEjcKCXByb2Nlc3NlcxgBIAMoCzIkLnBlcmZldHRvLnByb3Rvcy5Qcm9jZXNzVHJlZS5Qcm9jZXNzEjQKB3RocmVhZHMYAiADKAsyIy5wZXJmZXR0by5wcm90b3MuUHJvY2Vzc1RyZWUuVGhyZWFkEiAKGGNvbGxlY3Rpb25fZW5kX3RpbWVzdGFtcBgDIAEoBBpACgZUaHJlYWQSCwoDdGlkGAEgASgFEgwKBHRnaWQYAyABKAUSDAoEbmFtZRgCIAEoCRINCgVuc3RpZBgEIAMoBRp4CgdQcm9jZXNzEgsKA3BpZBgBIAEoBRIMCgRwcGlkGAIgASgFEg8KB2NtZGxpbmUYAyADKAkSCwoDdWlkGAUgASgFEg0KBW5zcGlkGAYgAygFEh8KF3Byb2Nlc3Nfc3RhcnRfZnJvbV9ib290GAcgASgESgQIBBAF");

/**
 * Metadata about the processes and threads in the trace.
 * Note: this proto was designed to be filled in by traced_probes and should
 * only be populated with accurate information coming from the system. Other
 * trace writers should prefer to fill ThreadDescriptor and ProcessDescriptor
 * in TrackDescriptor.
 *
 * @generated from message perfetto.protos.ProcessTree
 */
export type ProcessTree = Message<"perfetto.protos.ProcessTree"> & {
  /**
   * List of processes and threads in the client. These lists are incremental
   * and not exhaustive. A process and its threads might show up separately in
   * different ProcessTree messages. A thread might event not show up at all, if
   * no sched_switch activity was detected, for instance:
   * #0 { processes: [{pid: 10, ...}], threads: [{pid: 11, tgid: 10}] }
   * #1 { threads: [{pid: 12, tgid: 10}] }
   * #2 { processes: [{pid: 20, ...}], threads: [{pid: 13, tgid: 10}] }
   *
   * @generated from field: repeated perfetto.protos.ProcessTree.Process processes = 1;
   */
  processes: ProcessTree_Process[];

  /**
   * @generated from field: repeated perfetto.protos.ProcessTree.Thread threads = 2;
   */
  threads: ProcessTree_Thread[];

  /**
   * The time at which we finish collecting this process tree;
   * the top-level packet timestamp is the time at which
   * we begin collection.
   *
   * @generated from field: optional uint64 collection_end_timestamp = 3;
   */
  collectionEndTimestamp: bigint;
};

/**
 * Describes the message perfetto.protos.ProcessTree.
 * Use `create(ProcessTreeSchema)` to create a new message.
 */
export const ProcessTreeSchema: GenMessage<ProcessTree> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_ps_process_tree, 0);

/**
 * Representation of a thread.
 *
 * @generated from message perfetto.protos.ProcessTree.Thread
 */
export type ProcessTree_Thread = Message<"perfetto.protos.ProcessTree.Thread"> & {
  /**
   * The thread ID (as per gettid()) in the root PID namespace.
   *
   * @generated from field: optional int32 tid = 1;
   */
  tid: number;

  /**
   * Thread group id (i.e. the PID of the process, == TID of the main thread)
   *
   * @generated from field: optional int32 tgid = 3;
   */
  tgid: number;

  /**
   * The name of the thread.
   *
   * @generated from field: optional string name = 2;
   */
  name: string;

  /**
   * The non-root-level thread IDs if the thread runs in a PID namespace. Read
   * from the NSpid entry of /proc/<tid>/status, with the first element (root-
   * level thread ID) omitted.
   *
   * @generated from field: repeated int32 nstid = 4;
   */
  nstid: number[];
};

/**
 * Describes the message perfetto.protos.ProcessTree.Thread.
 * Use `create(ProcessTree_ThreadSchema)` to create a new message.
 */
export const ProcessTree_ThreadSchema: GenMessage<ProcessTree_Thread> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_ps_process_tree, 0, 0);

/**
 * Representation of a process.
 *
 * @generated from message perfetto.protos.ProcessTree.Process
 */
export type ProcessTree_Process = Message<"perfetto.protos.ProcessTree.Process"> & {
  /**
   * The UNIX process ID, aka thread group ID (as per getpid()) in the root
   * PID namespace.
   *
   * @generated from field: optional int32 pid = 1;
   */
  pid: number;

  /**
   * The parent process ID, as per getppid().
   *
   * @generated from field: optional int32 ppid = 2;
   */
  ppid: number;

  /**
   * The command line for the process, as per /proc/pid/cmdline.
   * If it is a kernel thread there will only be one cmdline field
   * and it will contain /proc/pid/comm.
   *
   * @generated from field: repeated string cmdline = 3;
   */
  cmdline: string[];

  /**
   * The uid for the process, as per /proc/pid/status.
   *
   * @generated from field: optional int32 uid = 5;
   */
  uid: number;

  /**
   * The non-root-level process IDs if the process runs in a PID namespace.
   * Read from the NSpid entry of /proc/<pid>/status, with the first element
   * (root-level process ID) omitted.
   *
   * @generated from field: repeated int32 nspid = 6;
   */
  nspid: number[];

  /**
   * Timestamp of when the process was created, in nanoseconds
   * from boot. Parsed from starttime in /proc/pid/stat.
   * Recorded if record_process_age config option is set.
   * Resolution of "clock ticks", usually 10ms.
   *
   * @generated from field: optional uint64 process_start_from_boot = 7;
   */
  processStartFromBoot: bigint;
};

/**
 * Describes the message perfetto.protos.ProcessTree.Process.
 * Use `create(ProcessTree_ProcessSchema)` to create a new message.
 */
export const ProcessTree_ProcessSchema: GenMessage<ProcessTree_Process> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_ps_process_tree, 0, 1);

