summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/data_collection/processes.rs3
-rw-r--r--src/data_collection/processes/freebsd.rs72
-rw-r--r--src/data_collection/processes/unix.rs2
3 files changed, 0 insertions, 77 deletions
diff --git a/src/data_collection/processes.rs b/src/data_collection/processes.rs
index ef96c818..dacb5fe3 100644
--- a/src/data_collection/processes.rs
+++ b/src/data_collection/processes.rs
@@ -15,9 +15,6 @@ cfg_if! {
} else if #[cfg(target_os = "windows")] {
pub mod windows;
pub use self::windows::*;
- } else if #[cfg(target_os = "freebsd")] {
- pub mod freebsd;
- pub(crate) use self::freebsd::*;
} else if #[cfg(target_family = "unix")] {
pub(crate) struct GenericProcessExt;
impl UnixProcessExt for GenericProcessExt {}
diff --git a/src/data_collection/processes/freebsd.rs b/src/data_collection/processes/freebsd.rs
deleted file mode 100644
index f0a8262a..00000000
--- a/src/data_collection/processes/freebsd.rs
+++ /dev/null
@@ -1,72 +0,0 @@
-//! Process data collection for FreeBSD. Uses sysinfo.
-
-use std::{io, process::Command};
-
-use hashbrown::HashMap;
-use serde::{Deserialize, Deserializer};
-
-use crate::{
- data_collection::{deserialize_xo, processes::UnixProcessExt},
- Pid,
-};
-
-#[derive(Deserialize, Debug, Default)]
-#[serde(rename_all = "kebab-case")]
-struct ProcessInformation {
- process: Vec<ProcessRow>,
-}
-
-#[derive(Deserialize, Debug)]
-#[serde(rename_all = "kebab-case")]
-struct ProcessRow {
- #[serde(deserialize_with = "pid")]
- pid: i32,
- #[serde(deserialize_with = "percent_cpu")]
- percent_cpu: f64,
-}
-
-pub(crate) struct FreeBSDProcessExt;
-
-impl UnixProcessExt for FreeBSDProcessExt {
- #[inline]
- fn has_backup_proc_cpu_fn() -> bool {
- true
- }
-
- fn backup_proc_cpu(pids: &[Pid]) -> io::Result<HashMap<Pid, f64>> {
- if pids.is_empty() {
- return Ok(HashMap::new());
- }
-
- let output = Command::new("ps")
- .args(["--libxo", "json", "-o", "pid,pcpu", "-p"])
- .args(pids.iter().map(i32::to_string))
- .output()?;
-
- deserialize_xo("process-information", &output.stdout).map(
- |process_info: ProcessInformation| {
- process_info
- .process
- .into_iter()
- .map(|row| (row.pid, row.percent_cpu))
- .collect()
- },
- )
- }
-}
-
-fn pid<'de, D>(deserializer: D) -> Result<i32, D::Error>
-where
- D: Deserializer<'de>,
-{
- let s = String::deserialize(deserializer)?;
- s.parse().map_err(serde::de::Error::custom)
-}
-
-fn percent_cpu<'de, D>(deserializer: D) -> Result<f64, D::Error>
-where
- D: Deserializer<'de>,
-{
- let s = String::deserialize(deserializer)?;
- s.parse().map_err(serde::de::Error::custom)
-}
diff --git a/src/data_collection/processes/unix.rs b/src/data_collection/processes/unix.rs
index ea1a3701..784c02dd 100644
--- a/src/data_collection/processes/unix.rs
+++ b/src/data_collection/processes/unix.rs
@@ -25,8 +25,6 @@ cfg_if! {
cfg_if! {
if #[cfg(target_os = "macos")] {
MacOSProcessExt::sysinfo_process_data(sys, use_current_cpu_total, unnormalized_cpu, total_memory, user_table)
- } else if #[cfg(target_os = "freebsd")] {
- FreeBSDProcessExt::sysinfo_process_data(sys, use_current_cpu_total, unnormalized_cpu, total_memory, user_table)
} else {
GenericProcessExt::sysinfo_process_data(sys, use_current_cpu_total, unnormalized_cpu, total_memory, user_table)
}