//
// 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/config/sys_stats/sys_stats_config.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 { MeminfoCounters, VmstatCounters } from "../../common/sys_stats_counters_pb";
import { file_protos_perfetto_common_sys_stats_counters } from "../../common/sys_stats_counters_pb";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/config/sys_stats/sys_stats_config.proto.
 */
export const file_protos_perfetto_config_sys_stats_sys_stats_config: GenFile = /*@__PURE__*/
  fileDesc("Cjdwcm90b3MvcGVyZmV0dG8vY29uZmlnL3N5c19zdGF0cy9zeXNfc3RhdHNfY29uZmlnLnByb3RvEg9wZXJmZXR0by5wcm90b3Mi7AQKDlN5c1N0YXRzQ29uZmlnEhkKEW1lbWluZm9fcGVyaW9kX21zGAEgASgNEjoKEG1lbWluZm9fY291bnRlcnMYAiADKA4yIC5wZXJmZXR0by5wcm90b3MuTWVtaW5mb0NvdW50ZXJzEhgKEHZtc3RhdF9wZXJpb2RfbXMYAyABKA0SOAoPdm1zdGF0X2NvdW50ZXJzGAQgAygOMh8ucGVyZmV0dG8ucHJvdG9zLlZtc3RhdENvdW50ZXJzEhYKDnN0YXRfcGVyaW9kX21zGAUgASgNEkMKDXN0YXRfY291bnRlcnMYBiADKA4yLC5wZXJmZXR0by5wcm90b3MuU3lzU3RhdHNDb25maWcuU3RhdENvdW50ZXJzEhkKEWRldmZyZXFfcGVyaW9kX21zGAcgASgNEhkKEWNwdWZyZXFfcGVyaW9kX21zGAggASgNEhsKE2J1ZGR5aW5mb19wZXJpb2RfbXMYCSABKA0SGgoSZGlza3N0YXRfcGVyaW9kX21zGAogASgNEhUKDXBzaV9wZXJpb2RfbXMYCyABKA0SGQoRdGhlcm1hbF9wZXJpb2RfbXMYDCABKA0SGQoRY3B1aWRsZV9wZXJpb2RfbXMYDSABKA0SGQoRZ3B1ZnJlcV9wZXJpb2RfbXMYDiABKA0iewoMU3RhdENvdW50ZXJzEhQKEFNUQVRfVU5TUEVDSUZJRUQQABISCg5TVEFUX0NQVV9USU1FUxABEhMKD1NUQVRfSVJRX0NPVU5UUxACEhcKE1NUQVRfU09GVElSUV9DT1VOVFMQAxITCg9TVEFUX0ZPUktfQ09VTlQQBA", [file_protos_perfetto_common_sys_stats_counters]);

/**
 * This file defines the configuration for the Linux /proc poller data source,
 * which injects counters in the trace.
 * Counters that are needed in the trace must be explicitly listed in the
 * *_counters fields. This is to avoid spamming the trace with all counters
 * at all times.
 * The sampling rate is configurable. All polling rates (*_period_ms) need
 * to be integer multiples of each other.
 * OK:     [10ms, 10ms, 10ms],  [10ms, 20ms, 10ms],  [10ms, 20ms, 60ms]
 * Not OK: [10ms, 10ms, 11ms],  [10ms, 15ms, 20ms]
 *
 * @generated from message perfetto.protos.SysStatsConfig
 */
export type SysStatsConfig = Message<"perfetto.protos.SysStatsConfig"> & {
  /**
   * Polls /proc/meminfo every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   * Cost: 0.3 ms [read] + 0.07 ms [parse + trace injection]
   *
   * @generated from field: optional uint32 meminfo_period_ms = 1;
   */
  meminfoPeriodMs: number;

  /**
   * If empty all known counters are reported. Otherwise, only the counters
   * specified below are reported.
   *
   * @generated from field: repeated perfetto.protos.MeminfoCounters meminfo_counters = 2;
   */
  meminfoCounters: MeminfoCounters[];

  /**
   * Polls /proc/vmstat every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   * Cost: 0.2 ms [read] + 0.3 ms [parse + trace injection]
   *
   * @generated from field: optional uint32 vmstat_period_ms = 3;
   */
  vmstatPeriodMs: number;

  /**
   * @generated from field: repeated perfetto.protos.VmstatCounters vmstat_counters = 4;
   */
  vmstatCounters: VmstatCounters[];

  /**
   * Pols /proc/stat every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   * Cost: 4.1 ms [read] + 1.9 ms [parse + trace injection]
   *
   * @generated from field: optional uint32 stat_period_ms = 5;
   */
  statPeriodMs: number;

  /**
   * @generated from field: repeated perfetto.protos.SysStatsConfig.StatCounters stat_counters = 6;
   */
  statCounters: SysStatsConfig_StatCounters[];

  /**
   * Polls /sys/devfreq/*\/curfreq every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   * This option can be used to record unchanging values.
   * Updates from frequency changes can come from ftrace/set_clock_rate.
   *
   * @generated from field: optional uint32 devfreq_period_ms = 7;
   */
  devfreqPeriodMs: number;

  /**
   * Polls /sys/devices/system/cpu/cpu*\/cpufreq/cpuinfo_cur_freq every X ms.
   * This is required to be > 10ms to avoid excessive CPU usage.
   *
   * @generated from field: optional uint32 cpufreq_period_ms = 8;
   */
  cpufreqPeriodMs: number;

  /**
   * Polls /proc/buddyinfo every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   *
   * @generated from field: optional uint32 buddyinfo_period_ms = 9;
   */
  buddyinfoPeriodMs: number;

  /**
   * Polls /proc/diskstats every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   *
   * @generated from field: optional uint32 diskstat_period_ms = 10;
   */
  diskstatPeriodMs: number;

  /**
   * Polls /proc/pressure/* every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   *
   * @generated from field: optional uint32 psi_period_ms = 11;
   */
  psiPeriodMs: number;

  /**
   * Polls /sys/class/thermal/* every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   *
   * @generated from field: optional uint32 thermal_period_ms = 12;
   */
  thermalPeriodMs: number;

  /**
   * Polls /sys/devices/system/cpu/cpu*\/cpuidle/state* every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   *
   * @generated from field: optional uint32 cpuidle_period_ms = 13;
   */
  cpuidlePeriodMs: number;

  /**
   * Polls device-specific GPU frequency info every X ms, if non-zero.
   * This is required to be > 10ms to avoid excessive CPU usage.
   *
   * @generated from field: optional uint32 gpufreq_period_ms = 14;
   */
  gpufreqPeriodMs: number;
};

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

/**
 * @generated from enum perfetto.protos.SysStatsConfig.StatCounters
 */
export enum SysStatsConfig_StatCounters {
  /**
   * @generated from enum value: STAT_UNSPECIFIED = 0;
   */
  STAT_UNSPECIFIED = 0,

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

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

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

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

/**
 * Describes the enum perfetto.protos.SysStatsConfig.StatCounters.
 */
export const SysStatsConfig_StatCountersSchema: GenEnum<SysStatsConfig_StatCounters> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_config_sys_stats_sys_stats_config, 0, 0);

