Skip to content

Commit

Permalink
Make CpuTime/CpuUsage clone-able
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla authored and svartalf committed Dec 11, 2020
1 parent 02379b6 commit 58d7110
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion heim-cpu/src/sys/linux/times.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use heim_common::sys::unix::CLOCK_TICKS;
use heim_common::units::{time, Time};
use heim_runtime as rt;

#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct CpuTime {
user: Time,
nice: Time,
Expand Down
2 changes: 1 addition & 1 deletion heim-cpu/src/sys/macos/times.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use heim_common::units::{time, Time};

use super::bindings;

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct CpuTime {
user: Time,
nice: Time,
Expand Down
2 changes: 1 addition & 1 deletion heim-cpu/src/sys/windows/times.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use heim_common::prelude::*;
use heim_common::sys::IntoTime as _;
use heim_common::units::Time;

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct CpuTime {
user: Time,
system: Time,
Expand Down
1 change: 1 addition & 0 deletions heim-cpu/src/times.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::sys;
/// For Linux additional information can be retrieved with [CpuTimeExt] extension trait.
///
/// [CpuTimeExt]: ./os/linux/trait.CpuTimeExt.html
#[derive(Clone)]
pub struct CpuTime(sys::CpuTime);

wrap!(CpuTime, sys::CpuTime);
Expand Down
1 change: 1 addition & 0 deletions heim-process/src/process/cpu_times.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use heim_common::units::Time;
use crate::sys;

/// Accumulated CPU time for specific process.
#[derive(Clone)]
pub struct CpuTime(sys::CpuTime);

wrap!(CpuTime, sys::CpuTime);
Expand Down
2 changes: 1 addition & 1 deletion heim-process/src/process/cpu_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::CpuTime;
/// Process CPU usage measurement.
///
/// See [Process::cpu_usage](./struct.Process.html#method.cpu_usage) method for details.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct CpuUsage {
pub(crate) cpu_count: u64,
pub(crate) cpu_time: CpuTime,
Expand Down
2 changes: 1 addition & 1 deletion heim-process/src/sys/linux/process/procfs/cpu_times.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use heim_common::units::Time;

use super::Stat;

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct CpuTime {
utime: Time,
stime: Time,
Expand Down
2 changes: 1 addition & 1 deletion heim-process/src/sys/macos/process/cpu_times.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use heim_common::units::{time, Time};

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct CpuTime {
utime: Time,
stime: Time,
Expand Down
2 changes: 1 addition & 1 deletion heim-process/src/sys/windows/process/cpu_times.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use heim_common::units::Time;

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct CpuTime {
pub(crate) user: Time,
pub(crate) kernel: Time,
Expand Down

0 comments on commit 58d7110

Please sign in to comment.