Bug 474828 - The system monitor shows a zigzag (sawtooth) profile when downloading at a constant rate.
Summary: The system monitor shows a zigzag (sawtooth) profile when downloading at a co...
Status: REPORTED
Alias: None
Product: plasma-systemmonitor
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-24 07:10 UTC by Tino
Modified: 2023-09-25 18:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
screenshot shows zigzag profile of the network traffic (122.13 KB, image/png)
2023-09-24 07:10 UTC, Tino
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tino 2023-09-24 07:10:23 UTC
Created attachment 161840 [details]
screenshot shows zigzag profile of the network traffic

SUMMARY
***
The system monitor shows a zigzag (sawtooth) profile when downloading at a constant rate.

Note, this only seems to happen on systems where the underlying kernel network driver doesn't allow adjusting the refresh frequency of the device transmission statistics.
***

STEPS TO REPRODUCE
1. download at a constant rate, e.g. wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.5.tar.xz
2. open the KDE system monitor and observe the network diagram


OBSERVED RESULT
zigzag profile, where the max is twice the download rate

EXPECTED RESULT
constant profile

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE 15.4 and 15.5
KDE Plasma Version: 
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

The underlying problem seems to be with ksystemstats5 which calculates the download/upload rates using a hard-coded interval of 0.5s:

https://github.com/KDE/ksystemstats/blob/master/plugins/network/NetworkManagerBackend.cpp#L20
                // Update rate in ms
                static const int UpdateRate = 500;

However, not all kernel network device driver support updating the refresh frequency of the received/sent byte statistics:
        # ethtool -c eth0 | grep stats-block-usecs
        stats-block-usecs: 0

        # ethtool -C eth0 stats-block-usecs 500000
        netlink error: Invalid argument

        # lspci | grep Ethernet
        04:00.0 Ethernet controller: Broadcom Inc. and subsidiaries NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)

The update-frequency of the statistics of my eth0 device seems to be about 1s (checked via cat /proc/net/dev), which explains the zigzag profile (first 0.5s no change in received bytes --> 0 Mb/s, second 0.5s all bytes received in the whole second --> twice as much Mb/s).