Syllo / nvtop

GPU & Accelerator process monitoring for AMD, Apple, Huawei, Intel, NVIDIA and Qualcomm
Other
8.05k stars 291 forks source link

The GPU utilization graph drawing is broken (being updated incorrectly) in Gentoo #200

Open ivanp7 opened 1 year ago

ivanp7 commented 1 year ago

I've installed nvtop 3.0.1 on Gentoo using ebuild from the GURU repository, and the graph drawing is broken like this

image

ncurses version is 6.3. Is there something that can be done?

P.S. Looks like Gentoo ncurses has force enabled unicode support (I have libncursesw.so installed).

ivanp7 commented 1 year ago

ldd reports that the binary is linked to the wide ncurses image

zhuyifei1999 commented 1 year ago

FWIW, being on Gentoo by itself doesn't cause what you see, nor does using unicode ncurses: Screenshot_2023-04-10_20-50-39

In fact, unicode ncurses is preferred: https://github.com/Syllo/nvtop/blob/37f1b16bebbe8bb08da3d1f74a9cdbdbd7e4316a/CMakeLists.txt#L27-L35

Syllo commented 1 year ago

Hello, Using ncursesw should be the default, so I don't think that it comes from a ncurses vs ncursesw issue.

This could be a bug in the drawing routine. @ivanp7 does it happen with any terminal size? Can you give me the terminal size used when the issue happens?

Syllo commented 1 year ago

Could be related to #192

ivanp7 commented 1 year ago

@Syllo Indeed, it is related to #192. I have tried tabs -8 and it worked flawlessly (my terminal uses 4 chars for tabs by default). However, I use the same terminal with the same tab setting on Artix Linux, and nvtop does not reproduce the bug there. As for the terminal size, it happens with any size. P.S. I use manually compiled st with patches.

Syllo commented 1 year ago

Could it be a terminal emulator issue? Is it the same on both systems?

ivanp7 commented 1 year ago

It is compiled from the same source and uses the same configuration. Generally, it does work without glitches in ncurses applications. It does not cause the nvtop bug on Artix Linux (where tab is 4 chars).

ivanp7 commented 1 year ago

I have just noticed that nvtop graph still glitches even with tabs -8, just less often with less artifacts.

WhiskeyTuesday commented 1 year ago

This only seems to happen to me (Pop_OS 22.04, nvtop 1.2.2) if I have sort set to GPU or GPU MEM, and seems to be triggered by nvtop trying to print "Comparing GPU rates" somewhere on screen and getting layout messed up as a result.

If I sort by PID, CPU, or anything else I've tried so far that message is never displayed, and the rendering never gets corrupted.

Happens both in and out of tmux, and in all terminal emulators that I have installed (gnome-term, alacritty, wezterm, cool-retro-term)

Syllo commented 1 year ago

@WhiskeyTuesday, yes that was a known issue where I left a debug print in the release by inadvertence! I think that this could be worked around by redirecting the standard error, i.e., nvtop 2>/dev/null.

I don't think that it is related to the plot code: The method starts with a window erase and the plot code does never print any tabulation. The fact that changing tabulation size somehow diminishes the problem leads me to think that there could be a curses issue or that I am not using it right. I don't seem to be able to reproduce with ncurses 6.4 on Arch Linux using gnome-terminal.

Have you tried other terminal emulators, e.g., gnome-terminal, konsole, etc?

WhiskeyTuesday commented 1 year ago

I have tried on several terminals both in and out of tmux. The messed up plotting seems to happen at the same time as the vertical shift that is caused by the debug message. When it happens the top line of information at the top of the display cuts off, and the various other issues occur at the same time, including shifting the "tops" of each spike on the graphs up by what looks to me like one line, and from then on they persist where they are with the correct graph still being drawn underneath (and continuing to scroll to the left).

image Screenshot from 2023-04-13 13-38-29

WhiskeyTuesday commented 1 year ago

Hitting F6 to bring up the sort menu, or Esc if it is already open, either of which trigger a full page refresh I suspect, fixes the problem for a few ticks until the debug message is printed again.

Syllo commented 1 year ago

@WhiskeyTuesday the debug print has been removed in a patch already and made it in nvtop versions >= 2. So I would advise you to use a more recent version of nvtop (e.g., use the AppImage).

Syllo commented 1 year ago

Are you guys still experiencing this issue?

ivanp7 commented 1 year ago

Unfortunately, yes