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

// Metric that stores information related to atrace events generated by
// simpleperf tool
message AndroidSimpleperfMetric {
  optional double urgent_ratio = 1;

  message PerfEventMetric {
    // Simpleperf event name
    optional string name = 1;

    message Thread {
      // Thread ID
      optional int32 tid = 1;
      // Thread name
      optional string name = 2;
      // CPU ID
      optional int32 cpu = 3;
      // Total counter value
      optional double total = 4;
    }

    message Process {
      // Process ID
      optional int32 pid = 1;
      // Process name
      optional string name = 2;
      // Metrics for each thread in this process.
      repeated Thread threads = 3;
      // Total counter value over all threads in this process
      optional double total = 4;
    }

    // Metrics for each process
    repeated Process processes = 2;

    // Total counter value over all processes and threads
    optional double total = 3;
  }

  repeated PerfEventMetric events = 2;
}
