diff --git a/src-tauri/src/app.rs b/src-tauri/src/app.rs index 533ae03d..1f0f4db2 100644 --- a/src-tauri/src/app.rs +++ b/src-tauri/src/app.rs @@ -40,42 +40,42 @@ impl AppState { .analysis .insert(name, disk_analysis); } - pub fn emit_sysinfo(&self, app: &tauri::AppHandle) { + pub async fn emit_sysinfo(&self, app: &tauri::AppHandle) { let sys_info = self.0.lock().unwrap().metrics.get_system_information(); app.emit("emit_sysinfo", &sys_info).unwrap(); } - pub fn emit_global_cpu(&self, app: &tauri::AppHandle) { + pub async fn emit_global_cpu(&self, app: &tauri::AppHandle) { let global_cpu = self.0.lock().unwrap().metrics.get_global_cpu(); app.emit("emit_global_cpu", &global_cpu).unwrap(); } - pub fn emit_cpus(&self, app: &tauri::AppHandle) { + pub async fn emit_cpus(&self, app: &tauri::AppHandle) { let cpus = self.0.lock().unwrap().metrics.get_cpus(); app.emit("emit_cpus", &cpus).unwrap(); } - pub fn emit_memory(&self, app: &tauri::AppHandle) { + pub async fn emit_memory(&self, app: &tauri::AppHandle) { let memory = self.0.lock().unwrap().metrics.get_memory(); app.emit("emit_memory", &memory).unwrap(); } - pub fn emit_swap(&self, app: &tauri::AppHandle) { + pub async fn emit_swap(&self, app: &tauri::AppHandle) { let swap = self.0.lock().unwrap().metrics.get_swap(); app.emit("emit_swap", &swap).unwrap(); } - pub fn emit_networks(&self, app: &tauri::AppHandle) { + pub async fn emit_networks(&self, app: &tauri::AppHandle) { let networks = self.0.lock().unwrap().metrics.get_networks(); app.emit("emit_networks", &networks).unwrap(); } - pub fn emit_disks(&self, app: &tauri::AppHandle) { + pub async fn emit_disks(&self, app: &tauri::AppHandle) { let disks = self.0.lock().unwrap().metrics.get_disks(); app.emit("emit_disks", &disks).unwrap(); } - pub fn emit_processes(&self, app: &tauri::AppHandle) { + pub async fn emit_processes(&self, app: &tauri::AppHandle) { let processes = self.0.lock().unwrap().metrics.get_processes(); app.emit("emit_processes", &processes).unwrap(); } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index f0af62b2..d62250aa 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -23,6 +23,7 @@ mod utils; use app::AppState; use tauri::menu::Menu; +use tokio::time; use std::time::Duration; @@ -38,14 +39,21 @@ fn build_and_run_app(app: AppState) { tauri::async_runtime::spawn(async move { loop { - state.emit_sysinfo(&handle); - state.emit_global_cpu(&handle); - state.emit_cpus(&handle); - state.emit_memory(&handle); - state.emit_swap(&handle); - state.emit_networks(&handle); - state.emit_disks(&handle); - state.emit_processes(&handle); + state.emit_sysinfo(&handle).await; + std::thread::sleep(Duration::from_millis(100)); + state.emit_global_cpu(&handle).await; + std::thread::sleep(Duration::from_millis(100)); + state.emit_cpus(&handle).await; + std::thread::sleep(Duration::from_millis(100)); + state.emit_memory(&handle).await; + std::thread::sleep(Duration::from_millis(100)); + state.emit_swap(&handle).await; + std::thread::sleep(Duration::from_millis(100)); + state.emit_networks(&handle).await; + std::thread::sleep(Duration::from_millis(100)); + state.emit_disks(&handle).await; + std::thread::sleep(Duration::from_millis(100)); + state.emit_processes(&handle).await; std::thread::sleep(Duration::from_secs(1)) } }); diff --git a/src/components/area-chart.tsx b/src/components/area-chart.tsx index 8b9ac050..cfee3854 100644 --- a/src/components/area-chart.tsx +++ b/src/components/area-chart.tsx @@ -44,6 +44,7 @@ export const useAreaChartState = ( // This is the rectangle box that u can use to navigate navigator: { adaptToUpdatedData: true, + maskFill: other.charts.area.default.navigator.maskFill, handles: { backgroundColor: other.charts.area.default.navigator.handles.backgroundColor, @@ -53,6 +54,29 @@ export const useAreaChartState = ( plotOptions: { series: { + boostThreshold: 1, + turboThreshold: 1, + showInNavigator: true, + + // dataGrouping: { + // enabled: true, + // anchor: "start", + // forced: true, + // groupAll: true, + // units: [ + // [ + // "millisecond", // unit name + // [1, 2, 5, 10, 20, 25, 50, 100, 200, 500], // allowed multiples + // ], + // ["second", [1, 2, 5, 10, 15, 30]], + // ["minute", [1, 2, 5, 10, 15, 30]], + // ["hour", [1, 2, 3, 4, 6, 8, 12]], + // ["day", [1]], + // ["week", [1]], + // ["month", [1, 3, 6]], + // ["year", null], + // ], + // }, marker: { enabled: false, }, @@ -173,7 +197,9 @@ export const useAreaChartState = ( }, boost: { enabled: true, - useGPUTranslations: false, + + usePreallocated: true, + useGPUTranslations: true, allowForce: true, }, chart: {