Merge branch 'develop' of https://github.com/nicolargo/glances into develop

This commit is contained in:
Drakarah 2025-12-15 07:57:47 +00:00
commit 74771d0949
9 changed files with 7305 additions and 7274 deletions

View File

@ -56,7 +56,7 @@ elasticsearch==9.2.0 ; python_full_version >= '3.10'
# via glances
exceptiongroup==1.2.2 ; python_full_version < '3.11'
# via anyio
fastapi==0.122.0
fastapi==0.124.0
# via glances
geomet==1.1.0
# via cassandra-driver
@ -70,7 +70,7 @@ ibm-cloud-sdk-core==3.24.2
# via ibmcloudant
ibmcloudant==0.11.0 ; python_full_version < '3.10'
# via glances
ibmcloudant==0.11.1 ; python_full_version >= '3.10'
ibmcloudant==0.11.2 ; python_full_version >= '3.10'
# via glances
idna==3.11
# via
@ -120,13 +120,17 @@ prometheus-client==0.23.1
# via glances
protobuf==4.25.8 ; python_full_version < '3.10'
# via bernhard
protobuf==6.33.1 ; python_full_version >= '3.10'
protobuf==6.33.2 ; python_full_version >= '3.10'
# via bernhard
psutil==7.1.3
# via glances
psycopg==3.2.13
psycopg==3.2.13 ; python_full_version < '3.10'
# via glances
psycopg-binary==3.2.13 ; implementation_name != 'pypy'
psycopg==3.3.1 ; python_full_version >= '3.10'
# via glances
psycopg-binary==3.2.13 ; python_full_version < '3.10' and implementation_name != 'pypy'
# via psycopg
psycopg-binary==3.3.1 ; python_full_version >= '3.10' and implementation_name != 'pypy'
# via psycopg
pyarrow==21.0.0 ; python_full_version < '3.10'
# via influxdb3-python
@ -148,7 +152,7 @@ pyjwt==2.10.1
# ibmcloudant
pymdstat==0.4.3
# via glances
pymongo==4.15.4
pymongo==4.15.5
# via glances
pyreadline3==3.5.4 ; sys_platform == 'win32'
# via humanfriendly
@ -234,7 +238,7 @@ typing-inspection==0.4.2
# via pydantic
tzdata==2025.2 ; sys_platform == 'win32'
# via psycopg
urllib3==2.5.0
urllib3==2.6.0
# via
# docker
# elastic-transport

View File

@ -273,7 +273,7 @@ pillow==12.0.0 ; python_full_version >= '3.10'
# via matplotlib
platformdirs==4.4.0 ; python_full_version < '3.10'
# via virtualenv
platformdirs==4.5.0 ; python_full_version >= '3.10'
platformdirs==4.5.1 ; python_full_version >= '3.10'
# via virtualenv
pluggy==1.6.0
# via pytest
@ -282,7 +282,7 @@ pre-commit==4.5.0 ; python_full_version >= '3.10'
# via
# googleapis-common-protos
# opentelemetry-proto
protobuf==6.33.1 ; python_full_version >= '3.10'
protobuf==6.33.2 ; python_full_version >= '3.10'
protobuf==4.25.8 ; python_full_version < '3.10'
# via
# googleapis-common-protos
@ -359,7 +359,7 @@ rpds-py==0.27.1 ; python_full_version < '3.10'
# via
# jsonschema
# referencing
rpds-py==0.29.0 ; python_full_version >= '3.10'
rpds-py==0.30.0 ; python_full_version >= '3.10'
# via
# jsonschema
# referencing
@ -372,11 +372,11 @@ ruamel-yaml-clib==0.2.14 ; python_full_version >= '3.10' or platform_python_impl
# via
# ruamel-yaml
# semgrep
ruff==0.14.7
ruff==0.14.8
selenium==4.36.0 ; python_full_version < '3.10'
selenium==4.38.0 ; python_full_version >= '3.10'
semgrep==1.136.0 ; python_full_version < '3.10'
semgrep==1.144.0 ; python_full_version >= '3.10'
semgrep==1.145.0 ; python_full_version >= '3.10'
setuptools==80.9.0
# via opentelemetry-instrumentation
shellingham==1.5.4
@ -461,7 +461,7 @@ typing-inspection==0.4.2
# via
# pydantic
# pydantic-settings
urllib3==2.5.0
urllib3==2.6.0
# via
# requests
# selenium

View File

@ -20,7 +20,7 @@ docker==7.1.0
# via glances
exceptiongroup==1.2.2 ; python_full_version < '3.11'
# via anyio
fastapi==0.122.0
fastapi==0.124.0
# via glances
h11==0.16.0
# via uvicorn
@ -74,7 +74,7 @@ typing-extensions==4.15.0
# uvicorn
typing-inspection==0.4.2
# via pydantic
urllib3==2.5.0
urllib3==2.6.0
# via
# docker
# podman

View File

@ -1,16 +1,24 @@
{
"topMenu": ["quicklook", "cpu", "percpu", "gpu", "mem", "memswap", "load"],
"leftMenu": [
"network",
"ports",
"wifi",
"connections",
"diskio",
"fs",
"irq",
"folders",
"raid",
"smart",
"sensors"
]
"topMenu": [
"quicklook",
"cpu",
"percpu",
"gpu",
"mem",
"memswap",
"load"
],
"leftMenu": [
"network",
"ports",
"wifi",
"connections",
"diskio",
"fs",
"irq",
"folders",
"raid",
"smart",
"sensors"
]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -20,6 +20,7 @@ See: https://wiki.archlinux.org/title/AMDGPU#Manually
# │   └── drm
# │   └── card0
# │   └── device
# │   ├── device
# │   ├── gpu_busy_percent
# │   ├── hwmon
# │   │   └── hwmon0
@ -27,13 +28,15 @@ See: https://wiki.archlinux.org/title/AMDGPU#Manually
# │   ├── mem_info_vram_total
# │   ├── mem_info_vram_used
# │   ├── pp_dpm_mclk
# │   └── pp_dpm_sclk
# │   ├── pp_dpm_sclk
# │   └── revision
# └── kernel
# └── debug
# └── dri
# └── 0
# └── amdgpu_pm_info
import functools
import os
import re
from typing import Optional
@ -41,6 +44,9 @@ from typing import Optional
DRM_ROOT_FOLDER: str = '/sys/class/drm'
CARD_REGEX: str = r"^card\d$"
DEVICE_FOLDER: str = 'device'
AMDGPU_IDS_FILE: str = '/usr/share/libdrm/amdgpu.ids'
PCI_DEVICE_ID: str = 'device'
PCI_REVISION_ID: str = 'revision'
GPU_PROC_PERCENT: str = 'gpu_busy_percent'
GPU_MEM_TOTAL: str = 'mem_info_vram_total'
GPU_MEM_USED: str = 'mem_info_vram_used'
@ -99,28 +105,47 @@ def get_device_list(drm_root_folder: str) -> list:
return ret
def read_file(*path_segments: str) -> Optional[str]:
"""Return content of file."""
path = os.path.join(*path_segments)
if os.path.isfile(path):
with open(path) as f:
try:
return f.read().strip()
except PermissionError:
# Catch exception (see issue #3125)
return None
return None
@functools.cache
def get_device_name(device_folder: str) -> str:
"""Return the GPU name."""
# Table source: https://cgit.freedesktop.org/drm/libdrm/tree/data/amdgpu.ids
device_id = read_file(device_folder, PCI_DEVICE_ID)
revision_id = read_file(device_folder, PCI_REVISION_ID)
amdgpu_ids = read_file(AMDGPU_IDS_FILE)
if device_id and revision_id and amdgpu_ids:
# Strip leading "0x" and convert to uppercase hexadecimal
device_id = device_id[2:].upper()
revision_id = revision_id[2:].upper()
# Syntax:
# device_id, revision_id, product_name <-- single tab after comma
pattern = re.compile(f'^{device_id},\\s{revision_id},\\s(?P<product_name>.+)$', re.MULTILINE)
if match := pattern.search(amdgpu_ids):
return match.group('product_name').removeprefix('AMD ').removesuffix(' Graphics')
return 'AMD GPU'
def get_mem(device_folder: str) -> Optional[int]:
"""Return the memory consumption in %."""
mem_info_vram_total = os.path.join(device_folder, GPU_MEM_TOTAL)
mem_info_vram_used = os.path.join(device_folder, GPU_MEM_USED)
if os.path.isfile(mem_info_vram_total) and os.path.isfile(mem_info_vram_used):
with open(mem_info_vram_total) as f:
try:
mem_info_vram_total = int(f.read())
except PermissionError:
# Catch exception (see issue #3125)
return None
with open(mem_info_vram_used) as f:
try:
mem_info_vram_used = int(f.read())
except PermissionError:
# Catch exception (see issue #3125)
return None
mem_info_vram_total = read_file(device_folder, GPU_MEM_TOTAL)
mem_info_vram_used = read_file(device_folder, GPU_MEM_USED)
if mem_info_vram_total and mem_info_vram_used:
mem_info_vram_total = int(mem_info_vram_total)
mem_info_vram_used = int(mem_info_vram_used)
if mem_info_vram_total > 0:
return round(mem_info_vram_used / mem_info_vram_total * 100)
return None
@ -128,14 +153,8 @@ def get_mem(device_folder: str) -> Optional[int]:
def get_proc(device_folder: str) -> Optional[int]:
"""Return the processor consumption in %."""
gpu_busy_percent = os.path.join(device_folder, GPU_PROC_PERCENT)
if os.path.isfile(gpu_busy_percent):
with open(gpu_busy_percent) as f:
try:
return int(f.read())
except PermissionError:
# Catch exception (see issue #3125)
return None
if gpu_busy_percent := read_file(device_folder, GPU_PROC_PERCENT):
return int(gpu_busy_percent)
return None
@ -148,12 +167,10 @@ def get_temperature(device_folder: str) -> Optional[int]:
for _, _, files in os.walk(os.path.join(root, d)):
for f in files:
if re.match(GPU_TEMPERATURE_REGEXP, f):
with open(os.path.join(root, d, f)) as f:
try:
temp_input.append(int(f.read()))
except PermissionError:
# Catch exception (see issue #3125)
return None
if a_temp_input := read_file(root, d, f):
temp_input.append(int(a_temp_input))
else:
return None
if temp_input:
return round(sum(temp_input) / len(temp_input) / 1000)
return None

View File

@ -0,0 +1 @@
0x1586

View File

@ -0,0 +1 @@
0xc1