//
// Copyright (C) 2020 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/track_event/counter_descriptor.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/track_event/counter_descriptor.proto.
 */
export const file_protos_perfetto_trace_track_event_counter_descriptor: GenFile = /*@__PURE__*/
  fileDesc("Cjpwcm90b3MvcGVyZmV0dG8vdHJhY2UvdHJhY2tfZXZlbnQvY291bnRlcl9kZXNjcmlwdG9yLnByb3RvEg9wZXJmZXR0by5wcm90b3MirQMKEUNvdW50ZXJEZXNjcmlwdG9yEkMKBHR5cGUYASABKA4yNS5wZXJmZXR0by5wcm90b3MuQ291bnRlckRlc2NyaXB0b3IuQnVpbHRpbkNvdW50ZXJUeXBlEhIKCmNhdGVnb3JpZXMYAiADKAkSNQoEdW5pdBgDIAEoDjInLnBlcmZldHRvLnByb3Rvcy5Db3VudGVyRGVzY3JpcHRvci5Vbml0EhEKCXVuaXRfbmFtZRgGIAEoCRIXCg91bml0X211bHRpcGxpZXIYBCABKAMSFgoOaXNfaW5jcmVtZW50YWwYBSABKAgibwoSQnVpbHRpbkNvdW50ZXJUeXBlEhcKE0NPVU5URVJfVU5TUEVDSUZJRUQQABIaChZDT1VOVEVSX1RIUkVBRF9USU1FX05TEAESJAogQ09VTlRFUl9USFJFQURfSU5TVFJVQ1RJT05fQ09VTlQQAiJTCgRVbml0EhQKEFVOSVRfVU5TUEVDSUZJRUQQABIQCgxVTklUX1RJTUVfTlMQARIOCgpVTklUX0NPVU5UEAISEwoPVU5JVF9TSVpFX0JZVEVTEAM");

/**
 * Defines properties of a counter track, e.g. for built-in counters (thread
 * time, instruction count, ..) or user-specified counters (e.g. memory usage of
 * a specific app component).
 *
 * Counter tracks only support TYPE_COUNTER track events, which specify new
 * values for the counter. For counters that require per-slice values, counter
 * values can instead be provided in a more efficient encoding via TrackEvent's
 * |extra_counter_track_uuids| and |extra_counter_values| fields. However,
 * slice-type events cannot be emitted onto a counter track.
 *
 * Values for counters that are only emitted on a single packet sequence can
 * optionally be delta-encoded, see |is_incremental|.
 *
 * Next id: 7.
 *
 * @generated from message perfetto.protos.CounterDescriptor
 */
export type CounterDescriptor = Message<"perfetto.protos.CounterDescriptor"> & {
  /**
   * For built-in counters (e.g. thread time). Custom user-specified counters
   * (e.g. those emitted by TRACE_COUNTER macros of the client library)
   * shouldn't set this, and instead provide a counter name via TrackDescriptor.
   *
   * @generated from field: optional perfetto.protos.CounterDescriptor.BuiltinCounterType type = 1;
   */
  type: CounterDescriptor_BuiltinCounterType;

  /**
   * Names of categories of the counter (usually for user-specified counters).
   * In the client library, categories are a way to turn groups of individual
   * counters (or events) on or off.
   *
   * @generated from field: repeated string categories = 2;
   */
  categories: string[];

  /**
   * Type of the counter's values. Built-in counters imply a value for this
   * field.
   *
   * @generated from field: optional perfetto.protos.CounterDescriptor.Unit unit = 3;
   */
  unit: CounterDescriptor_Unit;

  /**
   * In order to use a unit not defined as a part of |Unit|, a free-form unit
   * name can be used instead.
   *
   * @generated from field: optional string unit_name = 6;
   */
  unitName: string;

  /**
   * Multiplication factor of this counter's values, e.g. to supply
   * COUNTER_THREAD_TIME_NS timestamps in microseconds instead.
   *
   * @generated from field: optional int64 unit_multiplier = 4;
   */
  unitMultiplier: bigint;

  /**
   * Whether values for this counter are provided as delta values. Only
   * supported for counters that are emitted on a single packet-sequence (e.g.
   * thread time). Counter values in subsequent packets on the current packet
   * sequence will be interpreted as delta values from the sequence's most
   * recent value for the counter. When incremental state is cleared, the
   * counter value is considered to be reset to 0. Thus, the first value after
   * incremental state is cleared is effectively an absolute value.
   *
   * @generated from field: optional bool is_incremental = 5;
   */
  isIncremental: boolean;
};

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

/**
 * Built-in counters, usually with special meaning in the client library,
 * trace processor, legacy JSON format, or UI. Trace processor will infer a
 * track name from the enum value if none is provided in TrackDescriptor.
 *
 * @generated from enum perfetto.protos.CounterDescriptor.BuiltinCounterType
 */
export enum CounterDescriptor_BuiltinCounterType {
  /**
   * @generated from enum value: COUNTER_UNSPECIFIED = 0;
   */
  COUNTER_UNSPECIFIED = 0,

  /**
   * implies UNIT_TIME_NS.
   *
   * @generated from enum value: COUNTER_THREAD_TIME_NS = 1;
   */
  COUNTER_THREAD_TIME_NS = 1,

  /**
   * implies UNIT_COUNT.
   *
   * @generated from enum value: COUNTER_THREAD_INSTRUCTION_COUNT = 2;
   */
  COUNTER_THREAD_INSTRUCTION_COUNT = 2,
}

/**
 * Describes the enum perfetto.protos.CounterDescriptor.BuiltinCounterType.
 */
export const CounterDescriptor_BuiltinCounterTypeSchema: GenEnum<CounterDescriptor_BuiltinCounterType> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_track_event_counter_descriptor, 0, 0);

/**
 * Type of the values for the counters - to supply lower granularity units,
 * see also |unit_multiplier|.
 *
 * @generated from enum perfetto.protos.CounterDescriptor.Unit
 */
export enum CounterDescriptor_Unit {
  /**
   * @generated from enum value: UNIT_UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

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

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

  /**
   * TODO(eseckler): Support more units as necessary.
   *
   * @generated from enum value: UNIT_SIZE_BYTES = 3;
   */
  SIZE_BYTES = 3,
}

/**
 * Describes the enum perfetto.protos.CounterDescriptor.Unit.
 */
export const CounterDescriptor_UnitSchema: GenEnum<CounterDescriptor_Unit> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_trace_track_event_counter_descriptor, 0, 1);

