/*
 * Copyright (C) 2024 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.
 */

syntax = "proto2";

package perfetto.protos;

message AndroidWattsonTimePeriodMetric {
  // Each version increment means updated structure format or field
  optional int32 metric_version = 1;
  // Each version increment means power model has been updated and estimates
  // might change for the exact same input. Don't compare estimates across
  // different power model versions.
  optional int32 power_model_version = 2;
  repeated AndroidWattsonEstimateInfo period_info = 3;
  // Best effort power estimate made without all the essential traces, but with
  // enough information to make an educated extrapolation of a HW state. The
  // only example right now is for cpu_idle, of which the cpu_idle state can be
  // extrapolated from the swapper thread (aka idle thread).
  optional int32 is_crude_estimate = 4;
}

message AndroidWattsonEstimateInfo {
  optional int32 period_id = 1;
  optional string period_name = 2;
  optional int64 period_dur = 3;
  optional AndroidWattsonCpuSubsystemEstimate cpu_subsystem = 4;
  optional AndroidWattsonGpuSubsystemEstimate gpu_subsystem = 5;
  optional AndroidWattsonTpuSubsystemEstimate tpu_subsystem = 6;
}

message AndroidWattsonCpuSubsystemEstimate {
  // estimates and estimates of subrails
  optional float estimated_mw = 1;
  optional float estimated_mws = 2;
  optional AndroidWattsonPolicyEstimate policy0 = 3;
  optional AndroidWattsonPolicyEstimate policy1 = 4;
  optional AndroidWattsonPolicyEstimate policy2 = 5;
  optional AndroidWattsonPolicyEstimate policy3 = 6;
  optional AndroidWattsonPolicyEstimate policy4 = 7;
  optional AndroidWattsonPolicyEstimate policy5 = 8;
  optional AndroidWattsonPolicyEstimate policy6 = 9;
  optional AndroidWattsonPolicyEstimate policy7 = 10;
  optional AndroidWattsonDsuScuEstimate dsu_scu = 11;
}

message AndroidWattsonPolicyEstimate {
  optional float estimated_mw = 1;
  optional float estimated_mws = 2;
  optional AndroidWattsonCpuEstimate cpu0 = 3;
  optional AndroidWattsonCpuEstimate cpu1 = 4;
  optional AndroidWattsonCpuEstimate cpu2 = 5;
  optional AndroidWattsonCpuEstimate cpu3 = 6;
  optional AndroidWattsonCpuEstimate cpu4 = 7;
  optional AndroidWattsonCpuEstimate cpu5 = 8;
  optional AndroidWattsonCpuEstimate cpu6 = 9;
  optional AndroidWattsonCpuEstimate cpu7 = 10;
}

message AndroidWattsonCpuEstimate {
  optional float estimated_mw = 1;
  optional float estimated_mws = 2;
}

message AndroidWattsonDsuScuEstimate {
  optional float estimated_mw = 1;
  optional float estimated_mws = 2;
}

message AndroidWattsonGpuSubsystemEstimate {
  optional float estimated_mw = 1;
  optional float estimated_mws = 2;
}

message AndroidWattsonTpuSubsystemEstimate {
  optional float estimated_mw = 1;
  optional float estimated_mws = 2;
}
