commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
04528d7baf11e35babab0deee43a4bd62f6ccb58 | Guillaume Gomez | 2020-03-06T13:44:48 | Improve documentation | diff --git a/src/sysinfo.rs b/src/sysinfo.rs
index 4020665..7ee0297 100644
--- a/src/sysinfo.rs
+++ b/src/sysinfo.rs
@@ -115,7 +115,7 @@ mod utils;
/// a maximum number of files open equivalent to half of the system limit.
///
/// The problem is that some users might need all the available file descriptors so we nee... | 2 | 17 | 2 |
5e97aec3a895215faf99dec9f87267aae8ea8e34 | Guillaume Gomez | 2020-03-06T10:40:20 | Move boot time function for mac into its own folder and handle more cases in linux | diff --git a/src/common.rs b/src/common.rs
index 2c6af2d..5cb51f6 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -285,30 +285,3 @@ impl From<isize> for DiskType {
}
}
}
-
-#[cfg(unix)]
-pub fn boot_time() -> u64 {
- use libc;
-
- let mut boot_time = libc::timeval {
- tv_sec: 0,
- t... | 3 | 39 | 34 |
cfed0bf85deecad1fd323446e435d00a0e727527 | GuillaumeGomez | 2020-03-05T22:32:28 | Add boot_time command | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index f80ae40..cc79b86 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -76,12 +76,12 @@ fn print_help() {
writeln!(
&mut io::stdout(),
"show [pid | name] : show information of the given process \
- ... | 1 | 17 | 7 |
5d92bb16efd922ac0f42fe21dd9bf080e0f6bd82 | GuillaumeGomez | 2020-03-05T22:32:13 | Add boot_time for windows as well | diff --git a/src/common.rs b/src/common.rs
index 6278830..2c6af2d 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -305,7 +305,8 @@ pub fn boot_time() -> u64 {
::std::ptr::null_mut(),
0,
)
- } < 0 {
+ } < 0
+ {
0
} else {
boot_time.tv_sec as _
diff --g... | 5 | 34 | 15 |
1632ee3e9f6c3c5b370d39203de76fe32386f34e | Guillaume Gomez | 2020-03-05T21:42:09 | Add boot time | diff --git a/src/common.rs b/src/common.rs
index 5cb51f6..6278830 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -285,3 +285,29 @@ impl From<isize> for DiskType {
}
}
}
+
+#[cfg(unix)]
+pub fn boot_time() -> u64 {
+ use libc;
+
+ let mut boot_time = libc::timeval {
+ tv_sec: 0,
+ t... | 6 | 85 | 34 |
58dae25087218abc050e5ab25df95ced98b27717 | Guillaume Gomez | 2020-03-05T16:29:11 | Update crate version | diff --git a/Cargo.toml b/Cargo.toml
index e17392a..7446dec 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.11.4"
+version = "0.11.5"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, pro... | 1 | 1 | 1 |
d10a56d7e86a30e8390df67a782b0e27180949b3 | Guillaume Gomez | 2020-03-05T16:28:55 | Fix refresh methods | diff --git a/src/common.rs b/src/common.rs
index 32479da..5cb51f6 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -127,6 +127,7 @@ pub struct RefreshKind {
cpu: bool,
components: bool,
components_list: bool,
+ users_list: bool,
}
impl RefreshKind {
@@ -148,6 +149,7 @@ impl RefreshKind {
///... | 3 | 29 | 4 |
e22500206fa37c8114e14c46194bdb3531be58d6 | Guillaume Gomez | 2020-03-05T15:25:48 | Update crate version | diff --git a/Cargo.toml b/Cargo.toml
index fc2bbe0..e17392a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.11.3"
+version = "0.11.4"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, pro... | 1 | 1 | 1 |
788c4871f77f71f2ad9c8d05725001689c787d4f | Guillaume Gomez | 2020-03-05T13:57:35 | Add benchmark for getting users | diff --git a/benches/basic.rs b/benches/basic.rs
index 970510f..0666a05 100644
--- a/benches/basic.rs
+++ b/benches/basic.rs
@@ -132,3 +132,12 @@ fn bench_refresh_components_list(b: &mut test::Bencher) {
s.refresh_components_list();
});
}
+
+#[bench]
+fn bench_refresh_users_list(b: &mut test::Bencher) {
... | 1 | 9 | 0 |
8392062477f2ba52d423184d8ee654d0e329940d | Guillaume Gomez | 2020-03-05T13:57:23 | Add check that the users function is working as expected | diff --git a/src/sysinfo.rs b/src/sysinfo.rs
index d93add4..0070f46 100644
--- a/src/sysinfo.rs
+++ b/src/sysinfo.rs
@@ -65,17 +65,29 @@ cfg_if! {
if #[cfg(target_os = "macos")] {
mod mac;
use mac as sys;
+
+ #[cfg(test)]
+ const MIN_USERS: usize = 1;
} else if #[cfg(windows)] ... | 1 | 21 | 0 |
33f23bb2ad0dd8901b72852cdd627355119a1578 | Guillaume Gomez | 2020-03-05T13:52:09 | cleanup users code | diff --git a/src/mac/users.rs b/src/mac/users.rs
index fec8109..9bc7bba 100644
--- a/src/mac/users.rs
+++ b/src/mac/users.rs
@@ -4,9 +4,90 @@
// Copyright (c) 2020 Guillaume Gomez
//
-use crate::utils::users::{endswith, get_users_list as users_list};
use crate::User;
+use libc::{c_char, endpwent, getgrgid, getgr... | 2 | 82 | 87 |
60ad69fabf966bace6eae164a338f761574ed3b3 | Guillaume Gomez | 2020-03-05T13:50:15 | Improve get_users for linux and android targets | diff --git a/src/linux/disk.rs b/src/linux/disk.rs
index 41f889c..5d87755 100644
--- a/src/linux/disk.rs
+++ b/src/linux/disk.rs
@@ -11,7 +11,6 @@ use DiskType;
use libc::statvfs;
use std::ffi::{OsStr, OsString};
-use std::fmt::{Error, Formatter};
use std::mem;
use std::os::unix::ffi::OsStrExt;
use std::path::{P... | 3 | 81 | 5 |
906fe33d0e3af077a9d80a2878c16edee910323d | GuillaumeGomez | 2020-03-04T22:46:37 | Remove unused winapi feature | diff --git a/Cargo.toml b/Cargo.toml
index 829beed..fc2bbe0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ doc-comment = "0.3"
once_cell = "1.0"
[target.'cfg(windows)'.dependencies]
-winapi = { version = "0.3", features = ["fileapi", "handleapi", "ifdef", "ioapiset", "minwindef", "pdh", "psapi", "syncha... | 1 | 1 | 1 |
0d104e183072934d923517a23dc2aeb48661c596 | GuillaumeGomez | 2020-03-04T22:43:53 | Fix windows warnings | diff --git a/src/windows/disk.rs b/src/windows/disk.rs
index a9d09e8..88bebbd 100644
--- a/src/windows/disk.rs
+++ b/src/windows/disk.rs
@@ -5,9 +5,7 @@
//
use std::ffi::{OsStr, OsString};
-use std::fmt::{Debug, Error, Formatter};
use std::path::Path;
-use std::str;
use DiskExt;
use DiskType;
diff --git a/src/... | 2 | 4 | 6 |
3a4cfd2beb0ff58fc84c7ab91f308650d95bbacd | GuillaumeGomez | 2020-03-04T22:42:27 | Add users handling for windows | diff --git a/Cargo.toml b/Cargo.toml
index 5fe7203..829beed 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ doc-comment = "0.3"
once_cell = "1.0"
[target.'cfg(windows)'.dependencies]
-winapi = { version = "0.3", features = ["fileapi", "handleapi", "ifdef", "ioapiset", "minwindef", "pdh", "psapi", "syncha... | 5 | 156 | 1 |
50bf2b087e696c653c79058f174e81ff39688984 | Alexander Larin | 2020-02-23T13:35:25 | Almost implement (without parsing) command-line reading | diff --git a/Cargo.toml b/Cargo.toml
index bb40ac5..9fd624f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ doc-comment = "0.3"
once_cell = "1.0"
[target.'cfg(windows)'.dependencies]
-winapi = { version = "0.3", features = ["fileapi", "handleapi", "ifdef", "ioapiset", "minwindef", "pdh", "psapi", "syncha... | 2 | 88 | 12 |
0de80c555be8e680ea4c4eafa21c0a3042d0b2d7 | Alexander Larin | 2020-03-02T20:15:02 | Fix get process command-line for linux | diff --git a/src/linux/system.rs b/src/linux/system.rs
index efdd562..6cd175f 100644
--- a/src/linux/system.rs
+++ b/src/linux/system.rs
@@ -786,7 +786,7 @@ fn copy_from_file(entry: &Path) -> Vec<String> {
let mut start = 0;
for (pos, x) in data.iter().enumerate() {
... | 1 | 1 | 1 |
23d80387894c4673f026ad1fba4cf707e13db3d6 | Alexander Larin | 2020-02-23T06:59:00 | Test get_cmd_line for windows | diff --git a/tests/process.rs b/tests/process.rs
index 407c116..7048e47 100644
--- a/tests/process.rs
+++ b/tests/process.rs
@@ -6,7 +6,6 @@
extern crate sysinfo;
-#[cfg(not(windows))]
use sysinfo::ProcessExt;
use sysinfo::SystemExt;
@@ -37,7 +36,18 @@ fn test_process_refresh() {
#[test]
#[cfg(windows)]
-f... | 1 | 12 | 2 |
43616d34aa75246b92f616ebd1e756215bb494a9 | Alexander Larin | 2020-02-18T18:09:13 | Tests for command line (if not windows) | diff --git a/tests/process.rs b/tests/process.rs
index fce70d2..407c116 100644
--- a/tests/process.rs
+++ b/tests/process.rs
@@ -34,3 +34,22 @@ fn test_process_refresh() {
true
);
}
+
+#[test]
+#[cfg(windows)]
+fn test_get_cmd_line() {}
+
+#[test]
+#[cfg(not(windows))]
+fn test_get_cmd_line() {
+ let ... | 1 | 19 | 0 |
87d21c4e528cbb5c5a3be324da49bad8405b5675 | Guillaume Gomez | 2020-03-02T16:36:16 | Add users for unknown targets | diff --git a/src/unknown/system.rs b/src/unknown/system.rs
index 65ff7c8..a3151e4 100644
--- a/src/unknown/system.rs
+++ b/src/unknown/system.rs
@@ -10,6 +10,7 @@ use sys::processor::*;
use sys::Disk;
use sys::Networks;
use Pid;
+use User;
use {RefreshKind, SystemExt};
use std::collections::HashMap;
@@ -44,6 +45... | 1 | 7 | 0 |
68b89fdfe1a2b6f6ae3a915d8d6e8d744d08710c | Guillaume Gomez | 2020-03-02T16:21:37 | Add users for linux | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index cefb7e6..f80ae40 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -12,7 +12,9 @@ extern crate sysinfo;
use std::io::{self, BufRead, Write};
use std::str::FromStr;
use sysinfo::Signal::*;
-use sysinfo::{NetworkExt, NetworksExt, Pid,... | 7 | 56 | 22 |
7bff168c6443a6975647c9ed74f397dfdc42dd38 | Guillaume Gomez | 2020-03-02T16:08:01 | Improve users getter code | diff --git a/src/mac/users.rs b/src/mac/users.rs
index 22adaa0..3104116 100644
--- a/src/mac/users.rs
+++ b/src/mac/users.rs
@@ -5,83 +5,10 @@
//
use crate::User;
-
-use libc::{c_char, getgrgid, getpwent, strlen, setpwent, endpwent, getgrouplist};
-
-fn cstr_to_rust(c: *const c_char) -> Option<String> {
- let mu... | 2 | 85 | 75 |
d83c9983445f6bfbeae541e5cdceb8bbec3bb5a6 | Guillaume Gomez | 2020-02-29T18:54:43 | Add users information on mac | diff --git a/build.rs b/build.rs
index 37dc0b0..d0e25fc 100644
--- a/build.rs
+++ b/build.rs
@@ -2,5 +2,6 @@ fn main() {
if std::env::var("TARGET").unwrap().contains("-apple") {
println!("cargo:rustc-link-lib=framework=IOKit");
println!("cargo:rustc-link-lib=framework=CoreFoundation");
+ /... | 8 | 355 | 4 |
dda4c8cb41761d7305158cebee152f320b66bea7 | Guillaume Gomez | 2020-02-29T12:19:18 | Improve Cargo keywords | diff --git a/Cargo.toml b/Cargo.toml
index bb40ac5..5fe7203 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ repository = "https://github.com/GuillaumeGomez/sysinfo"
license = "MIT"
readme = "README.md"
-categories = ["filesystem", "os::macos-apis", "os::unix-apis", "os::windows-apis"]
+categories = ["files... | 1 | 1 | 1 |
de5d4f93fe462bfd072543cc0297b1c2c93d548a | Guillaume Gomez | 2020-02-25T23:17:32 | Upgrade crate version | diff --git a/Cargo.toml b/Cargo.toml
index 918c59d..bb40ac5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.11.2"
+version = "0.11.3"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, pro... | 1 | 1 | 1 |
83ffc49de0d87ed82ed5b754fdc351eb36b06600 | Guillaume Gomez | 2020-02-25T23:16:19 | Unify Debug implementations | diff --git a/src/component.rs b/src/component.rs
deleted file mode 100644
index f82235f..0000000
--- a/src/component.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Sysinfo
-//
-// Copyright (c) 2015 Guillaume Gomez
-//
-
-use std::fmt::{Debug, Error, Formatter};
-use sys::Component;
-use traits::ComponentExt;
-
-impl Debug ... | 16 | 154 | 196 |
f86c6143d232935f5461ee09eef51c5461409140 | Guillaume Gomez | 2020-02-11T13:10:25 | Update crate version to 0.11.2 | diff --git a/Cargo.toml b/Cargo.toml
index c7dff0f..918c59d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.11.1"
+version = "0.11.2"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, pro... | 1 | 1 | 1 |
56ad26659099a16425ecd78530f0895bcad67f88 | Guillaume Gomez | 2020-02-11T12:41:23 | Improve ProcessExt::kill code on windows | diff --git a/src/windows/process.rs b/src/windows/process.rs
index 95e122f..84ecc89 100644
--- a/src/windows/process.rs
+++ b/src/windows/process.rs
@@ -317,7 +317,10 @@ impl ProcessExt for Process {
fn kill(&self, signal: ::Signal) -> bool {
let mut kill = process::Command::new("taskkill.exe");
... | 1 | 4 | 1 |
1c72997831bcc1159fca1fbe58ae140b8ea8ef4b | GuillaumeGomez | 2020-02-10T22:21:01 | Fix ProcessExt::kill on windows | diff --git a/src/windows/process.rs b/src/windows/process.rs
index a04ff3f..95e122f 100644
--- a/src/windows/process.rs
+++ b/src/windows/process.rs
@@ -8,6 +8,7 @@ use std::fmt::{self, Debug, Formatter};
use std::mem::{size_of, zeroed, MaybeUninit};
use std::ops::Deref;
use std::path::{Path, PathBuf};
+use std::pro... | 1 | 8 | 18 |
924f34ddc02df0464cd744de86d485e61eba97a6 | GuillaumeGomez | 2020-02-10T21:07:48 | Add tests to be sure that SystemExt::refresh_process adds the process if it isn't listed yet | diff --git a/tests/process.rs b/tests/process.rs
index a9b4c2e..8e01dde 100644
--- a/tests/process.rs
+++ b/tests/process.rs
@@ -6,12 +6,12 @@
extern crate sysinfo;
+#[cfg(not(windows))]
+use sysinfo::ProcessExt;
+use sysinfo::SystemExt;
+
#[test]
fn test_process() {
- #[cfg(not(windows))]
- use sysinfo::P... | 1 | 12 | 4 |
7e6410bd718c4d3d974cd536603ee3e2c626ad60 | GuillaumeGomez | 2020-02-10T21:07:22 | Enforce SystemExt::refresh_process working the same on windows | diff --git a/src/traits.rs b/src/traits.rs
index b1dfdd5..750ffee 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -538,7 +538,7 @@ pub trait SystemExt: Sized {
fn refresh_processes(&mut self);
/// Refresh *only* the process corresponding to `pid`. Returns `false` if the process doesn't
- /// exist or i... | 3 | 114 | 109 |
d99e542af62046cd51124d72e00f943b59adddeb | Guillaume Gomez | 2020-02-10T09:18:13 | Update crate version | diff --git a/Cargo.toml b/Cargo.toml
index 754fceb..c7dff0f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.11.0"
+version = "0.11.1"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, pro... | 1 | 1 | 1 |
3def3dbf5fa6e0f06fd46e1f5bedb90954f5a238 | ClementTsang | 2020-02-10T03:07:39 | Error with network TX on linux | diff --git a/src/linux/network.rs b/src/linux/network.rs
index 9f7378f..52328a3 100644
--- a/src/linux/network.rs
+++ b/src/linux/network.rs
@@ -219,7 +219,7 @@ impl NetworkExt for NetworkData {
}
fn get_total_outcome(&self) -> u64 {
- self.rx_bytes as u64
+ self.tx_bytes as u64
}
... | 1 | 1 | 1 |
0f9ed16e41f35d39a8801f5cee44471363e93d27 | Guillaume Gomez | 2020-02-08T15:12:57 | Improve crate's description | diff --git a/Cargo.toml b/Cargo.toml
index 41ddf47..754fceb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ name = "sysinfo"
version = "0.11.0"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
-description = "Library to handle processes"
+description = "Library to get system information such as p... | 1 | 1 | 1 |
47592c6528edeac28a740136e77f06e7a431ce0d | Guillaume Gomez | 2020-02-08T14:56:37 | Upgrade crate version | diff --git a/Cargo.toml b/Cargo.toml
index 79a6192..41ddf47 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.10.5"
+version = "0.11.0"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to handle processes" | 1 | 1 | 1 |
6c4472d34eee8d2b094e43e79b548eac2f2feb70 | Guillaume Gomez | 2020-02-08T14:56:20 | Add tests for network | diff --git a/tests/network.rs b/tests/network.rs
new file mode 100644
index 0000000..f5bccd2
--- /dev/null
+++ b/tests/network.rs
@@ -0,0 +1,20 @@
+//
+// Sysinfo
+//
+// Copyright (c) 2020 Guillaume Gomez
+//
+
+// This test is used to ensure that the processors are loaded whatever the method
+// used to initialize `S... | 1 | 20 | 0 |
b32e4f370d71dc7c0aa26c33bedd66db4df25cd2 | Guillaume Gomez | 2020-02-08T11:43:16 | Rename get_process_list into get_processes | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index a507470..a28ce21 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -176,7 +176,7 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
}
"quit" | "exit" => return true,
"all" => {
- for (p... | 11 | 19 | 19 |
15893ee642e690c20e87c1264d57047d7668d6ae | Guillaume Gomez | 2020-02-08T11:13:06 | Improve documentation | diff --git a/src/traits.rs b/src/traits.rs
index 0df02e2..6fdce02 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -365,9 +365,9 @@ pub trait ProcessorExt {
/// Contains all the methods of the [`System`][crate::System] type.
pub trait SystemExt: Sized {
- /// Creates a new [`System`] instance with nothing loade... | 1 | 5 | 5 |
e3b21da78491901ea22eb3be408824c9ef487503 | Guillaume Gomez | 2020-02-08T11:11:14 | Update example | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index 2d469de..a507470 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -79,7 +79,7 @@ fn print_help() {
);
writeln!(
&mut io::stdout(),
- "procd : Displays processors state"
+ "processors ... | 1 | 4 | 6 |
6931572652ac97283ed9ad3758db1719b5b8c244 | Guillaume Gomez | 2020-02-08T11:10:56 | remove warning | diff --git a/src/windows/system.rs b/src/windows/system.rs
index 2ef51d5..739d874 100644
--- a/src/windows/system.rs
+++ b/src/windows/system.rs
@@ -82,7 +82,7 @@ impl SystemExt for System {
if let Some(ref mut query) = s.query {
let x = unsafe { load_symbols() };
if let Some(processo... | 1 | 1 | 1 |
702467240cd9ea968bf181c6a7ba0390772e4282 | Guillaume Gomez | 2020-02-08T10:52:27 | Fix CPU usage computation on mac | diff --git a/src/mac/system.rs b/src/mac/system.rs
index a7925ab..9db0aa7 100644
--- a/src/mac/system.rs
+++ b/src/mac/system.rs
@@ -212,7 +212,7 @@ impl SystemExt for System {
) - *old_proc_data.cpu_info.offset(
(ffi::CPU_STATE_MAX * i) as isize + ffi::CPU_STATE_ID... | 1 | 1 | 1 |
756cdb557ce04dc589f922cddf12ee0a1e32b766 | GuillaumeGomez | 2020-02-07T23:34:32 | get_cpu_usage now returns a value between 0 and 100 | diff --git a/src/linux/processor.rs b/src/linux/processor.rs
index daf2e83..6454fc8 100644
--- a/src/linux/processor.rs
+++ b/src/linux/processor.rs
@@ -194,7 +194,7 @@ impl Processor {
user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice,
);
self.cpu_usage = min(self.... | 2 | 2 | 2 |
08ce43f17605ef8a678fd0888d6973545087d6a2 | GuillaumeGomez | 2020-02-07T23:34:14 | Fix cpu computation | diff --git a/src/windows/processor.rs b/src/windows/processor.rs
index 42d1758..db81e10 100644
--- a/src/windows/processor.rs
+++ b/src/windows/processor.rs
@@ -8,7 +8,7 @@ use std::collections::HashMap;
use std::mem;
use std::ops::DerefMut;
use std::ptr::null_mut;
-use std::sync::{Arc, Mutex};
+use std::sync::Mutex... | 3 | 54 | 119 |
aa55099f4eef49c10a9bc33e8cfb52884cfef2d8 | Guillaume Gomez | 2020-02-07T15:53:41 | Ensure that System::new doesn't generate Process list | diff --git a/tests/process.rs b/tests/process.rs
index caaf6dc..869a195 100644
--- a/tests/process.rs
+++ b/tests/process.rs
@@ -13,6 +13,7 @@ fn test_process() {
use sysinfo::SystemExt;
let mut s = sysinfo::System::new();
+ assert_eq!(s.get_process_list().len(), 0);
s.refresh_processes();
asse... | 1 | 1 | 0 |
ec2d72fb20bcc5645ca8096d74b63faa832c3c50 | Guillaume Gomez | 2020-02-07T15:51:49 | Add test to ensure that processor list is always set when initializing System | diff --git a/tests/processor.rs b/tests/processor.rs
new file mode 100644
index 0000000..39cafd6
--- /dev/null
+++ b/tests/processor.rs
@@ -0,0 +1,20 @@
+//
+// Sysinfo
+//
+// Copyright (c) 2020 Guillaume Gomez
+//
+
+// This test is used to ensure that the processors are loaded whatever the method
+// used to initial... | 1 | 20 | 0 |
71e0477389e9a78b85c8d5e294718496ab2b7b79 | Guillaume Gomez | 2020-02-07T13:54:29 | Update processor API | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index c847b46..2d469de 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -189,12 +189,10 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
}
}
"frequency" => {
- let procs = sys.get_proc... | 14 | 261 | 165 |
2c2d581e3958a5a589d34dd25d32dc10e589aa19 | Guillaume Gomez | 2020-02-06T22:13:10 | Update benchmarks | diff --git a/benches/basic.rs b/benches/basic.rs
index 2d8b879..970510f 100644
--- a/benches/basic.rs
+++ b/benches/basic.rs
@@ -116,10 +116,19 @@ fn bench_refresh_cpu(b: &mut test::Bencher) {
}
#[bench]
-fn bench_refresh_temperatures(b: &mut test::Bencher) {
+fn bench_refresh_components(b: &mut test::Bencher) {
... | 1 | 11 | 2 |
1735697c77f328899f5808805a26c947bf5aada1 | Guillaume Gomez | 2020-02-06T21:33:25 | fix windows errors | diff --git a/src/windows/disk.rs b/src/windows/disk.rs
index cc13efd..deaf8e9 100644
--- a/src/windows/disk.rs
+++ b/src/windows/disk.rs
@@ -31,7 +31,7 @@ pub fn new_disk(
total_space: total_space,
available_space: 0,
};
- d.update();
+ d.refresh();
d
}
diff --git a/src/windows/syst... | 3 | 5 | 4 |
292fd031a229f4ed9f2fd40136e37b4e3c4af609 | Guillaume Gomez | 2020-02-06T21:26:02 | Update components API to give more controlto the users | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index c50e7d2..9bc94d4 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -240,7 +240,7 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
}
}
"temperature" => {
- for component in sys.get... | 12 | 167 | 100 |
d35b4b1391c2a69f3ea96f2cf1150b4b29905251 | Guillaume Gomez | 2020-02-06T20:46:57 | Give more control over disks | diff --git a/src/linux/disk.rs b/src/linux/disk.rs
index cd261e9..334b883 100644
--- a/src/linux/disk.rs
+++ b/src/linux/disk.rs
@@ -114,7 +114,7 @@ impl DiskExt for Disk {
self.available_space
}
- fn update(&mut self) -> bool {
+ fn refresh(&mut self) -> bool {
unsafe {
let ... | 9 | 65 | 49 |
b1be53867192a200ce42352a5508f9b86bc47f11 | Guillaume Gomez | 2020-02-06T17:37:32 | Move DiskType enum to common file | diff --git a/src/common.rs b/src/common.rs
index 866edfe..13b2051 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -202,6 +202,15 @@ impl RefreshKind {
}
/// Iterator over network interfaces.
+///
+/// It is returned by [`Networks::iter`][crate::Networks#method.iter].
+///
+/// ```no_run
+/// use sysinfo::{System,... | 11 | 53 | 74 |
06eba865dff1851214cb2d887c4e8ec0f2f339a6 | Guillaume Gomez | 2020-02-06T17:24:00 | Add missing links inside documentation | diff --git a/src/c_interface.rs b/src/c_interface.rs
index f7765cc..f6a254e 100644
--- a/src/c_interface.rs
+++ b/src/c_interface.rs
@@ -9,16 +9,16 @@ use std::borrow::BorrowMut;
use std::ffi::CString;
use {NetworkExt, NetworksExt, Process, ProcessExt, ProcessorExt, System, SystemExt};
-/// Equivalent of `System` s... | 6 | 49 | 42 |
7cdbef5b33681e7289e746a61d5f2105ec512eb3 | Guillaume Gomez | 2020-02-05T23:24:27 | Fix clippy errors on windows | diff --git a/src/windows/network.rs b/src/windows/network.rs
index a9766a7..574c0bb 100644
--- a/src/windows/network.rs
+++ b/src/windows/network.rs
@@ -65,9 +65,8 @@ impl NetworksExt for Networks {
let ptr = unsafe { (*table).Table.as_ptr() };
for i in 0..unsafe { *table }.NumEntries {
l... | 4 | 7 | 7 |
144db8227b799daf8894c5959a7f64faead6869f | Guillaume Gomez | 2020-02-05T22:26:32 | clippy fixes on mac | diff --git a/src/mac/disk.rs b/src/mac/disk.rs
index 00ba4c7..7e99b7f 100644
--- a/src/mac/disk.rs
+++ b/src/mac/disk.rs
@@ -114,7 +114,7 @@ macro_rules! unwrapper {
}
static DISK_TYPES: once_cell::sync::Lazy<HashMap<OsString, DiskType>> =
- once_cell::sync::Lazy::new(|| get_disk_types());
+ once_cell::sync::... | 3 | 3 | 4 |
ea66e311cccc6758feceb852dc220b59a416b6e9 | Guillaume Gomez | 2020-02-05T12:48:22 | Extend unknown network interface | diff --git a/src/unknown/network.rs b/src/unknown/network.rs
index ea3891d..7163f2c 100644
--- a/src/unknown/network.rs
+++ b/src/unknown/network.rs
@@ -49,15 +49,47 @@ impl NetworkExt for NetworkData {
0
}
- fn get_outcome(&self) -> u64 {
+ fn get_total_income(&self) -> u64 {
0
}
... | 1 | 34 | 2 |
a0cb41b6bda06fd7c3464d81b1004905ab2fae91 | Guillaume Gomez | 2020-02-05T12:47:18 | Extend windows network interface | diff --git a/src/windows/network.rs b/src/windows/network.rs
index a866d20..38a2112 100644
--- a/src/windows/network.rs
+++ b/src/windows/network.rs
@@ -114,12 +114,24 @@ impl NetworksExt for Networks {
.or_insert_with(|| NetworkData {
id: ptr.InterfaceLuid,
... | 1 | 62 | 6 |
004db8c0eaf21eda96584d4f8ef7c1c6f2cfa42b | Guillaume Gomez | 2020-02-05T12:40:38 | Extend linux network interface | diff --git a/src/linux/network.rs b/src/linux/network.rs
index 4068c78..9f7378f 100644
--- a/src/linux/network.rs
+++ b/src/linux/network.rs
@@ -210,15 +210,47 @@ impl NetworkExt for NetworkData {
self.rx_bytes as u64 - self.old_rx_bytes as u64
}
+ fn get_total_income(&self) -> u64 {
+ self.rx... | 1 | 35 | 3 |
331206dd1634160994997d6228235e76a8b7f5e5 | Guillaume Gomez | 2020-02-05T12:36:53 | Extend mac network interface | diff --git a/src/mac/network.rs b/src/mac/network.rs
index 55a45be..d006a1a 100644
--- a/src/mac/network.rs
+++ b/src/mac/network.rs
@@ -14,6 +14,13 @@ use NetworkExt;
use NetworksExt;
use NetworksIter;
+macro_rules! old_and_new {
+ ($ty_:expr, $name:ident, $old:ident, $new_val:expr) => {{
+ $ty_.$old = $... | 1 | 71 | 16 |
01eaae26760ef5c27827cc5f4102df0629fb9b0b | Guillaume Gomez | 2020-02-05T12:36:42 | Extend NetworkExt interface | diff --git a/src/traits.rs b/src/traits.rs
index 24e7dd3..e8fccf4 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -804,7 +804,7 @@ pub trait NetworkExt {
/// ```
fn get_income(&self) -> u64;
- /// Returns the number of outgoing bytes since the last refresh.
+ /// Returns the total number of incoming... | 1 | 111 | 7 |
cd68da3450c82cf39374d4e9b076a8821cbba255 | Guillaume Gomez | 2020-02-05T09:27:04 | Update C interface | diff --git a/src/c_interface.rs b/src/c_interface.rs
index 4b9eef0..f7765cc 100644
--- a/src/c_interface.rs
+++ b/src/c_interface.rs
@@ -131,14 +131,14 @@ pub extern "C" fn sysinfo_refresh_disks(system: CSystem) {
Box::into_raw(system);
}
-/// Equivalent of `System::refresh_disk_list()`.
+/// Equivalent of `Sys... | 1 | 3 | 3 |
f91999f3d196698c5d60ec8e2985e74ef2fb662e | Guillaume Gomez | 2020-02-04T21:37:14 | Don't read network compressed packets on linux for the moment | diff --git a/src/linux/network.rs b/src/linux/network.rs
index f08ebef..4068c78 100644
--- a/src/linux/network.rs
+++ b/src/linux/network.rs
@@ -92,8 +92,8 @@ impl NetworksExt for Networks {
let tx_packets = read(parent, "tx_packets", &mut data);
let rx_errors = read(parent, "r... | 1 | 30 | 30 |
a9e2eb970c476f376db944e3b996c5a13554c36e | Guillaume Gomez | 2020-02-04T21:33:58 | Improve doc examples with removal of .iter() call | diff --git a/src/traits.rs b/src/traits.rs
index 61b09bd..24e7dd3 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -745,7 +745,7 @@ pub trait SystemExt: Sized {
///
/// let s = System::new_all();
/// let networks = s.get_networks();
- /// for (interface_name, data) in networks.iter() {
+ /// for (... | 1 | 6 | 6 |
1cc6b886ac9729c5530e71372a4d70836f2a5812 | Guillaume Gomez | 2020-02-04T21:33:21 | Implement IntoIterator on Networks | diff --git a/src/common.rs b/src/common.rs
index a637365..5bdc9c3 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -5,6 +5,8 @@
//
use NetworkData;
+use Networks;
+use NetworksExt;
/// Trait to have a common fallback for the `Pid` type.
pub trait AsU32 {
@@ -215,3 +217,12 @@ impl<'a> Iterator for NetworksIter<... | 1 | 11 | 0 |
10213551e73610d6e6d73aa4b36a436479b65c36 | Guillaume Gomez | 2020-02-04T21:19:41 | small cleanup | diff --git a/src/linux/system.rs b/src/linux/system.rs
index 7095060..947b0a8 100644
--- a/src/linux/system.rs
+++ b/src/linux/system.rs
@@ -13,7 +13,7 @@ use Disk;
use LoadAvg;
use Networks;
use Pid;
-use {DiskExt, NetworksExt, ProcessExt, RefreshKind, SystemExt};
+use {DiskExt, ProcessExt, RefreshKind, SystemExt};... | 2 | 1 | 2 |
0a639fd94bca23251dd34a049c5526f0aa2832f0 | Guillaume Gomez | 2020-02-04T21:19:33 | Add missing parts for unknown targets | diff --git a/src/unknown/mod.rs b/src/unknown/mod.rs
index 9238248..bfb7215 100644
--- a/src/unknown/mod.rs
+++ b/src/unknown/mod.rs
@@ -13,7 +13,7 @@ pub mod system;
pub use self::component::Component;
pub use self::disk::{Disk, DiskType};
-pub use self::network::NetworkData;
+pub use self::network::{Networks, Net... | 3 | 52 | 6 |
bb7388f9d6a8ca867305c1481fb2e2be7994c1e7 | Guillaume Gomez | 2020-02-04T18:58:01 | Fix mac errors | diff --git a/Cargo.toml b/Cargo.toml
index ee11838..79a6192 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,11 +16,11 @@ build = "build.rs"
cfg-if = "0.1"
rayon = "^1.0"
doc-comment = "0.3"
+once_cell = "1.0"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["fileapi", "handleapi", "if... | 3 | 22 | 10 |
d4d47f1c1035fc8ec99cc4fb8a6ec14f040ce251 | GuillaumeGomez | 2020-02-04T17:18:53 | Update docs and benchmarks | diff --git a/benches/basic.rs b/benches/basic.rs
index a6f3833..5e6b633 100644
--- a/benches/basic.rs
+++ b/benches/basic.rs
@@ -4,6 +4,7 @@ extern crate sysinfo;
extern crate test;
use sysinfo::SystemExt;
+use sysinfo::get_current_pid;
#[bench]
fn bench_new(b: &mut test::Bencher) {
@@ -12,9 +13,16 @@ fn bench_... | 4 | 39 | 15 |
088bf1d62287281a40ed3699f67f42cf47bb6d2c | GuillaumeGomez | 2020-02-04T16:57:34 | renaming for some methods | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index 56b9cad..c50e7d2 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -129,7 +129,7 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
"help" => print_help(),
"refresh_disks" => {
writeln!(&mut i... | 10 | 73 | 72 |
b3f6c3c2bf29b414cc8d5bbd9e3347c810bec988 | GuillaumeGomez | 2020-02-04T16:49:26 | Add networks_list entry for RefreshKind | diff --git a/src/common.rs b/src/common.rs
index 4ccf9be..854e233 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -115,6 +115,7 @@ assert_eq!(r.", stringify!($name), "(), false);
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct RefreshKind {
networks: bool,
+ networks_list: bool,
processes: bool... | 5 | 8 | 9 |
1691e9f4185a68c5add1f0b84a113a23fb2ab97d | GuillaumeGomez | 2020-02-04T16:46:49 | Remove duplicate calls on refresh | diff --git a/src/traits.rs b/src/traits.rs
index 20d51d0..1af987b 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -367,9 +367,7 @@ pub trait SystemExt: Sized {
/// let s = System::new();
/// ```
fn new() -> Self {
- let mut s = Self::new_with_specifics(RefreshKind::new());
- s.refresh_all... | 3 | 13 | 7 |
b16d9c9bbf4c7c499eb4aff394aebf62f6f1d292 | GuillaumeGomez | 2020-02-04T16:05:41 | Add load average support for windows | diff --git a/Cargo.toml b/Cargo.toml
index 072e850..ee11838 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,13 +20,11 @@ doc-comment = "0.3"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["fileapi", "handleapi", "ifdef", "ioapiset", "minwindef", "pdh", "psapi", "synchapi", "sysinfoapi", ... | 7 | 142 | 61 |
1dabf925e967b280c9247a1817a4f22e3e681be5 | GuillaumeGomez | 2020-02-03T23:52:58 | Improve network display in example | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index d4fa7ca..56b9cad 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -366,7 +366,7 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
fn main() {
println!("Getting processes' information...");
- let mut t = System:... | 1 | 1 | 1 |
4da4d6ebbdce3f6288980e6c6a54dadf6915bb34 | GuillaumeGomez | 2020-02-03T23:52:46 | Fix windows network part and remove software interfaces | diff --git a/src/traits.rs b/src/traits.rs
index 2fcbc2d..20d51d0 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -356,9 +356,8 @@ pub trait ProcessorExt {
/// Contains all the methods of the [`System`] type.
pub trait SystemExt: Sized {
- /// Creates a new [`System`] instance. It only contains the disks' list... | 4 | 100 | 10 |
2333ca7416bb8aa61b91846f83581a913f9f4424 | GuillaumeGomez | 2020-02-02T23:19:20 | Greatly rework network API | diff --git a/Cargo.toml b/Cargo.toml
index f3f68f0..072e850 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ rayon = "^1.0"
doc-comment = "0.3"
[target.'cfg(windows)'.dependencies]
-winapi = { version = "0.3", features = ["fileapi", "handleapi", "ioapiset", "minwindef", "pdh", "psapi", "synchapi", "sysinf... | 12 | 253 | 177 |
0277a0a55ec1ee8f222fa7e03747387b35dd9627 | Guillaume Gomez | 2020-02-02T15:24:51 | Start network refactoring on windows | diff --git a/src/windows/ffi.rs b/src/windows/ffi.rs
new file mode 100644
index 0000000..7f56182
--- /dev/null
+++ b/src/windows/ffi.rs
@@ -0,0 +1,178 @@
+// TO BE REMOVED ONCE https://github.com/retep998/winapi-rs/pull/802 IS MERGED!!!
+use shared::ifdef::{NET_LUID, NET_IFINDEX};
+use shared::ntdef::{UCHAR, ULONG, ULO... | 4 | 211 | 96 |
bebc32bd8797446b375ab5a5a6bb7c90e1cd2960 | Guillaume Gomez | 2020-01-31T10:43:15 | Update c_interface | diff --git a/src/c_interface.rs b/src/c_interface.rs
index d144c35..4b9eef0 100644
--- a/src/c_interface.rs
+++ b/src/c_interface.rs
@@ -7,7 +7,7 @@
use libc::{self, c_char, c_float, c_uint, c_void, pid_t, size_t};
use std::borrow::BorrowMut;
use std::ffi::CString;
-use {NetworkExt, Process, ProcessExt, ProcessorExt... | 1 | 15 | 7 |
2ab3bf402bc20798d0debe2d978ade8eea5f73b8 | Guillaume Gomez | 2020-01-31T10:07:18 | replace .insert by .insert_with | diff --git a/src/linux/network.rs b/src/linux/network.rs
index 34c4022..6980886 100644
--- a/src/linux/network.rs
+++ b/src/linux/network.rs
@@ -85,7 +85,7 @@ impl Networks {
let tx_errors = read(parent, "tx_errors", &mut data);
let rx_compressed = read(parent, "rx_compressed",... | 1 | 1 | 1 |
23256e80397395e0df43a80eb7be82ef614fb89c | Guillaume Gomez | 2020-01-31T00:10:21 | Improve network example | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index eb06242..d4fa7ca 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -248,10 +248,12 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
for (interface_name, data) in sys.get_networks().iter() {
w... | 1 | 4 | 2 |
3a7438496907a45551dbba070101b2761aa7b31d | Guillaume Gomez | 2020-01-31T00:09:57 | Implement new Networks system on mac | diff --git a/src/common.rs b/src/common.rs
index 56c143f..4ccf9be 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -198,9 +198,7 @@ pub struct NetworksIter<'a> {
impl<'a> NetworksIter<'a> {
pub(crate) fn new(v: std::collections::hash_map::Iter<'a, String, NetworkData>) -> Self {
- NetworksIter {
- ... | 7 | 160 | 101 |
383f944dd04cab3ae4227768dae2db5ea11cb370 | Guillaume Gomez | 2020-01-30T22:15:54 | speed up networks refresh | diff --git a/src/common.rs b/src/common.rs
index 1ac8078..56c143f 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -4,6 +4,8 @@
// Copyright (c) 2015 Guillaume Gomez
//
+use NetworkData;
+
/// Trait to have a common fallback for the `Pid` type.
pub trait AsU32 {
/// Allows to convert `Pid` into `u32`.
@@ -1... | 5 | 172 | 52 |
ab059a7693c7df148aa9fe813728ffc609f0c5ff | Guillaume Gomez | 2020-01-30T22:12:33 | Update to new Networks type | diff --git a/benches/basic.rs b/benches/basic.rs
index 6fae247..a6f3833 100644
--- a/benches/basic.rs
+++ b/benches/basic.rs
@@ -70,11 +70,11 @@ fn bench_refresh_disk_lists(b: &mut test::Bencher) {
}
#[bench]
-fn bench_refresh_network(b: &mut test::Bencher) {
+fn bench_refresh_networks(b: &mut test::Bencher) {
... | 2 | 12 | 13 |
b1277bae7df98ebe0d3670343baeebf5d9a7be03 | Guillaume Gomez | 2020-01-29T23:19:17 | Rework network interface | diff --git a/src/linux/mod.rs b/src/linux/mod.rs
index 9238248..bfb7215 100644
--- a/src/linux/mod.rs
+++ b/src/linux/mod.rs
@@ -13,7 +13,7 @@ pub mod system;
pub use self::component::Component;
pub use self::disk::{Disk, DiskType};
-pub use self::network::NetworkData;
+pub use self::network::{Networks, NetworkData... | 5 | 127 | 78 |
983c87b30533b51cd93ca0b01a7e2672fd12deb8 | Guillaume Gomez | 2020-01-29T22:31:22 | remove too general io and net files | diff --git a/src/io.rs b/src/io.rs
deleted file mode 100644
index e301862..0000000
--- a/src/io.rs
+++ /dev/null
@@ -1,97 +0,0 @@
-use std::collections::HashMap;
-#[cfg(unix)]
-use std::fs::File;
-#[cfg(unix)]
-use std::io::Read;
-
-use NICLoad;
-
-/// IOLoad represents current system block devices IO statistics
-#[der... | 3 | 0 | 172 |
f53b7bc39de04d751f521caca7d7a29b2734bc37 | Guillaume Gomez | 2020-01-28T22:19:08 | Add get_brand for unknown | diff --git a/src/unknown/processor.rs b/src/unknown/processor.rs
index 9fa7727..dab8d59 100644
--- a/src/unknown/processor.rs
+++ b/src/unknown/processor.rs
@@ -28,4 +28,8 @@ impl ProcessorExt for Processor {
fn get_vendor_id(&self) -> &str {
""
}
+
+ fn get_brand(&self) -> &str {
+ ""
+ ... | 1 | 4 | 0 |
d7b4a3571b882cb6cdba7b7ddbe33982f83d8a8f | Guillaume Gomez | 2020-01-28T22:16:10 | Add brand command and rename proc to procs | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index 8bbc9be..d0b8c5a 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -79,7 +79,7 @@ fn print_help() {
);
writeln!(
&mut io::stdout(),
- "proc : Displays proc state"
+ "procd : D... | 1 | 15 | 3 |
4682a4287f0d82fb511d254b3b2ab79288ec69b9 | Guillaume Gomez | 2020-01-28T22:05:46 | Add brand for windows | diff --git a/src/windows/processor.rs b/src/windows/processor.rs
index f6fdd83..3959309 100644
--- a/src/windows/processor.rs
+++ b/src/windows/processor.rs
@@ -253,6 +253,7 @@ pub struct Processor {
key_idle: Option<KeyHandler>,
key_used: Option<KeyHandler>,
vendor_id: String,
+ brand: String,
f... | 2 | 22 | 13 |
7bd812ada659416b87bde7cea15e91e3309c31c7 | Guillaume Gomez | 2020-01-28T21:56:29 | Add brand for mac | diff --git a/src/mac/processor.rs b/src/mac/processor.rs
index cacdb3c..b6fbbbd 100644
--- a/src/mac/processor.rs
+++ b/src/mac/processor.rs
@@ -57,6 +57,7 @@ pub struct Processor {
processor_data: Arc<ProcessorData>,
frequency: u64,
vendor_id: String,
+ brand: String,
}
impl Processor {
@@ -65,6 ... | 2 | 17 | 4 |
68d64df1b00806cad13cb75902cf5f4b78e43f2a | Guillaume Gomez | 2020-01-28T21:56:10 | Add brand for linux | diff --git a/src/linux/process.rs b/src/linux/process.rs
index 5475091..c15543e 100644
--- a/src/linux/process.rs
+++ b/src/linux/process.rs
@@ -7,7 +7,6 @@
use std::collections::HashMap;
use std::fmt::{self, Debug, Formatter};
use std::fs::File;
-use std::io::Read;
use std::path::{Path, PathBuf};
use libc::{c_i... | 3 | 31 | 9 |
40c6c8a6bb3a372cd343e9cc1a3aa883cd2ebff4 | Guillaume Gomez | 2020-01-28T21:55:59 | Add get_brand method for processor | diff --git a/src/traits.rs b/src/traits.rs
index d3622ef..22a2cd4 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -328,6 +328,18 @@ pub trait ProcessorExt {
/// ```
fn get_vendor_id(&self) -> &str;
+ /// Returns the processor's brand.
+ ///
+ /// ```no_run
+ /// use sysinfo::{ProcessorExt, Sys... | 1 | 12 | 0 |
13b91546025a23f1b8ac50802c6ef2efbd5feb5b | GuillaumeGomez | 2020-01-28T00:02:37 | Add frequency and vendor id on windows | diff --git a/Cargo.toml b/Cargo.toml
index dfdf9be..f3f68f0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ rayon = "^1.0"
doc-comment = "0.3"
[target.'cfg(windows)'.dependencies]
-winapi = { version = "0.3", features = ["fileapi", "handleapi", "ioapiset", "minwindef", "pdh", "psapi", "synchapi", "sysinf... | 6 | 133 | 407 |
a3bf93f4e055a17159c7967742272a4dfb7a4b1b | GuillaumeGomez | 2020-01-28T00:02:16 | Clean up simple.rs | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index 14b84a5..8bbc9be 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -1,46 +1,122 @@
-//
+//
// Sysinfo
-//
+//
// Copyright (c) 2017 Guillaume Gomez
//
#![crate_type = "bin"]
-
#![allow(unused_must_use, non_upper_case_globals)]... | 1 | 212 | 62 |
f8d766aef47e52961cddd553133b63eeff0b657e | GuillaumeGomez | 2020-01-26T23:19:25 | Add code examples | diff --git a/src/traits.rs b/src/traits.rs
index a495c34..d3622ef 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -26,24 +26,79 @@ use std::path::Path;
/// ```
pub trait DiskExt {
/// Returns the disk type.
+ ///
+ /// ```no_run
+ /// use sysinfo::{DiskExt, System, SystemExt};
+ ///
+ /// let s ... | 1 | 475 | 2 |
e70594d45522585f2438919f74da8f648c034d19 | GuillaumeGomez | 2020-01-26T22:51:30 | remove windows warnings | diff --git a/src/sysinfo.rs b/src/sysinfo.rs
index 26a1f5d..54d08a1 100644
--- a/src/sysinfo.rs
+++ b/src/sysinfo.rs
@@ -112,21 +112,21 @@ mod utils;
/// Note that if you set a limit bigger than the system limit, the system limit will be set.
///
/// Returns `true` if the new value has been set.
-pub fn set_open_fil... | 2 | 15 | 6 |
d05a3a4dc2585ecda8314bed9161a6f368e948dd | GuillaumeGomez | 2020-01-26T22:39:05 | Remove unneeded dependencies and unused functions | diff --git a/Cargo.toml b/Cargo.toml
index 016327e..dfdf9be 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,10 +16,6 @@ build = "build.rs"
cfg-if = "0.1"
rayon = "^1.0"
doc-comment = "0.3"
-walkdir = "2.2.9"
-pnet_datalink = "0.23.0"
-num_cpus = "1.11.1"
-cache-size = "0.4.0"
[target.'cfg(windows)'.dependencies]
... | 4 | 4 | 104 |
4e0401719b7801fc03311dbaec29b9a9321ee446 | Guillaume Gomez | 2020-01-26T22:17:25 | Handle CTRL+D in example | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index 5f364d3..14b84a5 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -216,6 +216,12 @@ fn main() {
io::stdout().flush();
stin.read_line(&mut input);
+ if input.is_empty() {
+ // The string is empty, ... | 1 | 6 | 0 |
564ab541730d75a5d4534b499bc38800318c04d1 | Guillaume Gomez | 2020-01-26T22:14:23 | Add new methods into examples as well | diff --git a/examples/src/simple.rs b/examples/src/simple.rs
index a623ce9..5f364d3 100644
--- a/examples/src/simple.rs
+++ b/examples/src/simple.rs
@@ -38,6 +38,9 @@ fn print_help() {
writeln!(&mut io::stdout(), "network : Displays network' information");
writeln!(&mut io::stdout(), "all ... | 1 | 15 | 0 |
7512696c3a594006d5329b2fc2301fbd36a4226e | Guillaume Gomez | 2020-01-26T22:14:10 | rename load_avg method | diff --git a/src/linux/system.rs b/src/linux/system.rs
index feb195f..0cf9d81 100644
--- a/src/linux/system.rs
+++ b/src/linux/system.rs
@@ -374,7 +374,7 @@ impl SystemExt for System {
self.uptime
}
- fn get_avg_load(&self) -> LoadAvg {
+ fn get_load_average(&self) -> LoadAvg {
let mut s ... | 6 | 6 | 6 |
2101ee4751d83e35d25e9a68c04e964d8cbcb4f5 | Guillaume Gomez | 2020-01-26T22:03:17 | Implement API for unknown as well | diff --git a/src/unknown/mod.rs b/src/unknown/mod.rs
index 6ce307c..9238248 100644
--- a/src/unknown/mod.rs
+++ b/src/unknown/mod.rs
@@ -15,5 +15,5 @@ pub use self::component::Component;
pub use self::disk::{Disk, DiskType};
pub use self::network::NetworkData;
pub use self::process::{Process, ProcessStatus};
-pub us... | 3 | 15 | 13 |
029d07129298db1b2e27d750cb7621917bde8570 | Guillaume Gomez | 2020-01-26T22:01:13 | Add new methods for windows | diff --git a/src/windows/processor.rs b/src/windows/processor.rs
index 5e79aa7..5289a5a 100644
--- a/src/windows/processor.rs
+++ b/src/windows/processor.rs
@@ -260,6 +260,16 @@ impl ProcessorExt for Processor {
fn get_name(&self) -> &str {
&self.name
}
+
+ // Not yet implemented.
+ fn get_freq... | 2 | 19 | 0 |
347ca3894cca20ee5265cf0d1246a9178a2e865e | Guillaume Gomez | 2020-01-26T21:54:30 | Clean up weird mac API | diff --git a/src/mac/process.rs b/src/mac/process.rs
index d5c60cf..65ffb01 100644
--- a/src/mac/process.rs
+++ b/src/mac/process.rs
@@ -13,7 +13,6 @@ use std::path::{Path, PathBuf};
use libc::{c_int, c_void, gid_t, kill, size_t, uid_t};
-use LoadAvg;
use Pid;
use ProcessExt;
@@ -297,18 +296,6 @@ impl ProcessE... | 3 | 31 | 39 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.