blob: db6eef41cdb2712a44eef848887695cd26d49a33 [file] [log] [blame]
// Copyright 2023 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@available(added=HEAD)
library fuchsia.power.suspend;
using zx;
/// A collection of statistics related to suspend/resume of the device.
type SuspendStats = table {
/// The number of times the device has successfully suspended.
1: success_count uint64;
/// The number of times the device has failed to suspend.
2: fail_count uint64;
/// The error code logged after the last failed suspend attempt.
3: last_failed_error zx.Status;
/// The amount of time spent in the previous suspend state.
/// May not be available on all platforms.
4: last_time_in_suspend zx.Duration;
/// The amount of time spent performing suspend and resume operations for
/// the previous suspend state.
/// Suspend and resume operations are those actions taken by the platform in
/// order to enter and exit, respectively, a suspended state.
5: last_time_in_suspend_operations zx.Duration;
};
/// A protocol for retrieving statistics related to suspend/resume operations.
@discoverable
open protocol Stats {
/// Gets the suspend statistics for the sytem.
///
/// Uses the hanging get pattern: the first call to this method will return
/// immediately. For subsequent calls, the server will return only when
/// suspend stats have changed.
strict Watch() -> (SuspendStats);
};