htop-dev / htop

htop - an interactive process viewer

Home Page:https://htop.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strange change on ELAPSED time by mouse scroll

Ali-Javanmardi opened this issue · comments

Distribution: Manjaro
Kernel: 6.7.0-0-MANJARO
htop: 3.2.2.1-1

What's strange?
I opened htop after a fresh system restart to check my memory usage and suddenly I found when I scroll up process list by mouse and it reaches to up most process, by continuing mouse scroll it increases the value of ELAPSED time for all processes in the list.

I couldn't quite reproduce this behaviour with the current head on Lubuntu 24.04, thus could you please provide a short screencast of the issue for demonstration?

Apart from this: Does this also happen for you when you update to the latest release (3.3.0) or the current main brach?

I have htop: 3.2.2.1-1 installed by the official repository of linux Manjaro and may be in a few days they change version to latest as you mentioned 3.3.0.

So please let me to rely on official repository and wait for update.

but here I attach two screenshot one after system boot and second after a few scroll up by mouse and you can see all ELAPSED time records increased significantly.

first_screenshot

after_few_scroll_up

By the way, please note that I'm using KDE desktop and I think you are using LMDE.

Thank you for the two screenshots. Thanks to them I noticed an issue with my earlier test setup (was missing the ELAPSED column and mistakenly looked at TIME+). With that corrected, I had a closer look at the values, both locally and with your screenshots.

Let's first have a look at the screenshots: If I'm calculating this correctly, these two screenshots were taken approx. 1min 20sec apart (based on the uptime meter). Looking at e.g. the ELAPSED values for PID 1772, you see, that the values of "elapsed time since the process started" also increased by approximately the same amount. So that one adds up AFAICS.

What might look a bit strange though, is when you scroll repeatedly, the screen is refreshed repeatedly too, thus you see a continuous "motion" on these columns. If you scroll continuously and track the time you were scrolling alongside you will notice that the increase is approx 1s/s.

On the opposite, and here comes my local experiments into play, if you leave the TUI doing its thing™ you will notice jumps to be about 1.2s/refresh (at least for me, value may vary depending on the hardware/system). This is somewhat remarkable, as the refresh speed currently is set to 1.0 seconds per refresh in my setup. To explain this difference, we can look a bit in the architecture of htop, which does not precisely track time with a timer, but instead sleeps in between refresh cycles. As depending on active options a refresh may take quite some amount of time, you get this skew of 0.2s in my case. If I increase to 2.0s/refresh, I got about 2.5 seconds and with 0.1s/refresh it was about 1.0 seconds per refresh. There are some details as to why these times are all over the place, but that's a bit more complicated than I want to fit into this comment right now.

TL;DR: The "steady" increase in ELAPSED looks normal and consistent with what the column should display, but the jumps seen in that column in different situations may be a bit surprising.

@BenBE
Thanks to your attention and time you spend for this question.
Your conclusion seems logical and I think you found it.