/*
 * 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;

// Metrics for Multiuser events, such as switching users.
message AndroidAutoMultiuserMetric {
  message EventData {
    // Id of the user the system has been switched to
    optional int32 user_id = 1;

    // The end event name for which the duration_ms is measured
    optional string start_event = 2;

    // The end event name for which the duration_ms is measured
    optional string end_event = 3;

    // Duration of the event (in milliseconds).
    optional int64 duration_ms = 4;

    // Previous user resource usage info during user switch
    message UserData {
      // Id of the user the system has been switched from
      optional int32 user_id = 1;

      optional int64 total_cpu_time_ms = 2;

      optional int64 total_memory_usage_kb = 3;
    }

    optional UserData previous_user_info = 5;
  }

  // Metrics for a user switch.
  repeated EventData user_switch = 1;
}
