starnix_core/power/
suspend_stats.rs

1// Copyright 2023 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use starnix_uapi::errors::Errno;
6
7/// Suspend statistics collection.
8///
9/// This is a Starnix version of `fuchsia.power.suspend.SuspendStats`, plus
10/// additional observability context.
11#[derive(Debug, Default, Clone, Eq, PartialEq)]
12pub struct SuspendStats {
13    /// The number of times the device has successfully suspended.
14    pub success_count: u64,
15    /// The number of times the device has failed to suspend.
16    pub fail_count: u64,
17    /// The error code logged after the last failed suspend attempt.
18    pub last_failed_errno: Option<Errno>,
19    /// The name of the device that last failed suspend.
20    pub last_failed_device: Option<String>,
21    /// Number of times a wakeup occurred.
22    pub wakeup_count: u64,
23    /// Last reason for resume.
24    pub last_resume_reason: Option<String>,
25    /// The amount of time spent in the previous suspend state.
26    /// May not be available on all platforms.
27    pub last_time_in_sleep: zx::BootDuration,
28    /// The amount of time spent performing suspend and resume operations for
29    /// the previous suspend state.
30    /// Suspend and resume operations are those actions taken by the platform in
31    /// order to enter and exit, respectively, a suspended state.
32    pub last_time_in_suspend_operations: zx::BootDuration,
33}