/*
 * Copyright (C) 2022 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;

// measure max IRQ runtime and IRQ tasks running over threshold.
message AndroidIrqRuntimeMetric {
  message IrqSlice {
    // IRQ name
    optional string irq_name = 1;
    // timestamp
    optional int64 ts = 2;
    // runtime of IRQ task
    optional int64 dur = 3;
  }
  message ThresholdMetric {
    // Threshold value
    optional string threshold = 1;
    // over threshold count
    optional int64 over_threshold_count = 2;
    // anomaly ratio (over threshold count / total count)
    optional double anomaly_ratio = 3;
  }
  message IrqRuntimeMetric {
    // max runtime of IRQ tasks
    optional int64 max_runtime = 1;
    // total IRQ tasks
    optional int64 total_count = 2;
    // over threshold metric
    optional ThresholdMetric threshold_metric = 3;
    // information for top 10 IRQ tasks
    repeated IrqSlice longest_irq_slices = 4;
  }

  // metrics for hardirq and softirq
  optional IrqRuntimeMetric hw_irq = 1;
  optional IrqRuntimeMetric sw_irq = 2;
}
