/*
 * Copyright 2025 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 KernelWakelockData {
  message Wakelock {
    enum Type {
      WAKELOCK_TYPE_UNKNOWN = 0;
      WAKELOCK_TYPE_KERNEL = 1;
      WAKELOCK_TYPE_NATIVE = 2;
    }

    // Interning id.
    optional uint32 wakelock_id = 1;

    // Name of the wakelock.
    optional string wakelock_name = 2;

    // Type of the wakelock. We record data about both true kernel wakelocks
    // and "native" wakelocks which are taken in userspace but are more
    // conceptually similar to kernel wakelocks than normal userspace ones.
    optional Type wakelock_type = 3;
  }

  // This is only emitted when we encounter new wakelocks.
  repeated Wakelock wakelock = 1;

  // Interning id.
  repeated uint32 wakelock_id = 2 [packed = true];

  // If we interned the wakelock name in this packet, this is the total time
  // the wakelock has been held.
  // If not, it's a delta from the last time we saw it.
  repeated uint64 time_held_millis = 3 [packed = true];

  optional uint64 error_flags = 4;
}
