//
// Copyright (C) 2021 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/common/perf_events.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 { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/common/perf_events.proto.
 */
export const file_protos_perfetto_common_perf_events: GenFile = /*@__PURE__*/
  fileDesc("Cihwcm90b3MvcGVyZmV0dG8vY29tbW9uL3BlcmZfZXZlbnRzLnByb3RvEg9wZXJmZXR0by5wcm90b3MixwgKClBlcmZFdmVudHMaxQIKCFRpbWViYXNlEhMKCWZyZXF1ZW5jeRgCIAEoBEgAEhAKBnBlcmlvZBgBIAEoBEgAEjYKB2NvdW50ZXIYBCABKA4yIy5wZXJmZXR0by5wcm90b3MuUGVyZkV2ZW50cy5Db3VudGVySAESPAoKdHJhY2Vwb2ludBgDIAEoCzImLnBlcmZldHRvLnByb3Rvcy5QZXJmRXZlbnRzLlRyYWNlcG9pbnRIARI5CglyYXdfZXZlbnQYBSABKAsyJC5wZXJmZXR0by5wcm90b3MuUGVyZkV2ZW50cy5SYXdFdmVudEgBEj4KD3RpbWVzdGFtcF9jbG9jaxgLIAEoDjIlLnBlcmZldHRvLnByb3Rvcy5QZXJmRXZlbnRzLlBlcmZDbG9jaxIMCgRuYW1lGAogASgJQgoKCGludGVydmFsQgcKBWV2ZW50GioKClRyYWNlcG9pbnQSDAoEbmFtZRgBIAEoCR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gp0cmFjZXBvaW50GAIgASgLMiYucGVyZmV0dG8ucHJvdG9zLlBlcmZFdmVudHMuVHJhY2Vwb2ludEgAEjkKCXJhd19ldmVudBgDIAEoCzIkLnBlcmZldHRvLnByb3Rvcy5QZXJmRXZlbnRzLlJhd0V2ZW50SAASDAoEbmFtZRgEIAEoCUIHCgVldmVudA");

/**
 * Next id: 12
 *
 * @generated from message perfetto.protos.PerfEvents
 */
export type PerfEvents = Message<"perfetto.protos.PerfEvents"> & {
};

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

/**
 * What event to sample on, and how often. Commented from the perspective of
 * its use in |PerfEventConfig|.
 *
 * @generated from message perfetto.protos.PerfEvents.Timebase
 */
export type PerfEvents_Timebase = Message<"perfetto.protos.PerfEvents.Timebase"> & {
  /**
   * How often the per-cpu sampling will occur. Not guaranteed to be honored
   * as the kernel can throttle the sampling rate if it's too high.
   * If unset, an implementation-defined default is used.
   *
   * @generated from oneof perfetto.protos.PerfEvents.Timebase.interval
   */
  interval: {
    /**
     * Per-cpu sampling frequency in Hz, as requested from the kernel. Not the
     * same as 1/period.
     * Details: the actual sampling will still be based on a period, but the
     * kernel will dynamically adjust it based on the observed event rate, to
     * approximate this frequency. Works best with steady-rate events like
     * timers.
     *
     * @generated from field: uint64 frequency = 2;
     */
    value: bigint;
    case: "frequency";
  } | {
    /**
     * Per-cpu sampling will occur every |period| counts of |event|.
     * Prefer |frequency| by default, as it's easier to oversample with a
     * fixed period.
     *
     * @generated from field: uint64 period = 1;
     */
    value: bigint;
    case: "period";
  } | { case: undefined; value?: undefined };

  /**
   * Counting event to use as a timebase for the sampling.
   * If unset, implies the CPU timer (SW_CPU_CLOCK) as the event,
   * which is what you usually want.
   * See common/perf_events.proto for the definitions.
   *
   * @generated from oneof perfetto.protos.PerfEvents.Timebase.event
   */
  event: {
    /**
     * @generated from field: perfetto.protos.PerfEvents.Counter counter = 4;
     */
    value: PerfEvents_Counter;
    case: "counter";
  } | {
    /**
     * @generated from field: perfetto.protos.PerfEvents.Tracepoint tracepoint = 3;
     */
    value: PerfEvents_Tracepoint;
    case: "tracepoint";
  } | {
    /**
     * @generated from field: perfetto.protos.PerfEvents.RawEvent raw_event = 5;
     */
    value: PerfEvents_RawEvent;
    case: "rawEvent";
  } | { case: undefined; value?: undefined };

  /**
   * If set, samples will be timestamped with the given clock.
   * If unset, the clock is chosen by the implementation.
   * For software events, prefer PERF_CLOCK_BOOTTIME. However it cannot be
   * used for hardware events (due to interrupt safety), for which the
   * recommendation is to use one of the monotonic clocks.
   *
   * @generated from field: optional perfetto.protos.PerfEvents.PerfClock timestamp_clock = 11;
   */
  timestampClock: PerfEvents_PerfClock;

  /**
   * Optional arbitrary name for the event, to identify it in the parsed
   * trace. Does *not* affect the profiling itself. If unset, the trace
   * parser will choose a suitable name.
   *
   * @generated from field: optional string name = 10;
   */
  name: string;
};

/**
 * Describes the message perfetto.protos.PerfEvents.Timebase.
 * Use `create(PerfEvents_TimebaseSchema)` to create a new message.
 */
export const PerfEvents_TimebaseSchema: GenMessage<PerfEvents_Timebase> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_perf_events, 0, 0);

/**
 * @generated from message perfetto.protos.PerfEvents.Tracepoint
 */
export type PerfEvents_Tracepoint = Message<"perfetto.protos.PerfEvents.Tracepoint"> & {
  /**
   * Group and name for the tracepoint, acceptable forms:
   * * "sched/sched_switch"
   * * "sched:sched_switch"
   *
   * @generated from field: optional string name = 1;
   */
  name: string;

  /**
   * Optional field-level filter for the tracepoint. Only events matching this
   * filter will be counted (and therefore contribute to the sampling period).
   * Example: "prev_pid >= 42 && next_pid == 0".
   * For full syntax, see kernel documentation on "Event filtering":
   * https://www.kernel.org/doc/Documentation/trace/events.txt
   *
   * @generated from field: optional string filter = 2;
   */
  filter: string;
};

/**
 * Describes the message perfetto.protos.PerfEvents.Tracepoint.
 * Use `create(PerfEvents_TracepointSchema)` to create a new message.
 */
export const PerfEvents_TracepointSchema: GenMessage<PerfEvents_Tracepoint> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_perf_events, 0, 1);

/**
 * Syscall-level description of the event, propagated to the perf_event_attr
 * struct. Primarily for local use-cases, since the event availability and
 * encoding is hardware-specific.
 *
 * @generated from message perfetto.protos.PerfEvents.RawEvent
 */
export type PerfEvents_RawEvent = Message<"perfetto.protos.PerfEvents.RawEvent"> & {
  /**
   * @generated from field: optional uint32 type = 1;
   */
  type: number;

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

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

  /**
   * @generated from field: optional uint64 config2 = 4;
   */
  config2: bigint;
};

/**
 * Describes the message perfetto.protos.PerfEvents.RawEvent.
 * Use `create(PerfEvents_RawEventSchema)` to create a new message.
 */
export const PerfEvents_RawEventSchema: GenMessage<PerfEvents_RawEvent> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_perf_events, 0, 2);

/**
 * Builtin counter names from the uapi header. Commented with their perf tool
 * aliases.
 * TODO(rsavitski): consider generating enums for cache events (should be
 * finite), and generally make this list as extensive as possible. Excluding
 * things like dynamic PMUs since those don't fit into a static enum.
 * Next id: 21
 *
 * @generated from enum perfetto.protos.PerfEvents.Counter
 */
export enum PerfEvents_Counter {
  /**
   * @generated from enum value: UNKNOWN_COUNTER = 0;
   */
  UNKNOWN_COUNTER = 0,

  /**
   * cpu-clock
   *
   * @generated from enum value: SW_CPU_CLOCK = 1;
   */
  SW_CPU_CLOCK = 1,

  /**
   * page-faults, faults
   *
   * @generated from enum value: SW_PAGE_FAULTS = 2;
   */
  SW_PAGE_FAULTS = 2,

  /**
   * task-clock
   *
   * @generated from enum value: SW_TASK_CLOCK = 3;
   */
  SW_TASK_CLOCK = 3,

  /**
   * context-switches, cs
   *
   * @generated from enum value: SW_CONTEXT_SWITCHES = 4;
   */
  SW_CONTEXT_SWITCHES = 4,

  /**
   * cpu-migrations, migrations
   *
   * @generated from enum value: SW_CPU_MIGRATIONS = 5;
   */
  SW_CPU_MIGRATIONS = 5,

  /**
   * minor-faults
   *
   * @generated from enum value: SW_PAGE_FAULTS_MIN = 6;
   */
  SW_PAGE_FAULTS_MIN = 6,

  /**
   * major-faults
   *
   * @generated from enum value: SW_PAGE_FAULTS_MAJ = 7;
   */
  SW_PAGE_FAULTS_MAJ = 7,

  /**
   * alignment-faults
   *
   * @generated from enum value: SW_ALIGNMENT_FAULTS = 8;
   */
  SW_ALIGNMENT_FAULTS = 8,

  /**
   * emulation-faults
   *
   * @generated from enum value: SW_EMULATION_FAULTS = 9;
   */
  SW_EMULATION_FAULTS = 9,

  /**
   * dummy
   *
   * @generated from enum value: SW_DUMMY = 20;
   */
  SW_DUMMY = 20,

  /**
   * cpu-cycles, cycles
   *
   * @generated from enum value: HW_CPU_CYCLES = 10;
   */
  HW_CPU_CYCLES = 10,

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

  /**
   * cache-references
   *
   * @generated from enum value: HW_CACHE_REFERENCES = 12;
   */
  HW_CACHE_REFERENCES = 12,

  /**
   * cache-misses
   *
   * @generated from enum value: HW_CACHE_MISSES = 13;
   */
  HW_CACHE_MISSES = 13,

  /**
   * branch-instructions, branches
   *
   * @generated from enum value: HW_BRANCH_INSTRUCTIONS = 14;
   */
  HW_BRANCH_INSTRUCTIONS = 14,

  /**
   * branch-misses
   *
   * @generated from enum value: HW_BRANCH_MISSES = 15;
   */
  HW_BRANCH_MISSES = 15,

  /**
   * bus-cycles
   *
   * @generated from enum value: HW_BUS_CYCLES = 16;
   */
  HW_BUS_CYCLES = 16,

  /**
   * stalled-cycles-frontend, idle-cycles-frontend
   *
   * @generated from enum value: HW_STALLED_CYCLES_FRONTEND = 17;
   */
  HW_STALLED_CYCLES_FRONTEND = 17,

  /**
   * stalled-cycles-backend, idle-cycles-backend
   *
   * @generated from enum value: HW_STALLED_CYCLES_BACKEND = 18;
   */
  HW_STALLED_CYCLES_BACKEND = 18,

  /**
   * ref-cycles
   *
   * @generated from enum value: HW_REF_CPU_CYCLES = 19;
   */
  HW_REF_CPU_CYCLES = 19,
}

/**
 * Describes the enum perfetto.protos.PerfEvents.Counter.
 */
export const PerfEvents_CounterSchema: GenEnum<PerfEvents_Counter> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_common_perf_events, 0, 0);

/**
 * Subset of clocks that is supported by perf timestamping.
 * CLOCK_TAI is excluded since it's not expected to be used in practice, but
 * would require additions to the trace clock synchronisation logic.
 *
 * @generated from enum perfetto.protos.PerfEvents.PerfClock
 */
export enum PerfEvents_PerfClock {
  /**
   * @generated from enum value: UNKNOWN_PERF_CLOCK = 0;
   */
  UNKNOWN_PERF_CLOCK = 0,

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

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

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

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

/**
 * Describes the enum perfetto.protos.PerfEvents.PerfClock.
 */
export const PerfEvents_PerfClockSchema: GenEnum<PerfEvents_PerfClock> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_common_perf_events, 0, 1);

/**
 * Additional events associated with a leader.
 * Configuration is similar to Timebase event. Because data acquisition is
 * driven by the leader there is no option to configure the clock or the
 * frequency.
 *
 * @generated from message perfetto.protos.FollowerEvent
 */
export type FollowerEvent = Message<"perfetto.protos.FollowerEvent"> & {
  /**
   * @generated from oneof perfetto.protos.FollowerEvent.event
   */
  event: {
    /**
     * @generated from field: perfetto.protos.PerfEvents.Counter counter = 1;
     */
    value: PerfEvents_Counter;
    case: "counter";
  } | {
    /**
     * @generated from field: perfetto.protos.PerfEvents.Tracepoint tracepoint = 2;
     */
    value: PerfEvents_Tracepoint;
    case: "tracepoint";
  } | {
    /**
     * @generated from field: perfetto.protos.PerfEvents.RawEvent raw_event = 3;
     */
    value: PerfEvents_RawEvent;
    case: "rawEvent";
  } | { case: undefined; value?: undefined };

  /**
   * @generated from field: optional string name = 4;
   */
  name: string;
};

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

