Skip to content

Commit

Permalink
fix issues on non-Linux regarding typos/imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementTsang committed Nov 21, 2022
1 parent d0cf1ba commit bdcecf6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/app/data_harvester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ use starship_battery::{Battery, Manager};
#[cfg(not(target_os = "linux"))]
use sysinfo::{System, SystemExt};

use self::processes::CpuUsageStrategy;

use super::DataFilters;
use crate::app::layout_manager::UsedWidgets;

Expand Down Expand Up @@ -333,6 +331,8 @@ impl DataCollector {
#[cfg(target_os = "linux")]
{
// Must do this here since we otherwise have to make `get_process_data` async.
use self::processes::CpuUsageStrategy;

let normalize_cpu = if self.unnormalized_cpu {
heim::cpu::logical_count()
.await
Expand Down
2 changes: 1 addition & 1 deletion src/app/data_harvester/processes/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn get_process_data(
super::macos_freebsd::get_process_data(
sys,
use_current_cpu_total,
cpu_strategy,
unnormalized_cpu,
mem_total_kb,
user_table,
get_macos_process_cpu_usage,
Expand Down
3 changes: 2 additions & 1 deletion src/app/data_harvester/processes/macos_freebsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ where
let mut process_vector: Vec<ProcessHarvest> = Vec::new();
let process_hashmap = sys.processes();
let cpu_usage = sys.global_cpu_info().cpu_usage() as f64 / 100.0;
let num_processors = sys.cpus().len() as f64;

for process_val in process_hashmap.values() {
let name = if process_val.name().is_empty() {
let process_cmd = process_val.cmd();
Expand Down Expand Up @@ -48,7 +50,6 @@ where
}
};

let num_processors = sys.cpus().len() as f64;
let pcu = {
let usage = process_val.cpu_usage() as f64;
if unnormalized_cpu || num_processors == 0.0 {
Expand Down

0 comments on commit bdcecf6

Please sign in to comment.