mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 05:34:57 +02:00
Set up more file hierarchy.
This commit is contained in:
parent
2c53ab09a9
commit
c8bbf5850c
45
src/main.rs
45
src/main.rs
@ -1,4 +1,3 @@
|
|||||||
use std::collections::BTreeMap;
|
|
||||||
use sysinfo::{ProcessExt, ProcessStatus, RefreshKind, System, SystemExt};
|
use sysinfo::{ProcessExt, ProcessStatus, RefreshKind, System, SystemExt};
|
||||||
|
|
||||||
// TODO: Fix this - CPU Up, and CPU Down!
|
// TODO: Fix this - CPU Up, and CPU Down!
|
||||||
@ -48,32 +47,32 @@ fn draw_sorted_processes(sorting_method: ProcessSorting, reverse_order: bool, sy
|
|||||||
let mut process_vector: Vec<sysinfo::Process> = process_hashmap.iter().map(|(_, process)| process.clone()).collect();
|
let mut process_vector: Vec<sysinfo::Process> = process_hashmap.iter().map(|(_, process)| process.clone()).collect();
|
||||||
|
|
||||||
match sorting_method {
|
match sorting_method {
|
||||||
ProcessSorting::CPU => process_vector.sort_by(|a, b| {
|
ProcessSorting::CPU => process_vector.sort_by(|a, b| {
|
||||||
let a_usage = a.cpu_usage();
|
let a_usage = a.cpu_usage();
|
||||||
let b_usage = b.cpu_usage();
|
let b_usage = b.cpu_usage();
|
||||||
|
|
||||||
if a_usage > b_usage {
|
if a_usage > b_usage {
|
||||||
if reverse_order {
|
if reverse_order {
|
||||||
std::cmp::Ordering::Less
|
std::cmp::Ordering::Less
|
||||||
} else {
|
|
||||||
std::cmp::Ordering::Greater
|
|
||||||
}
|
|
||||||
} else if a_usage < b_usage {
|
|
||||||
if reverse_order {
|
|
||||||
std::cmp::Ordering::Greater
|
|
||||||
} else {
|
|
||||||
std::cmp::Ordering::Less
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
std::cmp::Ordering::Equal
|
std::cmp::Ordering::Greater
|
||||||
}
|
}
|
||||||
}),
|
} else if a_usage < b_usage {
|
||||||
ProcessSorting::MEM => {}
|
if reverse_order {
|
||||||
ProcessSorting::PID => {}
|
std::cmp::Ordering::Greater
|
||||||
ProcessSorting::Status => {}
|
} else {
|
||||||
}
|
std::cmp::Ordering::Less
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
std::cmp::Ordering::Equal
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
ProcessSorting::MEM => {}
|
||||||
|
ProcessSorting::PID => {}
|
||||||
|
ProcessSorting::Status => {}
|
||||||
|
}
|
||||||
|
|
||||||
let mut formatted_vector : Vec<ProcessInfo> = Vec::new();
|
let mut formatted_vector: Vec<ProcessInfo> = Vec::new();
|
||||||
for process in &mut process_vector {
|
for process in &mut process_vector {
|
||||||
formatted_vector.push(ProcessInfo {
|
formatted_vector.push(ProcessInfo {
|
||||||
cpu_usage: process.cpu_usage(),
|
cpu_usage: process.cpu_usage(),
|
||||||
|
0
src/widgets/cpu.rs
Normal file
0
src/widgets/cpu.rs
Normal file
0
src/widgets/disks.rs
Normal file
0
src/widgets/disks.rs
Normal file
0
src/widgets/mem.rs
Normal file
0
src/widgets/mem.rs
Normal file
0
src/widgets/network.rs
Normal file
0
src/widgets/network.rs
Normal file
0
src/widgets/processes.rs
Normal file
0
src/widgets/processes.rs
Normal file
0
src/widgets/temp.rs
Normal file
0
src/widgets/temp.rs
Normal file
0
tests/basic_tests.rs
Normal file
0
tests/basic_tests.rs
Normal file
Loading…
x
Reference in New Issue
Block a user