summaryrefslogtreecommitdiffstats
path: root/src/data_conversion.rs
diff options
context:
space:
mode:
authorClementTsang <cjhtsang@uwaterloo.ca>2020-02-05 21:37:49 -0500
committerClementTsang <cjhtsang@uwaterloo.ca>2020-02-05 21:37:49 -0500
commit8782b327b9aae181e4fd99a8936ac9bf0a4b51a3 (patch)
tree648c4bb70393154f8098b3b67a48abd0483e1bcc /src/data_conversion.rs
parenta9565d21a354752ae29205ad3b18b0824874274e (diff)
[skip travis] minor refactor of conversion fns
Diffstat (limited to 'src/data_conversion.rs')
-rw-r--r--src/data_conversion.rs46
1 files changed, 6 insertions, 40 deletions
diff --git a/src/data_conversion.rs b/src/data_conversion.rs
index b3cc4acd..f323112e 100644
--- a/src/data_conversion.rs
+++ b/src/data_conversion.rs
@@ -58,41 +58,7 @@ impl From<&CpuPoint> for (f64, f64) {
}
}
-pub fn convert_all(app: &App, current_data: &data_farmer::DataCollection) {
- let current_time = current_data.current_instant;
-
- // Network
- let network_data: ConvertedNetworkData = ConvertedNetworkData::default();
- let network_data_rx: Vec<(f64, f64)> = Vec::new();
- let network_data_tx: Vec<(f64, f64)> = Vec::new();
- let rx_display: String = String::default();
- let tx_display: String = String::default();
- let total_rx_display: String = String::default();
- let total_tx_display: String = String::default();
-
- // Disk
- let mut disk_table_data: Vec<Vec<String>> = Vec::new();
-
- // Temp
- let temp_sensor_table_data: Vec<Vec<String>> = update_temp_row(app);
-
- // Mem
- let mut mem_vector: Vec<(f64, f64)> = Vec::new();
- let mut swap_vector: Vec<(f64, f64)> = Vec::new();
- let memory_and_swap_labels: (String, String);
-
- // CPU
- let mut cpu_vector: Vec<ConvertedCpuData> = Vec::new();
-
- // Process
- let mut process_single_list: HashMap<u32, ProcessHarvest> = HashMap::new();
- let mut process_grouped_hashmap: HashMap<String, (u32, f64, f64, Vec<u32>)> =
- std::collections::HashMap::new();
-
- for (time, data) in &current_data.timed_data_vec {}
-}
-
-pub fn update_temp_row(app: &App) -> Vec<Vec<String>> {
+pub fn convert_temp_row(app: &App) -> Vec<Vec<String>> {
let mut sensor_vector: Vec<Vec<String>> = Vec::new();
let current_data = &app.data_collection;
@@ -117,7 +83,7 @@ pub fn update_temp_row(app: &App) -> Vec<Vec<String>> {
sensor_vector
}
-pub fn update_disk_row(current_data: &data_farmer::DataCollection) -> Vec<Vec<String>> {
+pub fn convert_disk_row(current_data: &data_farmer::DataCollection) -> Vec<Vec<String>> {
let mut disk_vector: Vec<Vec<String>> = Vec::new();
for (itx, disk) in current_data.disk_harvest.iter().enumerate() {
let io_activity = if current_data.io_labels.len() > itx {
@@ -153,7 +119,7 @@ pub fn update_disk_row(current_data: &data_farmer::DataCollection) -> Vec<Vec<St
disk_vector
}
-pub fn update_cpu_data_points(
+pub fn convert_cpu_data_points(
show_avg_cpu: bool, current_data: &data_farmer::DataCollection,
) -> Vec<ConvertedCpuData> {
let mut cpu_data_vector: Vec<ConvertedCpuData> = Vec::new();
@@ -200,7 +166,7 @@ pub fn update_cpu_data_points(
cpu_data_vector
}
-pub fn update_mem_data_points(current_data: &data_farmer::DataCollection) -> Vec<(f64, f64)> {
+pub fn convert_mem_data_points(current_data: &data_farmer::DataCollection) -> Vec<(f64, f64)> {
let mut result: Vec<(f64, f64)> = Vec::new();
let current_time = current_data.current_instant;
@@ -221,7 +187,7 @@ pub fn update_mem_data_points(current_data: &data_farmer::DataCollection) -> Vec
result
}
-pub fn update_swap_data_points(current_data: &data_farmer::DataCollection) -> Vec<(f64, f64)> {
+pub fn convert_swap_data_points(current_data: &data_farmer::DataCollection) -> Vec<(f64, f64)> {
let mut result: Vec<(f64, f64)> = Vec::new();
let current_time = current_data.current_instant;
@@ -242,7 +208,7 @@ pub fn update_swap_data_points(current_data: &data_farmer::DataCollection) -> Ve
result
}
-pub fn update_mem_labels(current_data: &data_farmer::DataCollection) -> (String, String) {
+pub fn convert_mem_labels(current_data: &data_farmer::DataCollection) -> (String, String) {
let mem_label = if current_data.memory_harvest.mem_total_in_mb == 0 {
"".to_string()
} else {