//
// Copyright (C) 2019 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/tracing_service_state.proto (package perfetto.protos, syntax proto2)
/* eslint-disable */

import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
import type { DataSourceDescriptor } from "./data_source_descriptor_pb";
import { file_protos_perfetto_common_data_source_descriptor } from "./data_source_descriptor_pb";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/common/tracing_service_state.proto.
 */
export const file_protos_perfetto_common_tracing_service_state: GenFile = /*@__PURE__*/
  fileDesc("CjJwcm90b3MvcGVyZmV0dG8vY29tbW9uL3RyYWNpbmdfc2VydmljZV9zdGF0ZS5wcm90bxIPcGVyZmV0dG8ucHJvdG9zIrcGChNUcmFjaW5nU2VydmljZVN0YXRlEkAKCXByb2R1Y2VycxgBIAMoCzItLnBlcmZldHRvLnByb3Rvcy5UcmFjaW5nU2VydmljZVN0YXRlLlByb2R1Y2VyEkUKDGRhdGFfc291cmNlcxgCIAMoCzIvLnBlcmZldHRvLnByb3Rvcy5UcmFjaW5nU2VydmljZVN0YXRlLkRhdGFTb3VyY2USTQoQdHJhY2luZ19zZXNzaW9ucxgGIAMoCzIzLnBlcmZldHRvLnByb3Rvcy5UcmFjaW5nU2VydmljZVN0YXRlLlRyYWNpbmdTZXNzaW9uEiEKGXN1cHBvcnRzX3RyYWNpbmdfc2Vzc2lvbnMYByABKAgSFAoMbnVtX3Nlc3Npb25zGAMgASgFEhwKFG51bV9zZXNzaW9uc19zdGFydGVkGAQgASgFEh8KF3RyYWNpbmdfc2VydmljZV92ZXJzaW9uGAUgASgJGmMKCFByb2R1Y2VyEgoKAmlkGAEgASgFEgwKBG5hbWUYAiABKAkSCwoDcGlkGAUgASgFEgsKA3VpZBgDIAEoBRITCgtzZGtfdmVyc2lvbhgEIAEoCRIOCgZmcm96ZW4YBiABKAgaXwoKRGF0YVNvdXJjZRI8Cg1kc19kZXNjcmlwdG9yGAEgASgLMiUucGVyZmV0dG8ucHJvdG9zLkRhdGFTb3VyY2VEZXNjcmlwdG9yEhMKC3Byb2R1Y2VyX2lkGAIgASgFGokCCg5UcmFjaW5nU2Vzc2lvbhIKCgJpZBgBIAEoBBIUCgxjb25zdW1lcl91aWQYAiABKAUSDQoFc3RhdGUYAyABKAkSGwoTdW5pcXVlX3Nlc3Npb25fbmFtZRgEIAEoCRIWCg5idWZmZXJfc2l6ZV9rYhgFIAMoDRITCgtkdXJhdGlvbl9tcxgGIAEoDRIYChBudW1fZGF0YV9zb3VyY2VzGAcgASgNEhkKEXN0YXJ0X3JlYWx0aW1lX25zGAggASgDEhcKD2J1Z3JlcG9ydF9zY29yZRgJIAEoBRIaChJidWdyZXBvcnRfZmlsZW5hbWUYCiABKAkSEgoKaXNfc3RhcnRlZBgLIAEoCA", [file_protos_perfetto_common_data_source_descriptor]);

/**
 * Reports the state of the tracing service. Used to gather details about the
 * data sources connected.
 * See ConsumerPort::QueryServiceState().
 *
 * @generated from message perfetto.protos.TracingServiceState
 */
export type TracingServiceState = Message<"perfetto.protos.TracingServiceState"> & {
  /**
   * Lists all the producers connected.
   *
   * @generated from field: repeated perfetto.protos.TracingServiceState.Producer producers = 1;
   */
  producers: TracingServiceState_Producer[];

  /**
   * Lists the data sources available.
   *
   * @generated from field: repeated perfetto.protos.TracingServiceState.DataSource data_sources = 2;
   */
  dataSources: TracingServiceState_DataSource[];

  /**
   * Lists the tracing sessions active AND owned by a consumer that has the same
   * UID of the caller (or all of them if the caller is root).
   * Introduced in v24 / Android T.
   *
   * @generated from field: repeated perfetto.protos.TracingServiceState.TracingSession tracing_sessions = 6;
   */
  tracingSessions: TracingServiceState_TracingSession[];

  /**
   * This is always set to true from v24 and beyond. This flag is only used to
   * tell the difference between: (1) talking to a recent service which happens
   * to have no tracing session active; (2) talking to an older version of the
   * service which will never report any tracing session.
   *
   * @generated from field: optional bool supports_tracing_sessions = 7;
   */
  supportsTracingSessions: boolean;

  /**
   * Total number of tracing sessions.
   *
   * @generated from field: optional int32 num_sessions = 3;
   */
  numSessions: number;

  /**
   * Number of tracing sessions in the started state. Always <= num_sessions.
   *
   * @generated from field: optional int32 num_sessions_started = 4;
   */
  numSessionsStarted: number;

  /**
   * The version of traced (the same returned by `traced --version`).
   * This is a human readable string with and its format varies depending on
   * the build system and the repo (standalone vs AOSP).
   * This is intended for human debugging only.
   *
   * @generated from field: optional string tracing_service_version = 5;
   */
  tracingServiceVersion: string;
};

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

/**
 * Describes a producer process.
 *
 * @generated from message perfetto.protos.TracingServiceState.Producer
 */
export type TracingServiceState_Producer = Message<"perfetto.protos.TracingServiceState.Producer"> & {
  /**
   * Unique ID of the producer (monotonic counter).
   *
   * @generated from field: optional int32 id = 1;
   */
  id: number;

  /**
   * Typically matches the process name.
   *
   * @generated from field: optional string name = 2;
   */
  name: string;

  /**
   * Unix pid of the remote process. Supported only on Linux-based systems.
   * Introduced in v24 / Android T.
   *
   * @generated from field: optional int32 pid = 5;
   */
  pid: number;

  /**
   * Unix uid of the remote process.
   *
   * @generated from field: optional int32 uid = 3;
   */
  uid: number;

  /**
   * The version of the client library used by the producer.
   * This is a human readable string with and its format varies depending on
   * the build system and the repo (standalone vs AOSP).
   * This is intended for human debugging only.
   *
   * @generated from field: optional string sdk_version = 4;
   */
  sdkVersion: string;

  /**
   * Returns true if the process appears to be frozen (Android only).
   * Introduced in Perfetto V49 / Android 24Q4.
   *
   * @generated from field: optional bool frozen = 6;
   */
  frozen: boolean;
};

/**
 * Describes the message perfetto.protos.TracingServiceState.Producer.
 * Use `create(TracingServiceState_ProducerSchema)` to create a new message.
 */
export const TracingServiceState_ProducerSchema: GenMessage<TracingServiceState_Producer> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_tracing_service_state, 0, 0);

/**
 * Describes a data source registered by a producer. Data sources are listed
 * regardless of the fact that they are being used or not.
 *
 * @generated from message perfetto.protos.TracingServiceState.DataSource
 */
export type TracingServiceState_DataSource = Message<"perfetto.protos.TracingServiceState.DataSource"> & {
  /**
   * Descriptor passed by the data source when calling RegisterDataSource().
   *
   * @generated from field: optional perfetto.protos.DataSourceDescriptor ds_descriptor = 1;
   */
  dsDescriptor?: DataSourceDescriptor;

  /**
   * ID of the producer, as per Producer.id.
   *
   * @generated from field: optional int32 producer_id = 2;
   */
  producerId: number;
};

/**
 * Describes the message perfetto.protos.TracingServiceState.DataSource.
 * Use `create(TracingServiceState_DataSourceSchema)` to create a new message.
 */
export const TracingServiceState_DataSourceSchema: GenMessage<TracingServiceState_DataSource> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_tracing_service_state, 0, 1);

/**
 * @generated from message perfetto.protos.TracingServiceState.TracingSession
 */
export type TracingServiceState_TracingSession = Message<"perfetto.protos.TracingServiceState.TracingSession"> & {
  /**
   * The TracingSessionID.
   *
   * @generated from field: optional uint64 id = 1;
   */
  id: bigint;

  /**
   * The Unix uid of the consumer that started the session.
   * This is meaningful only if the caller is root. In all other cases only
   * tracing sessions that match the caller UID will be displayed.
   *
   * @generated from field: optional int32 consumer_uid = 2;
   */
  consumerUid: number;

  /**
   * Internal state of the tracing session.
   * These strings are FYI only and subjected to change.
   *
   * @generated from field: optional string state = 3;
   */
  state: string;

  /**
   * The unique_session_name as set in the trace config (might be empty).
   *
   * @generated from field: optional string unique_session_name = 4;
   */
  uniqueSessionName: string;

  /**
   * The number and size of each buffer.
   *
   * @generated from field: repeated uint32 buffer_size_kb = 5;
   */
  bufferSizeKb: number[];

  /**
   * Duration, as specified in the TraceConfig.duration_ms.
   *
   * @generated from field: optional uint32 duration_ms = 6;
   */
  durationMs: number;

  /**
   * Number of data sources involved in the session.
   *
   * @generated from field: optional uint32 num_data_sources = 7;
   */
  numDataSources: number;

  /**
   * Time when the session was started, in the CLOCK_REALTIME domain.
   * Available only on Linux-based systems.
   *
   * @generated from field: optional int64 start_realtime_ns = 8;
   */
  startRealtimeNs: bigint;

  /**
   * The bugreport_score, as set in TraceConfig.bugreport_score.
   *
   * @generated from field: optional int32 bugreport_score = 9;
   */
  bugreportScore: number;

  /**
   * As per TraceConfig.bugreport_filename.
   *
   * @generated from field: optional string bugreport_filename = 10;
   */
  bugreportFilename: string;

  /**
   * If true, the session is in the STARTED state. If false the session is in
   * any other state (see `state` field).
   *
   * @generated from field: optional bool is_started = 11;
   */
  isStarted: boolean;
};

/**
 * Describes the message perfetto.protos.TracingServiceState.TracingSession.
 * Use `create(TracingServiceState_TracingSessionSchema)` to create a new message.
 */
export const TracingServiceState_TracingSessionSchema: GenMessage<TracingServiceState_TracingSession> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_tracing_service_state, 0, 2);

