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

import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
import type { FollowerEvent, PerfEvents_Timebase } from "../../common/perf_events_pb";
import { file_protos_perfetto_common_perf_events } from "../../common/perf_events_pb";
import type { Callstack, Frame, InternedString, Mapping } 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/profile_packet.proto.
 */
export const file_protos_perfetto_trace_profiling_profile_packet: GenFile = /*@__PURE__*/
  fileDesc("CjRwcm90b3MvcGVyZmV0dG8vdHJhY2UvcHJvZmlsaW5nL3Byb2ZpbGVfcGFja2V0LnByb3RvEg9wZXJmZXR0by5wcm90b3MivAsKDVByb2ZpbGVQYWNrZXQSMAoHc3RyaW5ncxgBIAMoCzIfLnBlcmZldHRvLnByb3Rvcy5JbnRlcm5lZFN0cmluZxIqCghtYXBwaW5ncxgEIAMoCzIYLnBlcmZldHRvLnByb3Rvcy5NYXBwaW5nEiYKBmZyYW1lcxgCIAMoCzIWLnBlcmZldHRvLnByb3Rvcy5GcmFtZRIuCgpjYWxsc3RhY2tzGAMgAygLMhoucGVyZmV0dG8ucHJvdG9zLkNhbGxzdGFjaxJICg1wcm9jZXNzX2R1bXBzGAUgAygLMjEucGV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X2NvdW50GAIgASgNEhwKFGNob3Nlbl9wcm9jZXNzX3NoYXJkGAMgASgN", [file_protos_perfetto_common_perf_events, file_protos_perfetto_trace_profiling_profile_common]);

/**
 * The packet emitted by heapprofd for each heap snapshot. A snapshot can
 * involve more than one ProfilePacket if the snapshot is big (when |continued|
 * is true). The cardinality and grouping is as follows:
 * A ProfilePacket contains:
 *  - 1+ per-process heap snapshots (ProcessHeapSamples). Normally there is only
 *    one heap per process (the main malloc/free heap), but there can be more if
 *    the process is using the heapprofd API to profile custom allocators.
 *  - Globally interned strings, mappings and frames (to allow de-duplicating
 *    frames/mapping in common between different processes).
 * A ProcessHeapSamples contains:
 *  - The process and heap identifier.
 *  - A number of HeapSample, one for each callsite that had some alloc/frees.
 *  - Statistics about heapprofd internals (e.g., sampling/unwinding timings).
 * A HeapSample contains statistics about callsites:
 *  - Total number of bytes allocated and freed from that callsite.
 *  - Total number of alloc/free calls sampled.
 *  - Stats at the local maximum when dump_at_max = true.
 * See https://perfetto.dev/docs/data-sources/native-heap-profiler for more.
 *
 * @generated from message perfetto.protos.ProfilePacket
 */
export type ProfilePacket = Message<"perfetto.protos.ProfilePacket"> & {
  /**
   * The following interning tables are only used in Android version Q.
   * In newer versions, these tables are in InternedData
   * (see protos/perfetto/trace/interned_data) and are shared across
   * multiple ProfilePackets.
   * For backwards compatibility, consumers need to first look up interned
   * data in the tables within the ProfilePacket, and then, if they are empty,
   * look up in the InternedData instead.
   *
   * @generated from field: repeated perfetto.protos.InternedString strings = 1;
   */
  strings: InternedString[];

  /**
   * @generated from field: repeated perfetto.protos.Mapping mappings = 4;
   */
  mappings: Mapping[];

  /**
   * @generated from field: repeated perfetto.protos.Frame frames = 2;
   */
  frames: Frame[];

  /**
   * @generated from field: repeated perfetto.protos.Callstack callstacks = 3;
   */
  callstacks: Callstack[];

  /**
   * @generated from field: repeated perfetto.protos.ProfilePacket.ProcessHeapSamples process_dumps = 5;
   */
  processDumps: ProfilePacket_ProcessHeapSamples[];

  /**
   * If this is true, the next ProfilePacket in this package_sequence_id is a
   * continuation of this one.
   * To get all samples for a process, accummulate its
   * ProcessHeapSamples.samples until you see continued=false.
   *
   * @generated from field: optional bool continued = 6;
   */
  continued: boolean;

  /**
   * Index of this ProfilePacket on its package_sequence_id. Can be used
   * to detect dropped data.
   * Verify these are consecutive.
   *
   * @generated from field: optional uint64 index = 7;
   */
  index: bigint;
};

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

/**
 * Next ID: 9
 *
 * @generated from message perfetto.protos.ProfilePacket.HeapSample
 */
export type ProfilePacket_HeapSample = Message<"perfetto.protos.ProfilePacket.HeapSample"> & {
  /**
   * @generated from field: optional uint64 callstack_id = 1;
   */
  callstackId: bigint;

  /**
   * bytes allocated at this callstack.
   *
   * @generated from field: optional uint64 self_allocated = 2;
   */
  selfAllocated: bigint;

  /**
   * bytes allocated at this callstack that have been freed.
   *
   * @generated from field: optional uint64 self_freed = 3;
   */
  selfFreed: bigint;

  /**
   * Bytes allocated by this callstack but not freed at the time the malloc
   * heap usage of this process was maximal. This is only set if dump_at_max
   * is true in HeapprofdConfig. In that case, self_allocated, self_freed and
   * self_idle will not be set.
   *
   * @generated from field: optional uint64 self_max = 8;
   */
  selfMax: bigint;

  /**
   * Number of allocations that were sampled at this callstack but not freed
   * at the time the malloc heap usage of this process was maximal. This is
   * only set if dump_at_max is true in HeapprofdConfig. In that case,
   * self_allocated, self_freed and self_idle will not be set.
   *
   * @generated from field: optional uint64 self_max_count = 9;
   */
  selfMaxCount: bigint;

  /**
   * timestamp [opt]
   *
   * @generated from field: optional uint64 timestamp = 4;
   */
  timestamp: bigint;

  /**
   * Number of allocations that were sampled at this callstack.
   *
   * @generated from field: optional uint64 alloc_count = 5;
   */
  allocCount: bigint;

  /**
   * Number of allocations that were sampled at this callstack that have been
   * freed.
   *
   * @generated from field: optional uint64 free_count = 6;
   */
  freeCount: bigint;
};

/**
 * Describes the message perfetto.protos.ProfilePacket.HeapSample.
 * Use `create(ProfilePacket_HeapSampleSchema)` to create a new message.
 */
export const ProfilePacket_HeapSampleSchema: GenMessage<ProfilePacket_HeapSample> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_profile_packet, 0, 0);

/**
 * @generated from message perfetto.protos.ProfilePacket.Histogram
 */
export type ProfilePacket_Histogram = Message<"perfetto.protos.ProfilePacket.Histogram"> & {
  /**
   * @generated from field: repeated perfetto.protos.ProfilePacket.Histogram.Bucket buckets = 1;
   */
  buckets: ProfilePacket_Histogram_Bucket[];
};

/**
 * Describes the message perfetto.protos.ProfilePacket.Histogram.
 * Use `create(ProfilePacket_HistogramSchema)` to create a new message.
 */
export const ProfilePacket_HistogramSchema: GenMessage<ProfilePacket_Histogram> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_profile_packet, 0, 1);

/**
 * @generated from message perfetto.protos.ProfilePacket.Histogram.Bucket
 */
export type ProfilePacket_Histogram_Bucket = Message<"perfetto.protos.ProfilePacket.Histogram.Bucket"> & {
  /**
   * This bucket counts values from the previous bucket's (or -infinity if
   * this is the first bucket) upper_limit (inclusive) to this upper_limit
   * (exclusive).
   *
   * @generated from field: optional uint64 upper_limit = 1;
   */
  upperLimit: bigint;

  /**
   * This is the highest bucket. This is set instead of the upper_limit. Any
   * values larger or equal to the previous bucket's upper_limit are counted
   * in this bucket.
   *
   * @generated from field: optional bool max_bucket = 2;
   */
  maxBucket: boolean;

  /**
   * Number of values that fall into this range.
   *
   * @generated from field: optional uint64 count = 3;
   */
  count: bigint;
};

/**
 * Describes the message perfetto.protos.ProfilePacket.Histogram.Bucket.
 * Use `create(ProfilePacket_Histogram_BucketSchema)` to create a new message.
 */
export const ProfilePacket_Histogram_BucketSchema: GenMessage<ProfilePacket_Histogram_Bucket> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_profile_packet, 0, 1, 0);

/**
 * @generated from message perfetto.protos.ProfilePacket.ProcessStats
 */
export type ProfilePacket_ProcessStats = Message<"perfetto.protos.ProfilePacket.ProcessStats"> & {
  /**
   * @generated from field: optional uint64 unwinding_errors = 1;
   */
  unwindingErrors: bigint;

  /**
   * @generated from field: optional uint64 heap_samples = 2;
   */
  heapSamples: bigint;

  /**
   * @generated from field: optional uint64 map_reparses = 3;
   */
  mapReparses: bigint;

  /**
   * @generated from field: optional perfetto.protos.ProfilePacket.Histogram unwinding_time_us = 4;
   */
  unwindingTimeUs?: ProfilePacket_Histogram;

  /**
   * @generated from field: optional uint64 total_unwinding_time_us = 5;
   */
  totalUnwindingTimeUs: bigint;

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

/**
 * Describes the message perfetto.protos.ProfilePacket.ProcessStats.
 * Use `create(ProfilePacket_ProcessStatsSchema)` to create a new message.
 */
export const ProfilePacket_ProcessStatsSchema: GenMessage<ProfilePacket_ProcessStats> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_profile_packet, 0, 2);

/**
 * @generated from message perfetto.protos.ProfilePacket.ProcessHeapSamples
 */
export type ProfilePacket_ProcessHeapSamples = Message<"perfetto.protos.ProfilePacket.ProcessHeapSamples"> & {
  /**
   * @generated from field: optional uint64 pid = 1;
   */
  pid: bigint;

  /**
   * This process was profiled from startup.
   * If false, this process was already running when profiling started.
   *
   * @generated from field: optional bool from_startup = 3;
   */
  fromStartup: boolean;

  /**
   * This process was not profiled because a concurrent session was active.
   * If this is true, samples will be empty.
   *
   * @generated from field: optional bool rejected_concurrent = 4;
   */
  rejectedConcurrent: boolean;

  /**
   * This process disconnected while it was profiled.
   * If false, the process outlived the profiling session.
   *
   * @generated from field: optional bool disconnected = 6;
   */
  disconnected: boolean;

  /**
   * If disconnected, this disconnect was caused by the client overrunning
   * the buffer.
   * Equivalent to client_error == CLIENT_ERROR_HIT_TIMEOUT
   * on new S builds.
   *
   * @generated from field: optional bool buffer_overran = 7;
   */
  bufferOverran: boolean;

  /**
   * @generated from field: optional perfetto.protos.ProfilePacket.ProcessHeapSamples.ClientError client_error = 14;
   */
  clientError: ProfilePacket_ProcessHeapSamples_ClientError;

  /**
   * If disconnected, this disconnected was caused by the shared memory
   * buffer being corrupted. THIS IS ALWAYS A BUG IN HEAPPROFD OR CLIENT
   * MEMORY CORRUPTION.
   *
   * @generated from field: optional bool buffer_corrupted = 8;
   */
  bufferCorrupted: boolean;

  /**
   * If disconnected, this disconnect was caused by heapprofd exceeding
   * guardrails during this profiling session.
   *
   * @generated from field: optional bool hit_guardrail = 10;
   */
  hitGuardrail: boolean;

  /**
   * @generated from field: optional string heap_name = 11;
   */
  heapName: string;

  /**
   * @generated from field: optional uint64 sampling_interval_bytes = 12;
   */
  samplingIntervalBytes: bigint;

  /**
   * @generated from field: optional uint64 orig_sampling_interval_bytes = 13;
   */
  origSamplingIntervalBytes: bigint;

  /**
   * Timestamp of the state of the target process that this dump represents.
   * This can be different to the timestamp of the TracePackets for various
   * reasons:
   * * If disconnected is set above, this is the timestamp of last state
   *   heapprofd had of the process before it disconnected.
   * * Otherwise, if the rate of events produced by the process is high,
   *   heapprofd might be behind.
   *
   * TODO(fmayer): This is MONOTONIC_COARSE. Refactor ClockSnapshot::Clock
   *               to have a type enum that we can reuse here.
   *
   * @generated from field: optional uint64 timestamp = 9;
   */
  timestamp: bigint;

  /**
   * Metadata about heapprofd.
   *
   * @generated from field: optional perfetto.protos.ProfilePacket.ProcessStats stats = 5;
   */
  stats?: ProfilePacket_ProcessStats;

  /**
   * @generated from field: repeated perfetto.protos.ProfilePacket.HeapSample samples = 2;
   */
  samples: ProfilePacket_HeapSample[];
};

/**
 * Describes the message perfetto.protos.ProfilePacket.ProcessHeapSamples.
 * Use `create(ProfilePacket_ProcessHeapSamplesSchema)` to create a new message.
 */
export const ProfilePacket_ProcessHeapSamplesSchema: GenMessage<ProfilePacket_ProcessHeapSamples> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_profile_packet, 0, 3);

/**
 * @generated from enum perfetto.protos.ProfilePacket.ProcessHeapSamples.ClientError
 */
export enum ProfilePacket_ProcessHeapSamples_ClientError {
  /**
   * @generated from enum value: CLIENT_ERROR_NONE = 0;
   */
  NONE = 0,

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

  /**
   * @generated from enum value: CLIENT_ERROR_INVALID_STACK_BOUNDS = 2;
   */
  INVALID_STACK_BOUNDS = 2,
}

/**
 * Describes the enum perfetto.protos.ProfilePacket.ProcessHeapSamples.ClientError.
 */
export const ProfilePacket_ProcessHeapSamples_ClientErrorSchema: GenEnum<ProfilePacket_ProcessHeapSamples_ClientError> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_profiling_profile_packet, 0, 3, 0);

/**
 * Packet emitted by heapprofd when stream_allocations = true. Only for local
 * testing. Doesn't report the callsite.
 *
 * @generated from message perfetto.protos.StreamingAllocation
 */
export type StreamingAllocation = Message<"perfetto.protos.StreamingAllocation"> & {
  /**
   * TODO(fmayer): Add callstack.
   *
   * @generated from field: repeated uint64 address = 1;
   */
  address: bigint[];

  /**
   * @generated from field: repeated uint64 size = 2;
   */
  size: bigint[];

  /**
   * @generated from field: repeated uint64 sample_size = 3;
   */
  sampleSize: bigint[];

  /**
   * @generated from field: repeated uint64 clock_monotonic_coarse_timestamp = 4;
   */
  clockMonotonicCoarseTimestamp: bigint[];

  /**
   * @generated from field: repeated uint32 heap_id = 5;
   */
  heapId: number[];

  /**
   * @generated from field: repeated uint64 sequence_number = 6;
   */
  sequenceNumber: bigint[];
};

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

/**
 * Packet emitted by heapprofd when stream_allocations = true. Only for local
 * testing. Doesn't report the callsite.
 *
 * @generated from message perfetto.protos.StreamingFree
 */
export type StreamingFree = Message<"perfetto.protos.StreamingFree"> & {
  /**
   * TODO(fmayer): Add callstack.
   *
   * @generated from field: repeated uint64 address = 1;
   */
  address: bigint[];

  /**
   * @generated from field: repeated uint32 heap_id = 2;
   */
  heapId: number[];

  /**
   * @generated from field: repeated uint64 sequence_number = 3;
   */
  sequenceNumber: bigint[];
};

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

/**
 * Packet emitted by the chromium in-process signal-based callstack sampler.
 * Represents a series of individual stack samples (sampled at discrete points
 * in time), rather than aggregated over an interval.
 *
 * @generated from message perfetto.protos.StreamingProfilePacket
 */
export type StreamingProfilePacket = Message<"perfetto.protos.StreamingProfilePacket"> & {
  /**
   * Index into InternedData.callstacks
   *
   * @generated from field: repeated uint64 callstack_iid = 1;
   */
  callstackIid: bigint[];

  /**
   * TODO(eseckler): ThreadDescriptor-based timestamps are deprecated. Replace
   * this with ClockSnapshot-based delta encoding instead.
   *
   * @generated from field: repeated int64 timestamp_delta_us = 2;
   */
  timestampDeltaUs: bigint[];

  /**
   * @generated from field: optional int32 process_priority = 3;
   */
  processPriority: number;
};

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

/**
 * Namespace for the contained enums.
 *
 * @generated from message perfetto.protos.Profiling
 */
export type Profiling = Message<"perfetto.protos.Profiling"> & {
};

/**
 * Describes the message perfetto.protos.Profiling.
 * Use `create(ProfilingSchema)` to create a new message.
 */
export const ProfilingSchema: GenMessage<Profiling> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_profile_packet, 4);

/**
 * @generated from enum perfetto.protos.Profiling.CpuMode
 */
export enum Profiling_CpuMode {
  /**
   * @generated from enum value: MODE_UNKNOWN = 0;
   */
  MODE_UNKNOWN = 0,

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

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

  /**
   * The following values aren't expected, but included for completeness:
   *
   * @generated from enum value: MODE_HYPERVISOR = 3;
   */
  MODE_HYPERVISOR = 3,

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

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

/**
 * Describes the enum perfetto.protos.Profiling.CpuMode.
 */
export const Profiling_CpuModeSchema: GenEnum<Profiling_CpuMode> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_profiling_profile_packet, 4, 0);

/**
 * Enumeration of libunwindstack's error codes.
 * NB: the integral representations of the two enums are different.
 *
 * @generated from enum perfetto.protos.Profiling.StackUnwindError
 */
export enum Profiling_StackUnwindError {
  /**
   * @generated from enum value: UNWIND_ERROR_UNKNOWN = 0;
   */
  UNWIND_ERROR_UNKNOWN = 0,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  /**
   * @generated from enum value: UNWIND_ERROR_PTRACE_CALL = 15;
   */
  UNWIND_ERROR_PTRACE_CALL = 15,
}

/**
 * Describes the enum perfetto.protos.Profiling.StackUnwindError.
 */
export const Profiling_StackUnwindErrorSchema: GenEnum<Profiling_StackUnwindError> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_profiling_profile_packet, 4, 1);

/**
 * Packet emitted by the traced_perf sampling performance profiler, which
 * gathers data via the perf_event_open syscall. Each packet contains an
 * individual sample with a counter value, and optionally a
 * callstack.
 *
 * Timestamps are within the root packet. The config can specify the clock, or
 * the implementation will default to CLOCK_MONOTONIC_RAW. Within the Android R
 * timeframe, the default was CLOCK_BOOTTIME.
 *
 * There are several distinct views of this message:
 * * indication of kernel buffer data loss (kernel_records_lost set)
 * * indication of skipped samples (sample_skipped_reason set)
 * * notable event in the sampling implementation (producer_event set)
 * * normal sample (timebase_count set, typically also callstack_iid)
 *
 * @generated from message perfetto.protos.PerfSample
 */
export type PerfSample = Message<"perfetto.protos.PerfSample"> & {
  /**
   * @generated from field: optional uint32 cpu = 1;
   */
  cpu: number;

  /**
   * @generated from field: optional uint32 pid = 2;
   */
  pid: number;

  /**
   * @generated from field: optional uint32 tid = 3;
   */
  tid: number;

  /**
   * Execution state that the process was sampled at.
   *
   * @generated from field: optional perfetto.protos.Profiling.CpuMode cpu_mode = 5;
   */
  cpuMode: Profiling_CpuMode;

  /**
   * Value of the timebase counter (since the event was configured, no deltas).
   *
   * @generated from field: optional uint64 timebase_count = 6;
   */
  timebaseCount: bigint;

  /**
   * Value of the followers counter (since the event was configured, no deltas).
   *
   * @generated from field: repeated uint64 follower_counts = 7;
   */
  followerCounts: bigint[];

  /**
   * Unwound callstack. Might be partial, in which case a synthetic "error"
   * frame is appended, and |unwind_error| is set accordingly.
   *
   * @generated from field: optional uint64 callstack_iid = 4;
   */
  callstackIid: bigint;

  /**
   * If set, stack unwinding was incomplete due to an error.
   * Unset values should be treated as UNWIND_ERROR_NONE.
   *
   * @generated from oneof perfetto.protos.PerfSample.optional_unwind_error
   */
  optionalUnwindError: {
    /**
     * @generated from field: perfetto.protos.Profiling.StackUnwindError unwind_error = 16;
     */
    value: Profiling_StackUnwindError;
    case: "unwindError";
  } | { case: undefined; value?: undefined };

  /**
   * If set, indicates that this message is not a sample, but rather an
   * indication of data loss in the ring buffer allocated for |cpu|. Such data
   * loss occurs when the kernel has insufficient ring buffer capacity to write
   * a record (which gets discarded). A record in this context is an individual
   * ring buffer entry, and counts more than just sample records.
   *
   * The |timestamp| of the packet corresponds to the time that the producer
   * wrote the packet for trace-sorting purposes alone, and should not be
   * interpreted relative to the sample timestamps. This field is sufficient to
   * detect that *some* kernel data loss happened within the trace, but not the
   * specific time bounds of that loss (which would require tracking precedessor
   * & successor timestamps, which is not deemed necessary at the moment).
   *
   * @generated from field: optional uint64 kernel_records_lost = 17;
   */
  kernelRecordsLost: bigint;

  /**
   * @generated from oneof perfetto.protos.PerfSample.optional_sample_skipped_reason
   */
  optionalSampleSkippedReason: {
    /**
     * @generated from field: perfetto.protos.PerfSample.SampleSkipReason sample_skipped_reason = 18;
     */
    value: PerfSample_SampleSkipReason;
    case: "sampleSkippedReason";
  } | { case: undefined; value?: undefined };

  /**
   * @generated from field: optional perfetto.protos.PerfSample.ProducerEvent producer_event = 19;
   */
  producerEvent?: PerfSample_ProducerEvent;
};

/**
 * Describes the message perfetto.protos.PerfSample.
 * Use `create(PerfSampleSchema)` to create a new message.
 */
export const PerfSampleSchema: GenMessage<PerfSample> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_profile_packet, 5);

/**
 * A notable event within the sampling implementation.
 *
 * @generated from message perfetto.protos.PerfSample.ProducerEvent
 */
export type PerfSample_ProducerEvent = Message<"perfetto.protos.PerfSample.ProducerEvent"> & {
  /**
   * @generated from oneof perfetto.protos.PerfSample.ProducerEvent.optional_source_stop_reason
   */
  optionalSourceStopReason: {
    /**
     * @generated from field: perfetto.protos.PerfSample.ProducerEvent.DataSourceStopReason source_stop_reason = 1;
     */
    value: PerfSample_ProducerEvent_DataSourceStopReason;
    case: "sourceStopReason";
  } | { case: undefined; value?: undefined };
};

/**
 * Describes the message perfetto.protos.PerfSample.ProducerEvent.
 * Use `create(PerfSample_ProducerEventSchema)` to create a new message.
 */
export const PerfSample_ProducerEventSchema: GenMessage<PerfSample_ProducerEvent> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_profile_packet, 5, 0);

/**
 * @generated from enum perfetto.protos.PerfSample.ProducerEvent.DataSourceStopReason
 */
export enum PerfSample_ProducerEvent_DataSourceStopReason {
  /**
   * @generated from enum value: PROFILER_STOP_UNKNOWN = 0;
   */
  PROFILER_STOP_UNKNOWN = 0,

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

/**
 * Describes the enum perfetto.protos.PerfSample.ProducerEvent.DataSourceStopReason.
 */
export const PerfSample_ProducerEvent_DataSourceStopReasonSchema: GenEnum<PerfSample_ProducerEvent_DataSourceStopReason> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_profiling_profile_packet, 5, 0, 0);

/**
 * If set, indicates that the profiler encountered a sample that was relevant,
 * but was skipped.
 *
 * @generated from enum perfetto.protos.PerfSample.SampleSkipReason
 */
export enum PerfSample_SampleSkipReason {
  /**
   * @generated from enum value: PROFILER_SKIP_UNKNOWN = 0;
   */
  PROFILER_SKIP_UNKNOWN = 0,

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

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

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

/**
 * Describes the enum perfetto.protos.PerfSample.SampleSkipReason.
 */
export const PerfSample_SampleSkipReasonSchema: GenEnum<PerfSample_SampleSkipReason> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_profiling_profile_packet, 5, 0);

/**
 * Submessage for TracePacketDefaults.
 *
 * @generated from message perfetto.protos.PerfSampleDefaults
 */
export type PerfSampleDefaults = Message<"perfetto.protos.PerfSampleDefaults"> & {
  /**
   * The sampling timebase. Might not be identical to the data source config if
   * the implementation decided to default/override some parameters.
   *
   * @generated from field: optional perfetto.protos.PerfEvents.Timebase timebase = 1;
   */
  timebase?: PerfEvents_Timebase;

  /**
   * Description of followers event
   *
   * @generated from field: repeated perfetto.protos.FollowerEvent followers = 4;
   */
  followers: FollowerEvent[];

  /**
   * If the config requested process sharding, report back the count and which
   * of those bins was selected. Never changes for the duration of a trace.
   *
   * @generated from field: optional uint32 process_shard_count = 2;
   */
  processShardCount: number;

  /**
   * @generated from field: optional uint32 chosen_process_shard = 3;
   */
  chosenProcessShard: number;
};

/**
 * Describes the message perfetto.protos.PerfSampleDefaults.
 * Use `create(PerfSampleDefaultsSchema)` to create a new message.
 */
export const PerfSampleDefaultsSchema: GenMessage<PerfSampleDefaults> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_profiling_profile_packet, 6);

