//
// Copyright (C) 2017 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/trace_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 { BuiltinClock } from "../common/builtin_clock_pb";
import { file_protos_perfetto_common_builtin_clock } from "../common/builtin_clock_pb";
import type { DataSourceConfig } from "./data_source_config_pb";
import { file_protos_perfetto_config_data_source_config } from "./data_source_config_pb";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/config/trace_config.proto.
 */
export const file_protos_perfetto_config_trace_config: GenFile = /*@__PURE__*/
  fileDesc("Cilwcm90b3MvcGVyZmV0dG8vY29uZmlnL3RyYWNlX2NvbmZpZy5wcm90bxIPcGVyZmV0dG8ucHJvdG9zIu0jCgtUcmFjZUNvbmZpZxI6CgdidWZmZXJzGAEgAygLMikucGVyZmV0dG8ucHJvdG9zLlRyYWNlQ29uZmlnLkJ1ZmZlckNvbmZpZxI9CgxkYXRhX3NvdXJjZXMYAiADKAsyJy5wZXJmZXR0by5wcm90b3MuVHJhY2VDb25maWcuRGF0YVNvdXJjZRJMChRidWlsdGluX2RhdGFfc291cmNlcxgUIAEoCzIuLnBlcmZldHRvLnByb3Rvcy5UcmFjZUNvbmZpZy5CdWlsdGluRGF0YVNvdXJjZRITCgtkdXJhdGlvbl9tcxgDIAEoDRIpCiFwcmVmZXJfc3VzcGVuZF9jbG9ja19mb3JfZHVyYX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lc3Npb25fY291bnQYAiABKAQiVQoVTG9ja2Rvd25Nb2RlT3BlcmF0aW9uEhYKEkxPQ0tET1dOX1VOQ0hBTkdFRBAAEhIKDkxPQ0tET1dOX0NMRUFSEAESEAoMTE9DS0RPV05fU0VUEAIiUQoPQ29tcHJlc3Npb25UeXBlEiAKHENPTVBSRVNTSU9OX1RZUEVfVU5TUEVDSUZJRUQQABIcChhDT01QUkVTU0lPTl9UWVBFX0RFRkxBVEUQASJoCg1TdGF0c2RMb2dnaW5nEh4KGlNUQVRTRF9MT0dHSU5HX1VOU1BFQ0lGSUVEEAASGgoWU1RBVFNEX0xPR0dJTkdfRU5BQkxFRBABEhsKF1NUQVRTRF9MT0dHSU5HX0RJU0FCTEVEEAJKBAgPEBBKBAglECZKBAgaEBtKBAggECE", [file_protos_perfetto_common_builtin_clock, file_protos_perfetto_config_data_source_config]);

/**
 * The overall config that is used when starting a new tracing session through
 * ProducerPort::StartTracing().
 * It contains the general config for the logging buffer(s) and the configs for
 * all the data source being enabled.
 *
 * Next id: 40.
 *
 * @generated from message perfetto.protos.TraceConfig
 */
export type TraceConfig = Message<"perfetto.protos.TraceConfig"> & {
  /**
   * @generated from field: repeated perfetto.protos.TraceConfig.BufferConfig buffers = 1;
   */
  buffers: TraceConfig_BufferConfig[];

  /**
   * @generated from field: repeated perfetto.protos.TraceConfig.DataSource data_sources = 2;
   */
  dataSources: TraceConfig_DataSource[];

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.BuiltinDataSource builtin_data_sources = 20;
   */
  builtinDataSources?: TraceConfig_BuiltinDataSource;

  /**
   * If specified, the trace will be stopped |duration_ms| after starting.
   * This does *not* count the time the system is suspended, so we will run
   * for duration_ms of system activity, not wall time.
   *
   * However in case of traces with triggers, see
   * TriggerConfig.trigger_timeout_ms instead.
   *
   * @generated from field: optional uint32 duration_ms = 3;
   */
  durationMs: number;

  /**
   * If true, tries to use CLOCK_BOOTTIME for duration_ms rather than
   * CLOCK_MONOTONIC (which doesn't count time in suspend). Supported only on
   * Linux/Android, no-op on other platforms. This is used when dealing with
   * long (e.g. 24h) traces, where suspend can inflate them to weeks of
   * wall-time, making them more likely to hit device reboots (and hence loss).
   * This option also changes consistently the semantic of
   * TriggerConfig.stop_delay_ms.
   *
   * @generated from field: optional bool prefer_suspend_clock_for_duration = 36;
   */
  preferSuspendClockForDuration: boolean;

  /**
   * This is set when --dropbox is passed to the Perfetto command line client
   * and enables guardrails that limit resource usage for traces requested
   * by statsd.
   *
   * @generated from field: optional bool enable_extra_guardrails = 4;
   */
  enableExtraGuardrails: boolean;

  /**
   * Reject producers that are not running under the same UID as the tracing
   * service.
   *
   * @generated from field: optional perfetto.protos.TraceConfig.LockdownModeOperation lockdown_mode = 5;
   */
  lockdownMode: TraceConfig_LockdownModeOperation;

  /**
   * @generated from field: repeated perfetto.protos.TraceConfig.ProducerConfig producers = 6;
   */
  producers: TraceConfig_ProducerConfig[];

  /**
   * Statsd-specific metadata.
   *
   * @generated from field: optional perfetto.protos.TraceConfig.StatsdMetadata statsd_metadata = 7;
   */
  statsdMetadata?: TraceConfig_StatsdMetadata;

  /**
   * When true && |output_path| is empty, the EnableTracing() request must
   * provide a file descriptor. The service will then periodically read packets
   * out of the trace buffer and store it into the passed file.
   * If |output_path| is not empty no fd should be passed, the service
   * will create a new file and write into that (see comment below).
   *
   * @generated from field: optional bool write_into_file = 8;
   */
  writeIntoFile: boolean;

  /**
   * This must point to a non-existing file. If the file exists the service
   * will NOT overwrite and will fail instead as a security precaution.
   * On Android, when this is used with the system traced, the path must be
   * within /data/misc/perfetto-traces/ or the trace will fail.
   * This option has been introduced in Android R. Before R write_into_file
   * can be used only with the "pass a file descriptor over IPC" mode.
   *
   * @generated from field: optional string output_path = 29;
   */
  outputPath: string;

  /**
   * Optional. If non-zero tunes the write period. A min value of 100ms is
   * enforced (i.e. smaller values are ignored).
   *
   * @generated from field: optional uint32 file_write_period_ms = 9;
   */
  fileWritePeriodMs: number;

  /**
   * Optional. When non zero the periodic write stops once at most X bytes
   * have been written into the file. Tracing is disabled when this limit is
   * reached, even if |duration_ms| has not been reached yet.
   *
   * @generated from field: optional uint64 max_file_size_bytes = 10;
   */
  maxFileSizeBytes: bigint;

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.GuardrailOverrides guardrail_overrides = 11;
   */
  guardrailOverrides?: TraceConfig_GuardrailOverrides;

  /**
   * When true, data sources are not started until an explicit call to
   * StartTracing() on the consumer port. This is to support early
   * initialization and fast trace triggering. This can be used only when the
   * Consumer explicitly triggers the StartTracing() method.
   * This should not be used in a remote trace config via statsd, doing so will
   * result in a hung trace session.
   *
   * @generated from field: optional bool deferred_start = 12;
   */
  deferredStart: boolean;

  /**
   * When set, it periodically issues a Flush() to all data source, forcing them
   * to commit their data into the tracing service. This can be used for
   * quasi-real-time streaming mode and to guarantee some partial ordering of
   * events in the trace in windows of X ms.
   *
   * @generated from field: optional uint32 flush_period_ms = 13;
   */
  flushPeriodMs: number;

  /**
   * Wait for this long for producers to acknowledge flush requests.
   * Default 5s.
   *
   * @generated from field: optional uint32 flush_timeout_ms = 14;
   */
  flushTimeoutMs: number;

  /**
   * Wait for this long for producers to acknowledge stop requests.
   * Default 5s.
   *
   * @generated from field: optional uint32 data_source_stop_timeout_ms = 23;
   */
  dataSourceStopTimeoutMs: number;

  /**
   * Android-only. If set, sends an intent to the Traceur system app when the
   * trace ends to notify it about the trace readiness.
   *
   * @generated from field: optional bool notify_traceur = 16;
   */
  notifyTraceur: boolean;

  /**
   * This field was introduced in Android S.
   * Android-only. If set to a value > 0, marks the trace session as a candidate
   * for being attached to a bugreport. This field effectively acts as a z-index
   * for bugreports. When Android's dumpstate runs perfetto
   * --save-for-bugreport, traced will pick the tracing session with the highest
   * score (score <= 0 is ignored) and:
   * On Android S, T:  will steal its contents, save the trace into
   *     a known path and stop prematurely.
   * On Android U+: will create a read-only snapshot and save that into a known
   *     path, without stoppin the original tracing session.
   * When this field is set the tracing session becomes eligible to be cloned
   * by other UIDs.
   *
   * @generated from field: optional int32 bugreport_score = 30;
   */
  bugreportScore: number;

  /**
   * When set, defines name of the file that will be saved under
   * /data/misc/perfetto-traces/bugreport/ when using --save-all-for-bugreport.
   * If omitted, traces will be named systrace.pftrace, systrace_1.pftrace, etc,
   * starting from the highest `bugreport_score`.
   * Introduced in v42 / Android V.
   *
   * @generated from field: optional string bugreport_filename = 38;
   */
  bugreportFilename: string;

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.TriggerConfig trigger_config = 17;
   */
  triggerConfig?: TraceConfig_TriggerConfig;

  /**
   * When this is non-empty the perfetto command line tool will ignore the rest
   * of this TraceConfig and instead connect to the perfetto service as a
   * producer and send these triggers, potentially stopping or starting traces
   * that were previous configured to use a TriggerConfig.
   *
   * @generated from field: repeated string activate_triggers = 18;
   */
  activateTriggers: string[];

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.IncrementalStateConfig incremental_state_config = 21;
   */
  incrementalStateConfig?: TraceConfig_IncrementalStateConfig;

  /**
   * No longer needed as we unconditionally allow tracing on user builds.
   *
   * @generated from field: optional bool allow_user_build_tracing = 19 [deprecated = true];
   * @deprecated
   */
  allowUserBuildTracing: boolean;

  /**
   * If set the tracing service will ensure there is at most one tracing session
   * with this key.
   *
   * @generated from field: optional string unique_session_name = 22;
   */
  uniqueSessionName: string;

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.CompressionType compression_type = 24;
   */
  compressionType: TraceConfig_CompressionType;

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.IncidentReportConfig incident_report_config = 25;
   */
  incidentReportConfig?: TraceConfig_IncidentReportConfig;

  /**
   * Android-only. Not for general use. If specified, sets the logging to statsd
   * of guardrails and checkpoints in the tracing service. perfetto_cmd sets
   * this to enabled (if not explicitly set in the config) when specifying
   * --upload.
   *
   * @generated from field: optional perfetto.protos.TraceConfig.StatsdLogging statsd_logging = 31;
   */
  statsdLogging: TraceConfig_StatsdLogging;

  /**
   * An identifier clients can use to tie this trace to other logging.
   * DEPRECATED as per v32. See TracePacket.trace_uuid for the authoritative
   * Trace UUID. If this field is set, the tracing service will respect the
   * requested UUID (i.e. TracePacket.trace_uuid == this field) but only if
   * gap-less snapshotting is not used.
   *
   * @generated from field: optional int64 trace_uuid_msb = 27 [deprecated = true];
   * @deprecated
   */
  traceUuidMsb: bigint;

  /**
   * @generated from field: optional int64 trace_uuid_lsb = 28 [deprecated = true];
   * @deprecated
   */
  traceUuidLsb: bigint;

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.TraceFilter trace_filter = 33;
   */
  traceFilter?: TraceConfig_TraceFilter;

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.AndroidReportConfig android_report_config = 34;
   */
  androidReportConfig?: TraceConfig_AndroidReportConfig;

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.CmdTraceStartDelay cmd_trace_start_delay = 35;
   */
  cmdTraceStartDelay?: TraceConfig_CmdTraceStartDelay;

  /**
   * @generated from field: repeated perfetto.protos.TraceConfig.SessionSemaphore session_semaphores = 39;
   */
  sessionSemaphores: TraceConfig_SessionSemaphore[];
};

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

/**
 * @generated from message perfetto.protos.TraceConfig.BufferConfig
 */
export type TraceConfig_BufferConfig = Message<"perfetto.protos.TraceConfig.BufferConfig"> & {
  /**
   * @generated from field: optional uint32 size_kb = 1;
   */
  sizeKb: number;

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.BufferConfig.FillPolicy fill_policy = 4;
   */
  fillPolicy: TraceConfig_BufferConfig_FillPolicy;

  /**
   * When true the buffer is moved (rather than copied) onto the cloned
   * session, and an empty buffer of the same size is allocated in the source
   * tracing session. This feature will likely get deprecated in the future.
   * It been introduced mainly to support the surfaceflinger snapshot dump
   * for bugreports, where SF can dumps O(400MB) into the bugreport trace. In
   * that case we don't want to retain another in-memory copy of the buffer.
   *
   * @generated from field: optional bool transfer_on_clone = 5;
   */
  transferOnClone: boolean;

  /**
   * Used in conjunction with transfer_on_clone. When true the buffer is
   * cleared before issuing the Flush(reason=kTraceClone). This is to ensure
   * that if the data source took too long to write the data in a previous
   * clone-related flush, we don't end up with a mixture of leftovers from
   * the previous write and new data.
   *
   * @generated from field: optional bool clear_before_clone = 6;
   */
  clearBeforeClone: boolean;
};

/**
 * Describes the message perfetto.protos.TraceConfig.BufferConfig.
 * Use `create(TraceConfig_BufferConfigSchema)` to create a new message.
 */
export const TraceConfig_BufferConfigSchema: GenMessage<TraceConfig_BufferConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 0);

/**
 * @generated from enum perfetto.protos.TraceConfig.BufferConfig.FillPolicy
 */
export enum TraceConfig_BufferConfig_FillPolicy {
  /**
   * @generated from enum value: UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

  /**
   * Default behavior. The buffer operates as a conventional ring buffer.
   * If the writer is faster than the reader (or if the reader reads only
   * after tracing is stopped) newly written packets will overwrite old
   * packets.
   *
   * @generated from enum value: RING_BUFFER = 1;
   */
  RING_BUFFER = 1,

  /**
   * Behaves like RING_BUFFER as long as there is space in the buffer or
   * the reader catches up with the writer. As soon as the writer hits
   * an unread chunk, it stops accepting new data in the buffer.
   *
   * @generated from enum value: DISCARD = 2;
   */
  DISCARD = 2,
}

/**
 * Describes the enum perfetto.protos.TraceConfig.BufferConfig.FillPolicy.
 */
export const TraceConfig_BufferConfig_FillPolicySchema: GenEnum<TraceConfig_BufferConfig_FillPolicy> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_config_trace_config, 0, 0, 0);

/**
 * @generated from message perfetto.protos.TraceConfig.DataSource
 */
export type TraceConfig_DataSource = Message<"perfetto.protos.TraceConfig.DataSource"> & {
  /**
   * Filters and data-source specific config. It contains also the unique name
   * of the data source, the one passed in the  DataSourceDescriptor when they
   * register on the service.
   *
   * @generated from field: optional perfetto.protos.DataSourceConfig config = 1;
   */
  config?: DataSourceConfig;

  /**
   * Optional. If multiple producers (~processes) expose the same data source
   * and either |producer_name_filter| or |producer_name_regex_filter| is set,
   * the data source is enabled only for producers whose names match any of
   * the filters.
   * |producer_name_filter| has to be an exact match, while
   * |producer_name_regex_filter| is a regular expression.
   * This allows to enable a data source only for specific processes.
   * The "repeated" fields have OR semantics: specifying a filter ["foo",
   * "bar"] will enable data sources on both "foo" and "bar" (if they exist).
   *
   * @generated from field: repeated string producer_name_filter = 2;
   */
  producerNameFilter: string[];

  /**
   * @generated from field: repeated string producer_name_regex_filter = 3;
   */
  producerNameRegexFilter: string[];
};

/**
 * Describes the message perfetto.protos.TraceConfig.DataSource.
 * Use `create(TraceConfig_DataSourceSchema)` to create a new message.
 */
export const TraceConfig_DataSourceSchema: GenMessage<TraceConfig_DataSource> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 1);

/**
 * Config for disabling builtin data sources in the tracing service.
 *
 * @generated from message perfetto.protos.TraceConfig.BuiltinDataSource
 */
export type TraceConfig_BuiltinDataSource = Message<"perfetto.protos.TraceConfig.BuiltinDataSource"> & {
  /**
   * Disable emitting clock timestamps into the trace.
   *
   * @generated from field: optional bool disable_clock_snapshotting = 1;
   */
  disableClockSnapshotting: boolean;

  /**
   * Disable echoing the original trace config in the trace.
   *
   * @generated from field: optional bool disable_trace_config = 2;
   */
  disableTraceConfig: boolean;

  /**
   * Disable emitting system info (build fingerprint, cpuinfo, etc).
   *
   * @generated from field: optional bool disable_system_info = 3;
   */
  disableSystemInfo: boolean;

  /**
   * Disable emitting events for data-source state changes (e.g. the marker
   * for all data sources having ACKed the start of the trace).
   *
   * @generated from field: optional bool disable_service_events = 4;
   */
  disableServiceEvents: boolean;

  /**
   * The authoritative clock domain for the trace. Defaults to BOOTTIME. See
   * also ClockSnapshot's primary_trace_clock. The configured value is written
   * into the trace as part of the ClockSnapshots emitted by the service.
   * Trace processor will attempt to translate packet/event timestamps from
   * various data sources (and their chosen clock domains) to this domain
   * during import. Added in Android R.
   *
   * @generated from field: optional perfetto.protos.BuiltinClock primary_trace_clock = 5;
   */
  primaryTraceClock: BuiltinClock;

  /**
   * Time interval in between snapshotting of sync markers, clock snapshots,
   * stats, and other periodic service-emitted events. Note that the service
   * only keeps track of the first and the most recent snapshot until
   * ReadBuffers() is called.
   *
   * @generated from field: optional uint32 snapshot_interval_ms = 6;
   */
  snapshotIntervalMs: number;

  /**
   * Hints to the service that a suspend-aware (i.e. counting time in suspend)
   * clock should be used for periodic snapshots of service-emitted events.
   * This means, if a snapshot *should* have happened during suspend, it will
   * happen immediately after the device resumes.
   *
   * Choosing a clock like this is done on best-effort basis; not all
   * platforms (e.g. Windows) expose a clock which can be used for periodic
   * tasks counting suspend. If such a clock is not available, the service
   * falls back to the best-available alternative.
   *
   * Introduced in Android S.
   * TODO(lalitm): deprecate this in T and make this the default if nothing
   * crashes in S.
   *
   * @generated from field: optional bool prefer_suspend_clock_for_snapshot = 7;
   */
  preferSuspendClockForSnapshot: boolean;

  /**
   * Disables the reporting of per-trace-writer histograms in TraceStats.
   *
   * @generated from field: optional bool disable_chunk_usage_histograms = 8;
   */
  disableChunkUsageHistograms: boolean;
};

/**
 * Describes the message perfetto.protos.TraceConfig.BuiltinDataSource.
 * Use `create(TraceConfig_BuiltinDataSourceSchema)` to create a new message.
 */
export const TraceConfig_BuiltinDataSourceSchema: GenMessage<TraceConfig_BuiltinDataSource> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 2);

/**
 * @generated from message perfetto.protos.TraceConfig.ProducerConfig
 */
export type TraceConfig_ProducerConfig = Message<"perfetto.protos.TraceConfig.ProducerConfig"> & {
  /**
   * Identifies the producer for which this config is for.
   *
   * @generated from field: optional string producer_name = 1;
   */
  producerName: string;

  /**
   * Specifies the preferred size of the shared memory buffer. If the size is
   * larger than the max size, the max will be used. If it is smaller than
   * the page size or doesn't fit pages evenly into it, it will fall back to
   * the size specified by the producer or finally the default shared memory
   * size.
   *
   * @generated from field: optional uint32 shm_size_kb = 2;
   */
  shmSizeKb: number;

  /**
   * Specifies the preferred size of each page in the shared memory buffer.
   * Must be an integer multiple of 4K.
   *
   * @generated from field: optional uint32 page_size_kb = 3;
   */
  pageSizeKb: number;
};

/**
 * Describes the message perfetto.protos.TraceConfig.ProducerConfig.
 * Use `create(TraceConfig_ProducerConfigSchema)` to create a new message.
 */
export const TraceConfig_ProducerConfigSchema: GenMessage<TraceConfig_ProducerConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 3);

/**
 * Contains statsd-specific metadata about an alert associated with the trace.
 *
 * @generated from message perfetto.protos.TraceConfig.StatsdMetadata
 */
export type TraceConfig_StatsdMetadata = Message<"perfetto.protos.TraceConfig.StatsdMetadata"> & {
  /**
   * The identifier of the alert which triggered this trace.
   *
   * @generated from field: optional int64 triggering_alert_id = 1;
   */
  triggeringAlertId: bigint;

  /**
   * The uid which registered the triggering configuration with statsd.
   *
   * @generated from field: optional int32 triggering_config_uid = 2;
   */
  triggeringConfigUid: number;

  /**
   * The identifier of the config which triggered the alert.
   *
   * @generated from field: optional int64 triggering_config_id = 3;
   */
  triggeringConfigId: bigint;

  /**
   * The identifier of the subscription which triggered this trace.
   *
   * @generated from field: optional int64 triggering_subscription_id = 4;
   */
  triggeringSubscriptionId: bigint;
};

/**
 * Describes the message perfetto.protos.TraceConfig.StatsdMetadata.
 * Use `create(TraceConfig_StatsdMetadataSchema)` to create a new message.
 */
export const TraceConfig_StatsdMetadataSchema: GenMessage<TraceConfig_StatsdMetadata> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 4);

/**
 * Contains flags which override the default values of the guardrails inside
 * Perfetto.
 *
 * @generated from message perfetto.protos.TraceConfig.GuardrailOverrides
 */
export type TraceConfig_GuardrailOverrides = Message<"perfetto.protos.TraceConfig.GuardrailOverrides"> & {
  /**
   * Override the default limit (in bytes) for uploading data to server within
   * a 24 hour period.
   * On R-, this override only affected userdebug builds. Since S, it also
   * affects user builds.
   * In 24Q3+ (V+), this override is a noop because upload guardrail logic
   * was removed from Perfetto.
   *
   * @generated from field: optional uint64 max_upload_per_day_bytes = 1 [deprecated = true];
   * @deprecated
   */
  maxUploadPerDayBytes: bigint;

  /**
   * Overrides the guardrail for maximum trace buffer size.
   * Available on U+
   *
   * @generated from field: optional uint32 max_tracing_buffer_size_kb = 2;
   */
  maxTracingBufferSizeKb: number;
};

/**
 * Describes the message perfetto.protos.TraceConfig.GuardrailOverrides.
 * Use `create(TraceConfig_GuardrailOverridesSchema)` to create a new message.
 */
export const TraceConfig_GuardrailOverridesSchema: GenMessage<TraceConfig_GuardrailOverrides> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 5);

/**
 * Triggers allow producers to start or stop the tracing session when an event
 * occurs.
 *
 * For example if we are tracing probabilistically, most traces will be
 * uninteresting. Triggers allow us to keep only the interesting ones such as
 * those traces during which the device temperature reached a certain
 * threshold. In this case the producer can activate a trigger to keep
 * (STOP_TRACING) the trace, otherwise it can also begin a trace
 * (START_TRACING) because it knows something is about to happen.
 *
 * @generated from message perfetto.protos.TraceConfig.TriggerConfig
 */
export type TraceConfig_TriggerConfig = Message<"perfetto.protos.TraceConfig.TriggerConfig"> & {
  /**
   * @generated from field: optional perfetto.protos.TraceConfig.TriggerConfig.TriggerMode trigger_mode = 1;
   */
  triggerMode: TraceConfig_TriggerConfig_TriggerMode;

  /**
   * This flag is really a workaround for b/274931668. This is needed only
   * when deploying configs to different versions of the tracing service.
   * When this is set to true this has the same effect of setting trigger_mode
   * to CLONE_SNAPSHOT on newer versions of the service. This boolean has been
   * introduced to allow to have configs that use CLONE_SNAPSHOT on newer
   * versions of Android and fall back to STOP_TRACING on older versions where
   * CLONE_SNAPSHOT did not exist.
   * When using this flag, trigger_mode must be set to STOP_TRACING.
   *
   * @generated from field: optional bool use_clone_snapshot_if_available = 5;
   */
  useCloneSnapshotIfAvailable: boolean;

  /**
   * A list of triggers which are related to this configuration. If ANY
   * trigger is seen then an action will be performed based on |trigger_mode|.
   *
   * @generated from field: repeated perfetto.protos.TraceConfig.TriggerConfig.Trigger triggers = 2;
   */
  triggers: TraceConfig_TriggerConfig_Trigger[];

  /**
   * Required and must be positive if a TriggerConfig is specified. This is
   * how long this TraceConfig should wait for a trigger to arrive. After this
   * period of time if no trigger is seen the TracingSession will be cleaned
   * up.
   *
   * @generated from field: optional uint32 trigger_timeout_ms = 3;
   */
  triggerTimeoutMs: number;
};

/**
 * Describes the message perfetto.protos.TraceConfig.TriggerConfig.
 * Use `create(TraceConfig_TriggerConfigSchema)` to create a new message.
 */
export const TraceConfig_TriggerConfigSchema: GenMessage<TraceConfig_TriggerConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 6);

/**
 * @generated from message perfetto.protos.TraceConfig.TriggerConfig.Trigger
 */
export type TraceConfig_TriggerConfig_Trigger = Message<"perfetto.protos.TraceConfig.TriggerConfig.Trigger"> & {
  /**
   * The producer must specify this name to activate the trigger.
   *
   * @generated from field: optional string name = 1;
   */
  name: string;

  /**
   * An std::regex that will match the producer that can activate this
   * trigger. This is optional. If unset any producers can activate this
   * trigger.
   *
   * @generated from field: optional string producer_name_regex = 2;
   */
  producerNameRegex: string;

  /**
   * After a trigger is received either in START_TRACING or STOP_TRACING
   * mode then the trace will end |stop_delay_ms| after triggering.
   * In CLONE_SNAPSHOT mode, this is the delay between the trigger and the
   * snapshot.
   * If |prefer_suspend_clock_for_duration| is set, the duration will be
   * based on wall-clock, counting also time in suspend.
   *
   * @generated from field: optional uint32 stop_delay_ms = 3;
   */
  stopDelayMs: number;

  /**
   * Limits the number of traces this trigger can start/stop in a rolling
   * 24 hour window. If this field is unset or zero, no limit is applied and
   * activiation of this trigger *always* starts/stops the trace.
   *
   * @generated from field: optional uint32 max_per_24_h = 4;
   */
  maxPer24H: number;

  /**
   * A value between 0 and 1 which encodes the probability of skipping a
   * trigger with this name. This is useful for reducing the probability
   * of high-frequency triggers from dominating trace finaization. If this
   * field is unset or zero, the trigger will *never* be skipped. If this
   * field is greater than or equal to 1, this trigger will *always* be
   * skipped i.e. it will be as if this trigger was never included in the
   * first place.
   * This probability check is applied *before* any other limits. For
   * example, if |max_per_24_h| is also set, first we will check if the
   * probability bar is met and only then will we check the |max_per_24_h|
   * limit.
   *
   * @generated from field: optional double skip_probability = 5;
   */
  skipProbability: number;
};

/**
 * Describes the message perfetto.protos.TraceConfig.TriggerConfig.Trigger.
 * Use `create(TraceConfig_TriggerConfig_TriggerSchema)` to create a new message.
 */
export const TraceConfig_TriggerConfig_TriggerSchema: GenMessage<TraceConfig_TriggerConfig_Trigger> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 6, 0);

/**
 * @generated from enum perfetto.protos.TraceConfig.TriggerConfig.TriggerMode
 */
export enum TraceConfig_TriggerConfig_TriggerMode {
  /**
   * @generated from enum value: UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

  /**
   * When this mode is chosen, data sources are not started until one of the
   * |triggers| are received. This supports early initialization and fast
   * starting of the tracing system. On triggering, the session will then
   * record for |stop_delay_ms|. However if no trigger is seen
   * after |trigger_timeout_ms| the session will be stopped and no data will
   * be returned.
   *
   * @generated from enum value: START_TRACING = 1;
   */
  START_TRACING = 1,

  /**
   * When this mode is chosen, the session will be started via the normal
   * EnableTracing() & StartTracing(). If no trigger is ever seen
   * the session will be stopped after |trigger_timeout_ms| and no data will
   * be returned. However if triggered the trace will stop after
   * |stop_delay_ms| and any data in the buffer will be returned to the
   * consumer.
   *
   * @generated from enum value: STOP_TRACING = 2;
   */
  STOP_TRACING = 2,

  /**
   * When this mode is chosen, this causes a snapshot of the current tracing
   * session to be created after |stop_delay_ms| while the current tracing
   * session continues undisturbed (% an extra flush). This mode can be
   * used only when the tracing session is handled by the "perfetto" cmdline
   * client (which is true in 90% of cases). Part of the business logic
   * necessary for this behavior, and ensuing file handling, lives in
   * perfetto_cmd.cc . On other consumers, this causes only a notification
   * of the trigger through a CloneTriggerHit ObservableEvent. The custom
   * consumer is supposed to call CloneSession() itself after the event.
   * Use use_clone_snapshot_if_available=true when targeting older versions
   * of perfetto.
   *
   * @generated from enum value: CLONE_SNAPSHOT = 4;
   */
  CLONE_SNAPSHOT = 4,
}

/**
 * Describes the enum perfetto.protos.TraceConfig.TriggerConfig.TriggerMode.
 */
export const TraceConfig_TriggerConfig_TriggerModeSchema: GenEnum<TraceConfig_TriggerConfig_TriggerMode> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_config_trace_config, 0, 6, 0);

/**
 * Configuration for trace contents that reference earlier trace data. For
 * example, a data source might intern strings, and emit packets containing
 * {interned id : string} pairs. Future packets from that data source can then
 * use the interned ids instead of duplicating the raw string contents. The
 * trace parser will then need to use that interning table to fully interpret
 * the rest of the trace.
 *
 * @generated from message perfetto.protos.TraceConfig.IncrementalStateConfig
 */
export type TraceConfig_IncrementalStateConfig = Message<"perfetto.protos.TraceConfig.IncrementalStateConfig"> & {
  /**
   * If nonzero, notify eligible data sources to clear their incremental state
   * periodically, with the given period. The notification is sent only to
   * data sources that have |handles_incremental_state_clear| set in their
   * DataSourceDescriptor. The notification requests that the data source
   * stops referring to past trace contents. This is particularly useful when
   * tracing in ring buffer mode, where it is not exceptional to overwrite old
   * trace data.
   *
   * Warning: this time-based global clearing is likely to be removed in the
   * future, to be replaced with a smarter way of sending the notifications
   * only when necessary.
   *
   * @generated from field: optional uint32 clear_period_ms = 1;
   */
  clearPeriodMs: number;
};

/**
 * Describes the message perfetto.protos.TraceConfig.IncrementalStateConfig.
 * Use `create(TraceConfig_IncrementalStateConfigSchema)` to create a new message.
 */
export const TraceConfig_IncrementalStateConfigSchema: GenMessage<TraceConfig_IncrementalStateConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 7);

/**
 * Android-only. Not for general use. If set, saves the trace into an
 * incident. This field is read by perfetto_cmd, rather than the tracing
 * service. This field must be set when passing the --upload flag to
 * perfetto_cmd.
 *
 * In this message, either:
 *  * all of |destination_package|, |destination_class| and |privacy_level|
 *    must be set.
 *  * |skip_incidentd| must be explicitly set to true.
 *
 * @generated from message perfetto.protos.TraceConfig.IncidentReportConfig
 */
export type TraceConfig_IncidentReportConfig = Message<"perfetto.protos.TraceConfig.IncidentReportConfig"> & {
  /**
   * @generated from field: optional string destination_package = 1;
   */
  destinationPackage: string;

  /**
   * @generated from field: optional string destination_class = 2;
   */
  destinationClass: string;

  /**
   * Level of filtering in the requested incident. See |Destination| in
   * frameworks/base/core/proto/android/privacy.proto.
   *
   * @generated from field: optional int32 privacy_level = 3;
   */
  privacyLevel: number;

  /**
   * If true, then skips saving the trace to incidentd.
   *
   * This flag is useful in testing (e.g. Perfetto-statsd integration tests)
   * or when we explicitly don't want traces to go to incidentd even when they
   * usually would (e.g. configs deployed using statsd but only used for
   * inclusion in bugreports using |bugreport_score|).
   *
   * The motivation for having this flag, instead of just not setting
   * |incident_report_config|, is prevent accidents where
   * |incident_report_config| is omitted by mistake.
   *
   * @generated from field: optional bool skip_incidentd = 5;
   */
  skipIncidentd: boolean;

  /**
   * If true, do not write the trace into dropbox (i.e. incident only).
   * Otherwise, write to both dropbox and incident.
   * TODO(lalitm): remove this field as we no longer use Dropbox.
   *
   * @generated from field: optional bool skip_dropbox = 4 [deprecated = true];
   * @deprecated
   */
  skipDropbox: boolean;
};

/**
 * Describes the message perfetto.protos.TraceConfig.IncidentReportConfig.
 * Use `create(TraceConfig_IncidentReportConfigSchema)` to create a new message.
 */
export const TraceConfig_IncidentReportConfigSchema: GenMessage<TraceConfig_IncidentReportConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 8);

/**
 * When set applies a post-filter to the trace contents using the filter
 * provided. The filter is applied at ReadBuffers() time and works both in the
 * case of IPC readback and write_into_file. This filter can be generated
 * using `tools/proto_filter -s schema.proto -F filter_out.bytes` or
 * `-T filter_out.escaped_string` (for .pbtx). See go/trace-filtering for
 * design.
 *
 * Introduced in Android S, but it was broken (b/195065199). Reintroduced in
 * Android T with a different field number. Updated in Android U with a new
 * bytecode version which supports string filtering.
 *
 * =========================
 * Filter bytecode.
 * =========================
 *
 * @generated from message perfetto.protos.TraceConfig.TraceFilter
 */
export type TraceConfig_TraceFilter = Message<"perfetto.protos.TraceConfig.TraceFilter"> & {
  /**
   * The bytecode as implemented in Android T.
   *
   * @generated from field: optional bytes bytecode = 1;
   */
  bytecode: Uint8Array;

  /**
   * The bytecode as implemented in Android U. Adds support for string
   * filtering.
   *
   * @generated from field: optional bytes bytecode_v2 = 2;
   */
  bytecodeV2: Uint8Array;

  /**
   * @generated from field: optional perfetto.protos.TraceConfig.TraceFilter.StringFilterChain string_filter_chain = 3;
   */
  stringFilterChain?: TraceConfig_TraceFilter_StringFilterChain;
};

/**
 * Describes the message perfetto.protos.TraceConfig.TraceFilter.
 * Use `create(TraceConfig_TraceFilterSchema)` to create a new message.
 */
export const TraceConfig_TraceFilterSchema: GenMessage<TraceConfig_TraceFilter> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 9);

/**
 * A rule specifies how strings should be filtered.
 *
 * @generated from message perfetto.protos.TraceConfig.TraceFilter.StringFilterRule
 */
export type TraceConfig_TraceFilter_StringFilterRule = Message<"perfetto.protos.TraceConfig.TraceFilter.StringFilterRule"> & {
  /**
   * The policy (i.e. algorithm) dictating how strings matching this rule
   * should be handled.
   *
   * @generated from field: optional perfetto.protos.TraceConfig.TraceFilter.StringFilterPolicy policy = 1;
   */
  policy: TraceConfig_TraceFilter_StringFilterPolicy;

  /**
   * The regex pattern used to match against each string.
   *
   * @generated from field: optional string regex_pattern = 2;
   */
  regexPattern: string;

  /**
   * The string which should appear after the tgid in atrace tracepoint
   * strings.
   *
   * @generated from field: optional string atrace_payload_starts_with = 3;
   */
  atracePayloadStartsWith: string;
};

/**
 * Describes the message perfetto.protos.TraceConfig.TraceFilter.StringFilterRule.
 * Use `create(TraceConfig_TraceFilter_StringFilterRuleSchema)` to create a new message.
 */
export const TraceConfig_TraceFilter_StringFilterRuleSchema: GenMessage<TraceConfig_TraceFilter_StringFilterRule> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 9, 0);

/**
 * A chain is a list of rules which string will be sequentially checked
 * against.
 *
 * @generated from message perfetto.protos.TraceConfig.TraceFilter.StringFilterChain
 */
export type TraceConfig_TraceFilter_StringFilterChain = Message<"perfetto.protos.TraceConfig.TraceFilter.StringFilterChain"> & {
  /**
   * @generated from field: repeated perfetto.protos.TraceConfig.TraceFilter.StringFilterRule rules = 1;
   */
  rules: TraceConfig_TraceFilter_StringFilterRule[];
};

/**
 * Describes the message perfetto.protos.TraceConfig.TraceFilter.StringFilterChain.
 * Use `create(TraceConfig_TraceFilter_StringFilterChainSchema)` to create a new message.
 */
export const TraceConfig_TraceFilter_StringFilterChainSchema: GenMessage<TraceConfig_TraceFilter_StringFilterChain> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 9, 1);

/**
 * A policy specifies which algorithm should be used for filtering the
 * string.
 *
 * @generated from enum perfetto.protos.TraceConfig.TraceFilter.StringFilterPolicy
 */
export enum TraceConfig_TraceFilter_StringFilterPolicy {
  /**
   * @generated from enum value: SFP_UNSPECIFIED = 0;
   */
  SFP_UNSPECIFIED = 0,

  /**
   * Tries to match the string field against |regex_pattern|. If it
   * matches, all matching groups are "redacted" (i.e. replaced with a
   * constant string) and filtering is terminated (i.e. no further rules are
   * checked). If it doesn't match, the string is left unchanged and the
   * next rule in chain is considered.
   *
   * @generated from enum value: SFP_MATCH_REDACT_GROUPS = 1;
   */
  SFP_MATCH_REDACT_GROUPS = 1,

  /**
   * Like |SFP_MATCH_REDACT_GROUPS| but tries to do some pre-work before
   * checking the regex. Specifically, it tries to parse the string field as
   * an atrace tracepoint and checks if the post-tgid field starts with
   * |atrace_post_tgid_starts_with|. The regex matching is only performed if
   * this check succeeds.
   *
   * @generated from enum value: SFP_ATRACE_MATCH_REDACT_GROUPS = 2;
   */
  SFP_ATRACE_MATCH_REDACT_GROUPS = 2,

  /**
   * Tries to match the string field against |regex_pattern|. If it
   * matches, filtering is terminated (i.e. no further rules are checked).
   * If it doesn't match, the string is left unchanged and the next rule in
   * chain is considered.
   *
   * @generated from enum value: SFP_MATCH_BREAK = 3;
   */
  SFP_MATCH_BREAK = 3,

  /**
   * Like |SFP_MATCH_BREAK| but tries to do some pre-work before checking
   * the regex. Specifically, it tries to parse the string field as an
   * atrace tracepoint and checks if the post-tgid field starts with
   * |atrace_post_tgid_starts_with|. The regex matching is only performed if
   * this check succeeds.
   *
   * @generated from enum value: SFP_ATRACE_MATCH_BREAK = 4;
   */
  SFP_ATRACE_MATCH_BREAK = 4,

  /**
   * Tries to repeatedly search (i.e. find substrings of) the string field
   * with |regex_pattern|. For each match, redacts any matching groups (i.e.
   * replaced with a constant string). Once there are no further matches,
   * filtering is terminated (i.e. no further rules are checked).
   *
   * Note that this is policy is a "search" policy not a "match" policy
   * unlike the above policies:
   *  * Match policies require matching the full string i.e. there is an
   *    implicit leading `^` and trailing `$`.
   *  * Search policies perform repeated partial matching of the string
   *    e.g.
   *      - String: `foo=aaa,bar=123,foo=bbb,baz=456`
   *      - Pattern: `foo=(\d+)`
   *      - Output: `foo=P6O,bar=123,foo=P6O,baz=456`
   *    where P6O is the redaction string
   *
   * All of this is only performed after some pre-work where we try to parse
   * the string field as an atrace tracepoint and check if the post-tgid
   * field starts with |atrace_post_tgid_starts_with|.
   *
   * If there are no partial matches, the string is left unchanged and the
   * next rule in chain is considered.
   *
   * @generated from enum value: SFP_ATRACE_REPEATED_SEARCH_REDACT_GROUPS = 5;
   */
  SFP_ATRACE_REPEATED_SEARCH_REDACT_GROUPS = 5,
}

/**
 * Describes the enum perfetto.protos.TraceConfig.TraceFilter.StringFilterPolicy.
 */
export const TraceConfig_TraceFilter_StringFilterPolicySchema: GenEnum<TraceConfig_TraceFilter_StringFilterPolicy> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_config_trace_config, 0, 9, 0);

/**
 * Android-only. Not for general use. If set, reports the trace to the
 * Android framework. This field is read by perfetto_cmd, rather than the
 * tracing service. This field must be set when passing the --upload flag to
 * perfetto_cmd.
 *
 * In this message, either:
 *  * |reporter_service_package| and |reporter_service_class| must be set.
 *  * |skip_reporting| must be explicitly set to true.
 *
 * @generated from message perfetto.protos.TraceConfig.AndroidReportConfig
 */
export type TraceConfig_AndroidReportConfig = Message<"perfetto.protos.TraceConfig.AndroidReportConfig"> & {
  /**
   * @generated from field: optional string reporter_service_package = 1;
   */
  reporterServicePackage: string;

  /**
   * @generated from field: optional string reporter_service_class = 2;
   */
  reporterServiceClass: string;

  /**
   * If true, then skips reporting the trace to Android framework.
   *
   * This flag is useful in testing (e.g. Perfetto-statsd integration tests)
   * or when we explicitly don't want to report traces to the framework even
   * when they usually would (e.g. configs deployed using statsd but only
   * used for inclusion in bugreports using |bugreport_score|).
   *
   * The motivation for having this flag, instead of just not setting
   * |framework_report_config|, is prevent accidents where
   * |framework_report_config| is omitted by mistake.
   *
   * @generated from field: optional bool skip_report = 3;
   */
  skipReport: boolean;

  /**
   * If true, will direct the Android framework to read the data in trace
   * file and pass it to the reporter class over a pipe instead of passing
   * the file descriptor directly.
   *
   * This flag is needed because the Android test framework does not
   * currently support priv-app helper apps (in terms of SELinux) and we
   * really don't want to add an allow rule for untrusted_app to receive
   * trace fds.
   *
   * Because of this, we instead will direct the framework to create a new
   * pipe and pass this to the reporter process instead. As the pipe is
   * created by the framework, we won't have any problems with SELinux
   * (system_server is already allowed to pass pipe fds, even
   * to untrusted apps).
   *
   * As the name suggests this option *MUST* only be used for testing.
   * Note that the framework will reject (and drop) files which are too
   * large both for simplicity and to be minimize the amount of data we
   * pass to a non-priv app (note that the framework will still check
   * manifest permissions even though SELinux permissions are worked around).
   *
   * @generated from field: optional bool use_pipe_in_framework_for_testing = 4;
   */
  usePipeInFrameworkForTesting: boolean;
};

/**
 * Describes the message perfetto.protos.TraceConfig.AndroidReportConfig.
 * Use `create(TraceConfig_AndroidReportConfigSchema)` to create a new message.
 */
export const TraceConfig_AndroidReportConfigSchema: GenMessage<TraceConfig_AndroidReportConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 10);

/**
 * If set, delays the start of tracing by a random duration. The duration is
 * chosen from a uniform distribution between the specified minimum and
 * maximum.
 * Note: this delay is implemented by perfetto_cmd *not* by traced so will
 * not work if you communicate with traced directly over the consumer API.
 * Introduced in Android T.
 *
 * @generated from message perfetto.protos.TraceConfig.CmdTraceStartDelay
 */
export type TraceConfig_CmdTraceStartDelay = Message<"perfetto.protos.TraceConfig.CmdTraceStartDelay"> & {
  /**
   * @generated from field: optional uint32 min_delay_ms = 1;
   */
  minDelayMs: number;

  /**
   * @generated from field: optional uint32 max_delay_ms = 2;
   */
  maxDelayMs: number;
};

/**
 * Describes the message perfetto.protos.TraceConfig.CmdTraceStartDelay.
 * Use `create(TraceConfig_CmdTraceStartDelaySchema)` to create a new message.
 */
export const TraceConfig_CmdTraceStartDelaySchema: GenMessage<TraceConfig_CmdTraceStartDelay> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 11);

/**
 * When non-empty, ensures that for a each semaphore named `name at most
 * `max_other_session_count`` *other* sessions (whose value is taken of the
 * minimum of all values specified by this config or any already-running
 * session) can be be running.
 *
 * If a semaphore "acquisition" fails, EnableTracing will return an error
 * and the tracing session will not be started (or elgible to start in
 * the case of deferred sessions).
 *
 * This is easiest to explain with an example. Suppose the tracing service has
 * the following active tracing sessions:
 *   S1 = [{name=foo, max_other_session_count=2},
 *         {name=bar, max_other_session_count=0}]
 *   S2 = [{name=foo, max_other_session_count=1},
 *         {name=baz, max_other_session_count=1}]
 *
 * Then, for a new session, the following would be the expected behaviour of
 * EnableSession given the state of `session_semaphores`.
 *   Q: session_semaphores = []
 *   A: Allowed because it does not specify any semaphores. Will be allowed
 *      no matter the state of any other tracing session.
 *   Q: session_semaphores = [{name=baz, max_other_session_count=1}]
 *   A: Allowed because both S2 and this config specify
 *      max_other_session_count=1 for baz.
 *   Q: session_semaphores = [{name=foo, max_other_session_count=3}]
 *   A: Denied because S2 specified max_other_session_count=1 for foo and S1
 *      takes that slot.
 *   Q: session_semaphores = [{name=bar, max_other_session_count=0}]
 *   A: Denied because S1 takes the the slot specified by both S1 and
 *      this config.
 *
 * Introduced in 24Q3 (Android V).
 *
 * @generated from message perfetto.protos.TraceConfig.SessionSemaphore
 */
export type TraceConfig_SessionSemaphore = Message<"perfetto.protos.TraceConfig.SessionSemaphore"> & {
  /**
   * The name of the semaphore. Acts as a unique identifier across all
   * tracing sessions (including the one being started).
   *
   * @generated from field: optional string name = 1;
   */
  name: string;

  /**
   * The maximum number of *other* sesssions which specify the same semaphore
   * which can be active. The minimum of this value across all tracing
   * sessions and the value specified by the config is used when deciding
   * whether the tracing session can be started.
   *
   * @generated from field: optional uint64 max_other_session_count = 2;
   */
  maxOtherSessionCount: bigint;
};

/**
 * Describes the message perfetto.protos.TraceConfig.SessionSemaphore.
 * Use `create(TraceConfig_SessionSemaphoreSchema)` to create a new message.
 */
export const TraceConfig_SessionSemaphoreSchema: GenMessage<TraceConfig_SessionSemaphore> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_trace_config, 0, 12);

/**
 * @generated from enum perfetto.protos.TraceConfig.LockdownModeOperation
 */
export enum TraceConfig_LockdownModeOperation {
  /**
   * @generated from enum value: LOCKDOWN_UNCHANGED = 0;
   */
  LOCKDOWN_UNCHANGED = 0,

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

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

/**
 * Describes the enum perfetto.protos.TraceConfig.LockdownModeOperation.
 */
export const TraceConfig_LockdownModeOperationSchema: GenEnum<TraceConfig_LockdownModeOperation> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_config_trace_config, 0, 0);

/**
 * Compress trace with the given method. Best effort.
 *
 * @generated from enum perfetto.protos.TraceConfig.CompressionType
 */
export enum TraceConfig_CompressionType {
  /**
   * @generated from enum value: COMPRESSION_TYPE_UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

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

/**
 * Describes the enum perfetto.protos.TraceConfig.CompressionType.
 */
export const TraceConfig_CompressionTypeSchema: GenEnum<TraceConfig_CompressionType> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_config_trace_config, 0, 1);

/**
 * @generated from enum perfetto.protos.TraceConfig.StatsdLogging
 */
export enum TraceConfig_StatsdLogging {
  /**
   * @generated from enum value: STATSD_LOGGING_UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

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

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

/**
 * Describes the enum perfetto.protos.TraceConfig.StatsdLogging.
 */
export const TraceConfig_StatsdLoggingSchema: GenEnum<TraceConfig_StatsdLogging> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_config_trace_config, 0, 2);

