//
// Copyright (C) 2019 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/profiling/heap_graph.proto (package perfetto.protos, syntax proto2)
/* eslint-disable */

// These messages encode a graph of objects that retain one another. Currently
// this is used for Android Runtime (i.e. Java and Kotlin) heap graphs.

import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
import { file_protos_perfetto_trace_profiling_deobfuscation } from "./deobfuscation_pb";
import type { InternedString } from "./profile_common_pb";
import { file_protos_perfetto_trace_profiling_profile_common } from "./profile_common_pb";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/trace/profiling/heap_graph.proto.
 */
export const file_protos_perfetto_trace_profiling_heap_graph: GenFile = /*@__PURE__*/
  fileDesc("CjBwcm90b3MvcGVyZmV0dG8vdHJhY2UvcHJvZmlsaW5nL2hlYXBfZ3JhcGgucHJvdG8SD3BlcmZldHRvLnByb3RvcyK2AwoNSGVhcEdyYXBoUm9vdBIWCgpvYmplY3RfaWRzGAEgAygEQgIQARI2Cglyb290X3R5cGUYAiABKA4yIy5wZXJmZXR0by5wcm90b3MuSGVhcEdyYXBoUm9vdC5UeXBlItQCCgRUeXBlEhAKDFJPT1RfVU5LTk9XThAAEhMKD1JPT1RfSk5JX0dMT0JBTBABEhIKDlJPT1RfSk5JX0xPQ0FMEAISEwoPUk9PVF9KQVZBX0ZSQU1FEAMSFQoRUk9PVF9OQVRJVkVfU1RBQ0sQBBIVChFST09UX1NUSUNLWV9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ZpZWxkX2lkX2Jhc2UYBiABKAQSHgoScmVmZXJlbmNlX2ZpZWxkX2lkGAQgAygEQgIQARIfChNyZWZlcmVuY2Vfb2JqZWN0X2lkGAUgAygEQgIQARItCiVuYXRpdmVfYWxsb2NhdGlvbl9yZWdpc3RyeV9zaXplX2ZpZWxkGAggASgDEkIKD2hlYXBfdHlwZV9kZWx0YRgJIAEoDjIpLnBlcmZldHRvLnByb3Rvcy5IZWFwR3JhcGhPYmplY3QuSGVhcFR5cGUiZAoISGVhcFR5cGUSFQoRSEVBUF9UWVBFX1VOS05PV04QABIRCg1IRUFQX1RZUEVfQVBQEAESFAoQSEVBUF9UWVBFX1pZR09URRACEhgKFEhFQVBfVFlQRV9CT09UX0lNQUdFEANCDAoKaWRlbnRpZmllciLAAgoJSGVhcEdyYXBoEgsKA3BpZBgBIAEoBRIxCgdvYmplY3RzGAIgAygLMiAucGVyZmV0dG8ucHJvdG9zLkhlYXBHcmFwaE9iamVjdBItCgVyb290cxgHIAMoCzIeLnBlcmZldHRvLnByb3Rvcy5IZWFwR3JhcGhSb290Ei0KBXR5cGVzGAkgAygLMh4ucGVyZmV0dG8ucHJvdG9zLkhlYXBHcmFwaFR5cGUSNAoLZmllbGRfbmFtZXMYBCADKAsyHy5wZXJmZXR0by5wcm90b3MuSW50ZXJuZWRTdHJpbmcSNwoObG9jYXRpb25fbmFtZXMYCCADKAsyHy5wZXJmZXR0by5wcm90b3MuSW50ZXJuZWRTdHJpbmcSEQoJY29udGludWVkGAUgASgIEg0KBWluZGV4GAYgASgESgQIAxAEUAA", [file_protos_perfetto_trace_profiling_deobfuscation, file_protos_perfetto_trace_profiling_profile_common]);

/**
 * @generated from message perfetto.protos.HeapGraphRoot
 */
export type HeapGraphRoot = Message<"perfetto.protos.HeapGraphRoot"> & {
  /**
   * Objects retained by this root.
   *
   * @generated from field: repeated uint64 object_ids = 1 [packed = true];
   */
  objectIds: bigint[];

  /**
   * @generated from field: optional perfetto.protos.HeapGraphRoot.Type root_type = 2;
   */
  rootType: HeapGraphRoot_Type;
};

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

/**
 * @generated from enum perfetto.protos.HeapGraphRoot.Type
 */
export enum HeapGraphRoot_Type {
  /**
   * @generated from enum value: ROOT_UNKNOWN = 0;
   */
  ROOT_UNKNOWN = 0,

  /**
   * @generated from enum value: ROOT_JNI_GLOBAL = 1;
   */
  ROOT_JNI_GLOBAL = 1,

  /**
   * @generated from enum value: ROOT_JNI_LOCAL = 2;
   */
  ROOT_JNI_LOCAL = 2,

  /**
   * @generated from enum value: ROOT_JAVA_FRAME = 3;
   */
  ROOT_JAVA_FRAME = 3,

  /**
   * @generated from enum value: ROOT_NATIVE_STACK = 4;
   */
  ROOT_NATIVE_STACK = 4,

  /**
   * @generated from enum value: ROOT_STICKY_CLASS = 5;
   */
  ROOT_STICKY_CLASS = 5,

  /**
   * @generated from enum value: ROOT_THREAD_BLOCK = 6;
   */
  ROOT_THREAD_BLOCK = 6,

  /**
   * @generated from enum value: ROOT_MONITOR_USED = 7;
   */
  ROOT_MONITOR_USED = 7,

  /**
   * @generated from enum value: ROOT_THREAD_OBJECT = 8;
   */
  ROOT_THREAD_OBJECT = 8,

  /**
   * @generated from enum value: ROOT_INTERNED_STRING = 9;
   */
  ROOT_INTERNED_STRING = 9,

  /**
   * @generated from enum value: ROOT_FINALIZING = 10;
   */
  ROOT_FINALIZING = 10,

  /**
   * @generated from enum value: ROOT_DEBUGGER = 11;
   */
  ROOT_DEBUGGER = 11,

  /**
   * @generated from enum value: ROOT_REFERENCE_CLEANUP = 12;
   */
  ROOT_REFERENCE_CLEANUP = 12,

  /**
   * @generated from enum value: ROOT_VM_INTERNAL = 13;
   */
  ROOT_VM_INTERNAL = 13,

  /**
   * @generated from enum value: ROOT_JNI_MONITOR = 14;
   */
  ROOT_JNI_MONITOR = 14,
}

/**
 * Describes the enum perfetto.protos.HeapGraphRoot.Type.
 */
export const HeapGraphRoot_TypeSchema: GenEnum<HeapGraphRoot_Type> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_profiling_heap_graph, 0, 0);

/**
 * @generated from message perfetto.protos.HeapGraphType
 */
export type HeapGraphType = Message<"perfetto.protos.HeapGraphType"> & {
  /**
   * TODO(fmayer): Consider removing this and using the index in the repeaed
   * field to save space.
   *
   * @generated from field: optional uint64 id = 1;
   */
  id: bigint;

  /**
   * @generated from field: optional uint64 location_id = 2;
   */
  locationId: bigint;

  /**
   * @generated from field: optional string class_name = 3;
   */
  className: string;

  /**
   * Size of objects of this type.
   *
   * @generated from field: optional uint64 object_size = 4;
   */
  objectSize: bigint;

  /**
   * @generated from field: optional uint64 superclass_id = 5;
   */
  superclassId: bigint;

  /**
   * Indices for InternedData.field_names for the names of the fields of
   * instances of this class. This does NOT include the fields from
   * superclasses. The consumer of this data needs to walk all super
   * classes to get a full lists of fields. Objects always write the
   * fields in order of most specific class to the furthest up superclass.
   *
   * @generated from field: repeated uint64 reference_field_id = 6 [packed = true];
   */
  referenceFieldId: bigint[];

  /**
   * @generated from field: optional perfetto.protos.HeapGraphType.Kind kind = 7;
   */
  kind: HeapGraphType_Kind;

  /**
   * @generated from field: optional uint64 classloader_id = 8;
   */
  classloaderId: bigint;
};

/**
 * Describes the message perfetto.protos.HeapGraphType.
 * Use `create(HeapGraphTypeSchema)` to create a new message.
 */
export const HeapGraphTypeSchema: GenMessage<HeapGraphType> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_heap_graph, 1);

/**
 * @generated from enum perfetto.protos.HeapGraphType.Kind
 */
export enum HeapGraphType_Kind {
  /**
   * @generated from enum value: KIND_UNKNOWN = 0;
   */
  UNKNOWN = 0,

  /**
   * @generated from enum value: KIND_NORMAL = 1;
   */
  NORMAL = 1,

  /**
   * @generated from enum value: KIND_NOREFERENCES = 2;
   */
  NOREFERENCES = 2,

  /**
   * @generated from enum value: KIND_STRING = 3;
   */
  STRING = 3,

  /**
   * @generated from enum value: KIND_ARRAY = 4;
   */
  ARRAY = 4,

  /**
   * @generated from enum value: KIND_CLASS = 5;
   */
  CLASS = 5,

  /**
   * @generated from enum value: KIND_CLASSLOADER = 6;
   */
  CLASSLOADER = 6,

  /**
   * @generated from enum value: KIND_DEXCACHE = 7;
   */
  DEXCACHE = 7,

  /**
   * @generated from enum value: KIND_SOFT_REFERENCE = 8;
   */
  SOFT_REFERENCE = 8,

  /**
   * @generated from enum value: KIND_WEAK_REFERENCE = 9;
   */
  WEAK_REFERENCE = 9,

  /**
   * @generated from enum value: KIND_FINALIZER_REFERENCE = 10;
   */
  FINALIZER_REFERENCE = 10,

  /**
   * @generated from enum value: KIND_PHANTOM_REFERENCE = 11;
   */
  PHANTOM_REFERENCE = 11,
}

/**
 * Describes the enum perfetto.protos.HeapGraphType.Kind.
 */
export const HeapGraphType_KindSchema: GenEnum<HeapGraphType_Kind> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_profiling_heap_graph, 1, 0);

/**
 * @generated from message perfetto.protos.HeapGraphObject
 */
export type HeapGraphObject = Message<"perfetto.protos.HeapGraphObject"> & {
  /**
   * @generated from oneof perfetto.protos.HeapGraphObject.identifier
   */
  identifier: {
    /**
     * @generated from field: uint64 id = 1;
     */
    value: bigint;
    case: "id";
  } | {
    /**
     * @generated from field: uint64 id_delta = 7;
     */
    value: bigint;
    case: "idDelta";
  } | { case: undefined; value?: undefined };

  /**
   * Index for InternedData.types for the name of the type of this object.
   *
   * @generated from field: optional uint64 type_id = 2;
   */
  typeId: bigint;

  /**
   * Bytes occupied by this objects.
   *
   * @generated from field: optional uint64 self_size = 3;
   */
  selfSize: bigint;

  /**
   * Add this to all non-zero values in reference_object_id. This is used to
   * get more compact varint encoding.
   *
   * The name is confusing, but this has always been used as a base for
   * reference_object_id. The field should be named reference_object_id_base.
   *
   * @generated from field: optional uint64 reference_field_id_base = 6;
   */
  referenceFieldIdBase: bigint;

  /**
   * Indices for InternedData.field_names for the name of the field referring
   * to the object. For Android S+ and for instances of normal classes (e.g.
   * not instances of java.lang.Class or arrays), this is instead set in the
   * corresponding HeapGraphType, and this is left empty.
   *
   * @generated from field: repeated uint64 reference_field_id = 4 [packed = true];
   */
  referenceFieldId: bigint[];

  /**
   * Ids of the Object that is referred to.
   *
   * @generated from field: repeated uint64 reference_object_id = 5 [packed = true];
   */
  referenceObjectId: bigint[];

  /**
   * If this object is an instance of `libcore.util.NativeAllocationRegistry`,
   * the value of the `size` field.
   *
   * N.B. This is not the native size of this object.
   *
   * @generated from field: optional int64 native_allocation_registry_size_field = 8;
   */
  nativeAllocationRegistrySizeField: bigint;

  /**
   * To reduce the space required we only emit the heap type if it has changed
   * from the previous object we recorded.
   *
   * @generated from field: optional perfetto.protos.HeapGraphObject.HeapType heap_type_delta = 9;
   */
  heapTypeDelta: HeapGraphObject_HeapType;
};

/**
 * Describes the message perfetto.protos.HeapGraphObject.
 * Use `create(HeapGraphObjectSchema)` to create a new message.
 */
export const HeapGraphObjectSchema: GenMessage<HeapGraphObject> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_heap_graph, 2);

/**
 * @generated from enum perfetto.protos.HeapGraphObject.HeapType
 */
export enum HeapGraphObject_HeapType {
  /**
   * @generated from enum value: HEAP_TYPE_UNKNOWN = 0;
   */
  UNKNOWN = 0,

  /**
   * @generated from enum value: HEAP_TYPE_APP = 1;
   */
  APP = 1,

  /**
   * @generated from enum value: HEAP_TYPE_ZYGOTE = 2;
   */
  ZYGOTE = 2,

  /**
   * @generated from enum value: HEAP_TYPE_BOOT_IMAGE = 3;
   */
  BOOT_IMAGE = 3,
}

/**
 * Describes the enum perfetto.protos.HeapGraphObject.HeapType.
 */
export const HeapGraphObject_HeapTypeSchema: GenEnum<HeapGraphObject_HeapType> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_profiling_heap_graph, 2, 0);

/**
 * @generated from message perfetto.protos.HeapGraph
 */
export type HeapGraph = Message<"perfetto.protos.HeapGraph"> & {
  /**
   * @generated from field: optional int32 pid = 1;
   */
  pid: number;

  /**
   * This contains all objects at the time this dump was taken. Some of these
   * will be live, some of those unreachable (garbage). To find the live
   * objects, the client needs to build the transitive closure of objects
   * reachable from |roots|.
   * All objects not contained within that transitive closure are garbage that
   * has not yet been collected.
   *
   * @generated from field: repeated perfetto.protos.HeapGraphObject objects = 2;
   */
  objects: HeapGraphObject[];

  /**
   * Roots at the time this dump was taken.
   * All live objects are reachable from the roots. All other objects are
   * garbage.
   *
   * @generated from field: repeated perfetto.protos.HeapGraphRoot roots = 7;
   */
  roots: HeapGraphRoot[];

  /**
   * Types used in HeapGraphObjects.
   *
   * @generated from field: repeated perfetto.protos.HeapGraphType types = 9;
   */
  types: HeapGraphType[];

  /**
   * Field names for references in managed heap graph.
   *
   * @generated from field: repeated perfetto.protos.InternedString field_names = 4;
   */
  fieldNames: InternedString[];

  /**
   * Paths of files used in managed heap graph.
   *
   * @generated from field: repeated perfetto.protos.InternedString location_names = 8;
   */
  locationNames: InternedString[];

  /**
   * @generated from field: optional bool continued = 5;
   */
  continued: boolean;

  /**
   * @generated from field: optional uint64 index = 6;
   */
  index: bigint;
};

/**
 * Describes the message perfetto.protos.HeapGraph.
 * Use `create(HeapGraphSchema)` to create a new message.
 */
export const HeapGraphSchema: GenMessage<HeapGraph> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_heap_graph, 3);

