From 08742a9ed527dfa2412e34c814570c8a81994599 Mon Sep 17 00:00:00 2001 From: Mario Krehl Date: Tue, 4 Jun 2024 10:21:49 +0200 Subject: [PATCH 1/2] Fix: EWW_NET wrong values for TX/RX stats The sysinfo crate, structure Networks, basically caches one value of total_received/total_transmitted each (as well as other metrics) and returns the difference between those two values when queried via the `received()` and `transmitted()` functions. These values are updated by both the `refresh()` and `refresh_list()` functions; so by calling both of them right after each other like previously done here, sets both the cached total_received/... and the current total_received/... to nearly the same value. `refresh_list()` also updates the list of interfaces on a host, with a marginally small performance impact for doing so (I measured slightly more than 100 microseconds on my machine (0.1 milliseconds), around 20-25% more than with `refresh()`), especially considering this is run only every 2 seconds. --- crates/eww/src/config/system_stats.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/eww/src/config/system_stats.rs b/crates/eww/src/config/system_stats.rs index 995d7ada..b4c46b7b 100644 --- a/crates/eww/src/config/system_stats.rs +++ b/crates/eww/src/config/system_stats.rs @@ -212,7 +212,6 @@ pub fn net() -> String { let (ref mut last_refresh, ref mut networks) = &mut *NETWORKS.lock().unwrap(); networks.refresh_list(); - networks.refresh(); let elapsed = last_refresh.next_refresh(); networks From a96c0de153b7ebad318b538594783cd14ff931bf Mon Sep 17 00:00:00 2001 From: Mario Krehl Date: Tue, 4 Jun 2024 14:28:02 +0200 Subject: [PATCH 2/2] Add changelog entry for the EWW_NET bugfix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77119b8a..2b407c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to eww will be listed here, starting at changes since versio - Fix and refactor nix flake (By: w-lfchen) - Fix remove items from systray (By: vnva) - Fix the gtk `stack` widget (By: ovalkonia) +- Fix values in the `EWW_NET` variable (By: mario-kr) ### Features - Update rust toolchain to 1.80.1 (By: w-lfchen)