Skip to content

Commit

Permalink
refactor: delete more stuff
Browse files Browse the repository at this point in the history
Mostly previously re-added files during the merge conflict resolution,
and a lot of unused code.

Still more to delete after I finish rewriting the process kill dialog.
  • Loading branch information
ClementTsang committed Sep 26, 2021
1 parent b6ca3e0 commit 9089231
Show file tree
Hide file tree
Showing 38 changed files with 309 additions and 4,098 deletions.
450 changes: 149 additions & 301 deletions src/app.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/data_farmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl DataCollection {
}

fn eat_proc(&mut self, list_of_processes: Vec<processes::ProcessHarvest>) {
// TODO: Probably more efficient to do this in the data collection step, but it's fine for now.
// TODO: [Optimization] Probably more efficient to do this in the data collection step, but it's fine for now.
self.process_name_pid_map.clear();
self.process_cmd_pid_map.clear();
list_of_processes.iter().for_each(|process_harvest| {
Expand Down
2 changes: 1 addition & 1 deletion src/app/data_harvester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl DataCollector {
self.sys.refresh_memory();
self.mem_total_kb = self.sys.get_total_memory();

// TODO: Would be good to get this and network list running on a timer instead...?
// TODO: [Data Collection] Would be good to get this and network list running on a timer instead...?
// Refresh components list once...
if self.widgets_to_harvest.use_temp {
self.sys.refresh_components_list();
Expand Down
2 changes: 1 addition & 1 deletion src/app/data_harvester/network/heim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub async fn get_network_data(
};

if to_keep {
// TODO: Use bytes as the default instead, perhaps?
// TODO: [Optimization] Optimization (Potential)Use bytes as the default instead, perhaps?
// Since you might have to do a double conversion (bytes -> bits -> bytes) in some cases;
// but if you stick to bytes, then in the bytes, case, you do no conversion, and in the bits case,
// you only do one conversion...
Expand Down
1 change: 1 addition & 0 deletions src/app/data_harvester/processes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use std::borrow::Cow;

use crate::Pid;

// FIXME: [URGENT] Delete this.
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub enum ProcessSorting {
CpuPercent,
Expand Down
2 changes: 0 additions & 2 deletions src/app/data_harvester/processes/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ pub fn get_process_data(
pid_mapping: &mut FxHashMap<Pid, PrevProcDetails>, use_current_cpu_total: bool,
time_difference_in_secs: u64, mem_total_kb: u64, user_table: &mut UserTable,
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
// TODO: [PROC THREADS] Add threads

if let Ok((cpu_usage, cpu_fraction)) = cpu_usage_calculation(prev_idle, prev_non_idle) {
let mut pids_to_clear: FxHashSet<Pid> = pid_mapping.keys().cloned().collect();

Expand Down
5 changes: 3 additions & 2 deletions src/app/layout_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ pub struct LayoutCreationOutput {
/// Creates a new [`Arena<LayoutNode>`] from the given config and returns it, along with the [`NodeId`] representing
/// the root of the newly created [`Arena`], a mapping from [`NodeId`]s to [`BottomWidget`]s, and optionally, a default
/// selected [`NodeId`].
// FIXME: This is currently jury-rigged "glue" just to work with the existing config system! We are NOT keeping it like this, it's too awful to keep like this!
// FIXME: [AFTER REFACTOR] This is currently jury-rigged "glue" just to work with the existing config system! We are NOT keeping it like this, it's too awful to keep like this!
pub fn create_layout_tree(
rows: &[Row], process_defaults: ProcessDefaults, app_config_fields: &AppConfigFields,
) -> Result<LayoutCreationOutput> {
Expand Down Expand Up @@ -924,6 +924,7 @@ pub fn move_widget_selection(
if let Some(proposed_widget) = widget_lookup_map.get_mut(&proposed_id) {
match proposed_widget.selectable_type() {
SelectableType::Unselectable => {
// FIXME: [URGENT] Test this; make sure this cannot recurse infinitely! Maybe through a unit test too.
// Try to move again recursively.
move_widget_selection(
layout_tree,
Expand Down Expand Up @@ -960,7 +961,7 @@ pub fn generate_layout(
root: NodeId, arena: &mut Arena<LayoutNode>, area: Rect,
lookup_map: &FxHashMap<NodeId, TmpBottomWidget>,
) {
// TODO: [Layout] Add some caching/dirty mechanisms to reduce calls.
// TODO: [Optimization, Layout] Add some caching/dirty mechanisms to reduce calls.

/// A [`Size`] is a set of widths and heights that a node in our layout wants to be.
#[derive(Default, Clone, Copy, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/app/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ pub fn parse_query(
if content == "=" {
// Check next string if possible
if let Some(queue_next) = query.pop_front() {
// TODO: Need to consider the following cases:
// TODO: [Query, ???] Need to consider the following cases:
// - (test)
// - (test
// - test)
Expand Down
Loading

0 comments on commit 9089231

Please sign in to comment.