rbonghi / jetson_stats

📊 Simple package for monitoring and control your NVIDIA Jetson [Orin, Xavier, Nano, TX] series
https://rnext.it/jetson_stats
GNU Affero General Public License v3.0
2.14k stars 261 forks source link

jtop exits with stacktrace from "GPU" tab when 3d_scaling is disabled #501

Open subhachandrachandra opened 6 months ago

subhachandrachandra commented 6 months ago

Describe the bug

When 3d_scaling is disabled by setting GPU governor to 'performance' mode, jtop will exit with a stack trace when switched to the 'GPU' page

To Reproduce

Steps to reproduce the behavior:

  1. Set GPU governor to performance mode. Ex. echo performance > /sys/devices/17000000.ga10b/devfreq/17000000.ga10b/governor
  2. Start jtop
  3. Switch to 'GPU' page by pressing '2'
  4. jtop will exit with a stacktrace

Screenshots

Traceback (most recent call last): File "/usr/local/bin/jtop", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/jtop/main.py", line 160, in main curses.wrapper(JTOPGUI, jetson, pages, init_page=args.page, File "/usr/lib/python3.8/curses/init.py", line 105, in wrapper return func(stdscr, *args, **kwds) File "/usr/local/lib/python3.8/dist-packages/jtop/gui/jtopgui.py", line 100, in init self.run(loop, seconds) File "/usr/local/lib/python3.8/dist-packages/jtop/gui/jtopgui.py", line 129, in run self.draw() File "/usr/local/lib/python3.8/dist-packages/jtop/gui/jtopgui.py", line 143, in draw page.draw(self.key, self.mouse) File "/usr/local/lib/python3.8/dist-packages/jtop/gui/pgpu.py", line 164, in draw scaling_string = "Active" if gpu_status['3d_scaling'] else "Disable" KeyError: '3d_scaling'

Expected behavior

The dict in python should be accessed using 'get' in a safe manner. Changing the 2 lines where it crashed to use 'get' like below fixes the problem.

        # 3D scaling
        scaling_string = "Active" if gpu_status.get('3d_scaling') else "Disable"
        scaling_status = NColors.green() if gpu_status.get('3d_scaling') else curses.A_NORMAL

Board

Output from jetson_release -v: Software part of jetson-stats 4.2.6 - (c) 2024, Raffaello Bonghi Model: Jetson AGX Orin - Jetpack 5.1 [L4T 35.2.1] NV Power Mode[0]: MAXN Serial Number: [XXX Show with: jetson_release -s XXX] Hardware:

subhachandrachandra commented 6 months ago

When GPU is in performance mode the path "/sys/devices/17000000.ga10b/enable_3d_scaling" will not exist as that feature is disabled.