Switch network module to read /proc/net/dev

This fixes issue #610 by reading bandwidth usage per-interface from
/proc/net/dev instead of globally via /proc/net/netstat. It supports the
same matching logic as elsewhere, so setting interface to '*' should
display the same sum-total bandwidth usage as the previous
implementation.
This commit is contained in:
Ciaran Downey
2021-08-25 14:47:51 -07:00
parent 4e256cf3f0
commit 9d9f959769
2 changed files with 79 additions and 90 deletions

View File

@ -43,6 +43,7 @@ class Network : public ALabel {
const std::string getNetworkState() const;
void clearIface();
bool wildcardMatch(const std::string& pattern, const std::string& text) const;
std::optional<std::pair<unsigned long long, unsigned long long>> readBandwidthUsage();
int ifid_;
sa_family_t family_;