//
// 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/ftrace/ftrace_stats.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/trace/ftrace/ftrace_stats.proto.
 */
export const file_protos_perfetto_trace_ftrace_ftrace_stats: GenFile = /*@__PURE__*/
  fileDesc("Ci9wcm90b3MvcGVyZmV0dG8vdHJhY2UvZnRyYWNlL2Z0cmFjZV9zdGF0cy5wcm90bxIPcGVyZmV0dG8ucHJvdG9zIsEBCg5GdHJhY2VDcHVTdGF0cxILCgNjcHUYASABKAQSDwoHZW50cmllcxgCIAEoBBIPCgdvdmVycnVuGAMgASgEEhYKDmNvbW1pdF9vdmVycnVuGAQgASgEEhIKCmJ5dGVzX3JlYWQYBSABKAQSFwoPb2xkZXN0X2V2ZW50X3RzGAYgASgBEg4KBm5vd190cxgHIAEoARIWCg5kcm9wcGVkX2V2ZW50cxgIIAEoBBITCgtyZWFkX2V2ZW50cxgJIAEoBCIxChFGdHJhY2VLcHJvYmVTdGF0cxIMCgRoaXRzGAEgASgDEg4KBm1pc3NlcxgCIAEoAyLhAwoLRnRyYWNlU3RhdHMSMQoFcGhhc2UYASABKA4yIi5wZXJmZXR0by5wcm90b3MuRnRyYWNlU3RhdHMuUGhhc2USMgoJY3B1X3N0YXRzGAIgAygLMh8ucGV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kSJgoiRlRSQUNFX1NUQVRVU19BQklfU0hPUlRfVElNRV9TVEFNUBAKEicKI0ZUUkFDRV9TVEFUVVNfQUJJX1NIT1JUX0RBVEFfTEVOR1RIEAsSJgoiRlRSQUNFX1NUQVRVU19BQklfWkVST19EQVRBX0xFTkdUSBAMEikKJUZUUkFDRV9TVEFUVVNfQUJJX0lOVkFMSURfREFUQV9MRU5HVEgQDRIkCiBGVFJBQ0VfU1RBVFVTX0FCSV9TSE9SVF9FVkVOVF9JRBAOEiIKHkZUUkFDRV9TVEFUVVNfQUJJX0VORF9PVkVSRkxPVxAPEiUKIUZUUkFDRV9TVEFUVVNfU0hPUlRfQ09NUEFDVF9FVkVOVBAQEh8KG0ZUUkFDRV9TVEFUVVNfSU5WQUxJRF9FVkVOVBAR");

/**
 * Per-CPU kernel buffer stats for the ftrace data source gathered from
 * /sys/kernel/tracing/per_cpu/cpuX/stats.
 *
 * @generated from message perfetto.protos.FtraceCpuStats
 */
export type FtraceCpuStats = Message<"perfetto.protos.FtraceCpuStats"> & {
  /**
   * CPU index.
   *
   * @generated from field: optional uint64 cpu = 1;
   */
  cpu: bigint;

  /**
   * Number of entries currently in the kernel buffer.
   *
   * @generated from field: optional uint64 entries = 2;
   */
  entries: bigint;

  /**
   * Number of events lost in kernel buffers due to overwriting of old events
   * before userspace had a chance to drain them. Valid if the buffer is in
   * "overwrite" mode, otherwise see |dropped_events|.
   *
   * @generated from field: optional uint64 overrun = 3;
   */
  overrun: bigint;

  /**
   * This should always be zero. If not the buffer size is way too small or
   * something went wrong with the tracer. Quoting the kernel: "number of
   * commits failing due to the buffer wrapping around while there are
   * uncommitted events, such as during an interrupt storm".
   *
   * @generated from field: optional uint64 commit_overrun = 4;
   */
  commitOverrun: bigint;

  /**
   * Size of entries currently in the kernel buffer (see |entries|) in bytes.
   * The field should be named "bytes", but is misnamed for historical reasons.
   * This value has known inaccuracies before Linux v6.6:
   * https://github.com/torvalds/linux/commit/45d99ea
   *
   * @generated from field: optional uint64 bytes_read = 5;
   */
  bytesRead: bigint;

  /**
   * The timestamp for the oldest event still in the ring buffer.
   * Unit: seconds for typical trace clocks (i.e. not tsc/counter).
   *
   * @generated from field: optional double oldest_event_ts = 6;
   */
  oldestEventTs: number;

  /**
   * The current timestamp.
   * Unit: seconds for typical trace clocks (i.e. not tsc/counter).
   *
   * @generated from field: optional double now_ts = 7;
   */
  nowTs: number;

  /**
   * If the kernel buffer has overwrite mode disabled, this will show the number
   * of new events that were lost because the buffer was full. This is similar
   * to |overrun| but only for the overwrite=false case.
   *
   * @generated from field: optional uint64 dropped_events = 8;
   */
  droppedEvents: bigint;

  /**
   * The number of events read (consumed) from the buffer by userspace.
   *
   * @generated from field: optional uint64 read_events = 9;
   */
  readEvents: bigint;
};

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

/**
 * Kprobe statistical data, gathered from /sys/kernel/tracing/kprobe_profile.
 *
 * @generated from message perfetto.protos.FtraceKprobeStats
 */
export type FtraceKprobeStats = Message<"perfetto.protos.FtraceKprobeStats"> & {
  /**
   * Cumulative number of kprobe events generated for this function
   *
   * @generated from field: optional int64 hits = 1;
   */
  hits: bigint;

  /**
   * Cumulative number of kprobe events that could not be generated for this
   * function and were missed.  This happens when too much nesting
   * happens between a kprobe and its kretprobe, overflowing the
   * maxactives buffer.
   *
   * @generated from field: optional int64 misses = 2;
   */
  misses: bigint;
};

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

/**
 * Errors and kernel buffer stats for the ftrace data source.
 *
 * @generated from message perfetto.protos.FtraceStats
 */
export type FtraceStats = Message<"perfetto.protos.FtraceStats"> & {
  /**
   * A pair of FtraceStats is written on every trace flush:
   * * START_OF_TRACE - stats recorded at the beginning of the trace.
   * * END_OF_TRACE - stats recorded during the flush. In other words shortly
   *                  before this packet was written. For simple traces this
   *                  will be once at the end of the trace.
   *
   * @generated from field: optional perfetto.protos.FtraceStats.Phase phase = 1;
   */
  phase: FtraceStats_Phase;

  /**
   * Per-CPU stats (one entry for each CPU).
   *
   * @generated from field: repeated perfetto.protos.FtraceCpuStats cpu_stats = 2;
   */
  cpuStats: FtraceCpuStats[];

  /**
   * When FtraceConfig.symbolize_ksyms = true, this records the number of
   * symbols parsed from /proc/kallsyms, whether they have been seen in the
   * trace or not. It can be used to debug kptr_restrict or security-related
   * errors.
   * Note: this will be valid only when phase = END_OF_TRACE. The symbolizer is
   * initialized. When START_OF_TRACE is emitted it is not ready yet.
   *
   * @generated from field: optional uint32 kernel_symbols_parsed = 3;
   */
  kernelSymbolsParsed: number;

  /**
   * The memory used by the kernel symbolizer (KernelSymbolMap.size_bytes()).
   *
   * @generated from field: optional uint32 kernel_symbols_mem_kb = 4;
   */
  kernelSymbolsMemKb: number;

  /**
   * Atrace errors (even non-fatal ones) are reported here. A typical example is
   * one or more atrace categories not available on the device.
   *
   * @generated from field: optional string atrace_errors = 5;
   */
  atraceErrors: string;

  /**
   * Ftrace events requested by the config but not present on device.
   *
   * @generated from field: repeated string unknown_ftrace_events = 6;
   */
  unknownFtraceEvents: string[];

  /**
   * Ftrace events requested by the config and present on device, but which we
   * failed to enable due to permissions, or due to a conflicting option
   * (currently FtraceConfig.disable_generic_events).
   *
   * @generated from field: repeated string failed_ftrace_events = 7;
   */
  failedFtraceEvents: string[];

  /**
   * The data source was configured to preserve existing events in the ftrace
   * buffer before the start of the trace.
   *
   * @generated from field: optional bool preserve_ftrace_buffer = 8;
   */
  preserveFtraceBuffer: boolean;

  /**
   * Unique errors encountered during reading and parsing of the raw ftrace
   * data. Ring buffer ABI related errors will also be recorded in the
   * affected FtraceEventBundles with a timestamp.
   * Any traces with entries in this field should be investigated, as they
   * indicate a bug in perfetto or the kernel.
   *
   * @generated from field: repeated perfetto.protos.FtraceParseStatus ftrace_parse_errors = 9;
   */
  ftraceParseErrors: FtraceParseStatus[];

  /**
   * Kprobe profile stats for functions hits and misses
   *
   * @generated from field: optional perfetto.protos.FtraceKprobeStats kprobe_stats = 10;
   */
  kprobeStats?: FtraceKprobeStats;
};

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

/**
 * @generated from enum perfetto.protos.FtraceStats.Phase
 */
export enum FtraceStats_Phase {
  /**
   * @generated from enum value: UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

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

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

/**
 * Describes the enum perfetto.protos.FtraceStats.Phase.
 */
export const FtraceStats_PhaseSchema: GenEnum<FtraceStats_Phase> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_ftrace_ftrace_stats, 2, 0);

/**
 * @generated from enum perfetto.protos.FtraceParseStatus
 */
export enum FtraceParseStatus {
  /**
   * @generated from enum value: FTRACE_STATUS_UNSPECIFIED = 0;
   */
  FTRACE_STATUS_UNSPECIFIED = 0,

  /**
   * Not written, used for convenience of implementation:
   *
   * @generated from enum value: FTRACE_STATUS_OK = 1;
   */
  FTRACE_STATUS_OK = 1,

  /**
   * Issues with reading data out of the ftrace ring buffer:
   *
   * @generated from enum value: FTRACE_STATUS_UNEXPECTED_READ_ERROR = 2;
   */
  FTRACE_STATUS_UNEXPECTED_READ_ERROR = 2,

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

  /**
   * Ring buffer binary data not matching our understanding of the layout:
   *
   * @generated from enum value: FTRACE_STATUS_ABI_INVALID_PAGE_HEADER = 4;
   */
  FTRACE_STATUS_ABI_INVALID_PAGE_HEADER = 4,

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

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

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

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

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

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

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

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

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

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

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

  /**
   * Issues with parsing the event payload:
   *
   * @generated from enum value: FTRACE_STATUS_SHORT_COMPACT_EVENT = 16;
   */
  FTRACE_STATUS_SHORT_COMPACT_EVENT = 16,

  /**
   * @generated from enum value: FTRACE_STATUS_INVALID_EVENT = 17;
   */
  FTRACE_STATUS_INVALID_EVENT = 17,
}

/**
 * Describes the enum perfetto.protos.FtraceParseStatus.
 */
export const FtraceParseStatusSchema: GenEnum<FtraceParseStatus> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_ftrace_ftrace_stats, 0);

