Skip to content

Commit

Permalink
Merge pull request #13 from azuqua/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
aembke authored May 1, 2018
2 parents 5e019ac + f9f81c3 commit 2b584be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ chrono = "0.3"
kernel32-sys = "0.2"
libc = "0.2"
psapi-sys = "0.1"
sys-info = "0.4.1"
sys-info = "0.5.6"
thread-id = "3.0"
winapi = "0.2"

Expand Down
14 changes: 11 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//! A cross-platform module for measuring CPU and memory usage for processes, threads, and children threads.
//! This module currently supports Linux, Windows, and OS X.
//!
//! A few notes first.
//! A few notes first.
//!
//! ## Windows
//! * As of right now, Windows support for child process information is currently unimplemented until a solution is found.
//! * As of right now, Windows support for child process information is currently unimplemented until a solution is found.
//! * Also, when polling for `StatType::Thread` the memory usage will be 0. See Spork struct documenation for details
//!
//! ## OSX
Expand Down Expand Up @@ -51,6 +51,12 @@
//! println!("Thread stats: {:?}", t_stats);
//! ```

#[cfg(target_pointer_width = "32")]
pub type CLong = i32;

#[cfg(target_pointer_width = "64")]
pub type CLong = i64;

#[cfg(target_os = "macos")]
extern crate mach;

Expand Down Expand Up @@ -147,7 +153,9 @@ impl From<sys_info::Error> for SporkError {
SporkErrorKind::Unimplemented,
"Unsupported system.".to_owned(),
),
sys_info::Error::ExecFailed(s) => SporkError::new(SporkErrorKind::Unknown, s),
sys_info::Error::ExecFailed(e) => SporkError::new(SporkErrorKind::Unknown, e.to_string()),
sys_info::Error::IO(e) => SporkError::new(SporkErrorKind::Unknown, e.to_string()),
sys_info::Error::Unknown => SporkError::new(SporkErrorKind::Unknown, "Sys_info encountered an unknown error."),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn map_posix_resp(code: i32) -> Result<i32, SporkError> {
}

#[allow(dead_code)]
pub fn get_clock_ticks() -> Result<i64, SporkError> {
pub fn get_clock_ticks() -> Result<CLong, SporkError> {
Ok(unsafe { libc::sysconf(libc::_SC_CLK_TCK) })
}

Expand Down

0 comments on commit 2b584be

Please sign in to comment.