diff --git a/src/timer/internal.rs b/src/timer/internal.rs deleted file mode 100644 index c5a044f..0000000 --- a/src/timer/internal.rs +++ /dev/null @@ -1,19 +0,0 @@ -use crate::units::Second; - -#[derive(Debug, Copy, Clone)] -pub struct CPUTimes { - /// Total amount of time spent executing in user mode - pub user_usec: i64, - - /// Total amount of time spent executing in kernel mode - pub system_usec: i64, -} - -#[derive(Debug, Copy, Clone)] -pub struct CPUInterval { - /// Total amount of time spent executing in user mode - pub user: Second, - - /// Total amount of time spent executing in kernel mode - pub system: Second, -} diff --git a/src/timer/mod.rs b/src/timer/mod.rs index 0ef1d38..1c3a460 100644 --- a/src/timer/mod.rs +++ b/src/timer/mod.rs @@ -1,6 +1,7 @@ use std::process::Child; -mod internal; +use crate::units::Second; + pub mod wallclocktimer; #[cfg(windows)] @@ -24,3 +25,21 @@ pub trait TimerStop { type Result; fn stop(&self) -> Self::Result; } + +#[derive(Debug, Copy, Clone)] +pub struct CPUTimes { + /// Total amount of time spent executing in user mode + pub user_usec: i64, + + /// Total amount of time spent executing in kernel mode + pub system_usec: i64, +} + +#[derive(Debug, Copy, Clone)] +pub struct CPUInterval { + /// Total amount of time spent executing in user mode + pub user: Second, + + /// Total amount of time spent executing in kernel mode + pub system: Second, +} diff --git a/src/timer/unix_timer.rs b/src/timer/unix_timer.rs index 354a010..9069cab 100644 --- a/src/timer/unix_timer.rs +++ b/src/timer/unix_timer.rs @@ -3,8 +3,7 @@ use std::mem; use std::process::Child; -use super::internal::{CPUInterval, CPUTimes}; -use crate::timer::{TimerStart, TimerStop}; +use crate::timer::{CPUInterval, CPUTimes, TimerStart, TimerStop}; use crate::units::Second; pub fn get_cpu_timer() -> Box> { diff --git a/src/timer/windows_timer.rs b/src/timer/windows_timer.rs index 0add8c3..f8e03e6 100644 --- a/src/timer/windows_timer.rs +++ b/src/timer/windows_timer.rs @@ -7,8 +7,7 @@ use std::process::Child; use winapi::um::processthreadsapi::GetProcessTimes; use winapi::um::winnt::HANDLE; -use super::internal::CPUTimes; -use crate::timer::{TimerStart, TimerStop}; +use crate::timer::{CPUTimes, TimerStart, TimerStop}; use crate::units::Second; const HUNDRED_NS_PER_MS: i64 = 10;