starnix_types/
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
5#[derive(Copy, Clone, Eq, PartialEq, Default, Debug)]
6pub struct TaskTimeStats {
7    pub user_time: zx::MonotonicDuration,
8    pub system_time: zx::MonotonicDuration,
9}
10
11impl std::ops::Add for TaskTimeStats {
12    type Output = Self;
13
14    fn add(self, other: Self) -> Self {
15        Self {
16            user_time: self.user_time + other.user_time,
17            system_time: self.system_time + other.system_time,
18        }
19    }
20}
21
22impl std::ops::AddAssign for TaskTimeStats {
23    fn add_assign(&mut self, other: Self) {
24        self.user_time += other.user_time;
25        self.system_time += other.system_time;
26    }
27}