[python] nvidia 显卡性能监控

查看 91|回复 11
作者:zunmx   
引言
最近国补入手了一台Dell G15 5530, 发现在床上玩电脑的时候,显卡功率被限制到30w了,nvidia-smi命令不能实时刷新,其他的工具也太重了,所以搞了一个这个东西。文件可能有点大,我把echarts.js硬编码进来了,如果介意可以改成CDN,我为了图方便(网的质量比较差),就写死了。
技术
python3.x
threading
time
json
webview [这个包应该是pip install pywebview 安装的] , 没有用python的GUI库,感觉挺麻烦的,html做比较简单。
pynvml [这个包会默认找nvml.dll的位置可能不对,需要改包的代码,需要一定的动手能力]
踩坑
pynvml.NVMLError_LibraryNotFound: NVML Shared Library Not Found
这个需要修改pynvml.py,把nvmlLib = CDLL里面的地址硬编码。
截图


image.png (119.87 KB, 下载次数: 0)
下载附件
2025-6-6 10:06 上传

用途- 查找性能下降的原因
  • 机器学习时监控显卡性能
  • 游戏时监控性能
  • 烤机时监控(虽然有些烤机软件都带这个)
  • 单纯的想看一下功率这些参数
  • GPU加速计算时监控 (比如GPU跑字典)

    其实他就是一个监控类型的软件,没啥大用,我本身也是一个程序猿,觉得这种py思路还是挺不错的,弥补了py中一些GUI的缺陷(丑)
    ε=ε=ε=┏(゜ロ゜;)┛
    关键代码
    [color=]class
    Api:
       
    [color=]def
    [color=]__init__
    [color=](
    [color=]self
    [color=])
    :
            
    [color=]self
    .handle = pynvml.nvmlDeviceGetHandleByIndex
    [color=](
    [color=]0
    [color=])

    [color=]        
    [color=]self
    .data =
    [color=]{

    [color=]            
    [color=]"timestamp"
    :
    [color=][]
    ,
                
    [color=]"mem_used"
    :
    [color=][]
    ,
                
    [color=]"mem_total"
    :
    [color=][]
    ,
                
    [color=]"gpu_util"
    :
    [color=][]
    ,
                
    [color=]"temp"
    :
    [color=][]
    ,
                
    [color=]"power_usage"
    :
    [color=][]
    ,
                
    [color=]"power_limit"
    :
    [color=][]
    ,
                
    [color=]"pcie_tx"
    :
    [color=][]
    ,
                
    [color=]"pcie_rx"
    :
    [color=][]
    ,
            
    [color=]}

    [color=]        
    [color=]self
    .lock = threading.Lock
    [color=]()

    [color=]   
    [color=]def
    [color=]get_window_size
    [color=](
    [color=]self
    [color=])
    :
            
    [color=]return
    [color=]{
    [color=]"width"
    : window.width,
    [color=]"height"
    : window.height
    [color=]}

    [color=]   
    [color=]def
    [color=]generate_data
    [color=](
    [color=]self
    [color=])
    :
            
    [color=]with
    [color=]self
    .lock:
                now = time.time
    [color=]()

    [color=]            
    mem = pynvml.nvmlDeviceGetMemoryInfo
    [color=](
    [color=]self
    .handle
    [color=])

    [color=]            
    util = pynvml.nvmlDeviceGetUtilizationRates
    [color=](
    [color=]self
    .handle
    [color=])

    [color=]            
    temp = pynvml.nvmlDeviceGetTemperature
    [color=](
    [color=]self
    .handle, pynvml.NVML_TEMPERATURE_GPU
    [color=])

    [color=]            
    power = pynvml.nvmlDeviceGetPowerUsage
    [color=](
    [color=]self
    .handle
    [color=])
    /
    [color=]1000

    [color=]            
    power_limit = pynvml.nvmlDeviceGetEnforcedPowerLimit
    [color=](
    [color=]self
    .handle
    [color=])
    /
    [color=]1000

    [color=]            
    pcie_tx =
    [color=]round
    [color=](
    pynvml.nvmlDeviceGetPcieThroughput
    [color=](
    [color=]self
    .handle, pynvml.NVML_PCIE_UTIL_TX_BYTES
    [color=])
    /
    [color=]1024
    ,
    [color=]4
    [color=])

    [color=]            
    pcie_rx =
    [color=]round
    [color=](
    pynvml.nvmlDeviceGetPcieThroughput
    [color=](
    [color=]self
    .handle, pynvml.NVML_PCIE_UTIL_RX_BYTES
    [color=])
    /
    [color=]1024
    ,
    [color=]4
    [color=])

    [color=]            
    [color=]self
    .data
    [color=][
    [color=]"timestamp"
    .append
    [color=](
    now
    [color=])

    [color=]            
    [color=]self
    .data
    [color=][
    [color=]"mem_used"
    .append
    [color=](
    mem.used /
    [color=]1024
    **
    [color=]2
    [color=])

    [color=]            
    [color=]self
    .data
    [color=][
    [color=]"mem_total"
    .append
    [color=](
    mem.total /
    [color=]1024
    **
    [color=]2
    [color=])

    [color=]            
    [color=]self
    .data
    [color=][
    [color=]"gpu_util"
    .append
    [color=](
    util.gpu
    [color=])

    [color=]            
    [color=]self
    .data
    [color=][
    [color=]"temp"
    .append
    [color=](
    temp
    [color=])

    [color=]            
    [color=]self
    .data
    [color=][
    [color=]"power_usage"
    .append
    [color=](
    power
    [color=])

    [color=]            
    [color=]self
    .data
    [color=][
    [color=]"power_limit"
    .append
    [color=](
    power_limit
    [color=])

    [color=]            
    [color=]self
    .data
    [color=][
    [color=]"pcie_tx"
    .append
    [color=](
    pcie_tx
    [color=])

    [color=]            
    [color=]self
    .data
    [color=][
    [color=]"pcie_rx"
    .append
    [color=](
    pcie_rx
    [color=])

    [color=]

    [color=]            
    cutoff = now -
    [color=]300

    [color=]            
    [color=]while
    [color=]self
    .data
    [color=][
    [color=]"timestamp"
    [color=]]
    [color=]and
    [color=]self
    .data
    [color=][
    [color=]"timestamp"
    [color=][
    [color=]0
    [color=]]
    结语
    后来发现是因为移动电脑会导致降频锁频30w,放着不动就没事儿。
    这个工具送给有需要的人吧。

    mon_nvidia.zip
    (326.98 KB, 下载次数: 83)
    2025-6-6 10:07 上传
    点击文件名下载附件
    下载积分: 吾爱币 -1 CB

    性能, 显卡

  • wudalang123   


    sean47 发表于 2025-6-7 13:58
    能不能出一个显卡直连功能的开关,为了这个功能,一直没法卸载omen

    [HTML] 纯文本查看 复制代码
       
       
        NVIDIA显卡监控与直连控制
       
       
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
                font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
            }
            
            :root {
                --primary: #76b900;
                --primary-dark: #5c8f00;
                --secondary: #0078d7;
                --dark-bg: #0d1117;
                --dark-card: #161b22;
                --dark-border: #30363d;
                --text-light: #f0f6fc;
                --text-gray: #8b949e;
                --danger: #f85149;
                --warning: #d29922;
                --success: #3fb950;
                --info: #58a6ff;
                --purple: #9d4edd;
            }
            
            body {
                background: linear-gradient(135deg, #0a0e14, #0d1117);
                color: var(--text-light);
                min-height: 100vh;
                padding: 20px;
                overflow-x: hidden;
            }
            
            .container {
                max-width: 1400px;
                margin: 0 auto;
            }
            
            header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 20px 0;
                margin-bottom: 20px;
                border-bottom: 1px solid var(--dark-border);
                flex-wrap: wrap;
            }
            
            .logo {
                display: flex;
                align-items: center;
                gap: 15px;
            }
            
            .logo-icon {
                width: 50px;
                height: 50px;
                background: linear-gradient(135deg, var(--primary), var(--primary-dark));
                border-radius: 8px;
                display: flex;
                align-items: center;
                justify-content: center;
                box-shadow: 0 4px 12px rgba(118, 185, 0, 0.3);
            }
            
            .logo-icon svg {
                width: 30px;
                height: 30px;
            }
            
            .logo-text {
                display: flex;
                flex-direction: column;
            }
            
            .logo-text h1 {
                font-size: 28px;
                font-weight: 700;
                background: linear-gradient(90deg, var(--text-light), var(--primary));
                -webkit-background-clip: text;
                background-clip: text;
                -webkit-text-fill-color: transparent;
            }
            
            .logo-text p {
                color: var(--text-gray);
                font-size: 14px;
            }
            
            .system-info {
                display: flex;
                gap: 30px;
                text-align: right;
                font-size: 14px;
            }
            
            .info-item {
                display: flex;
                flex-direction: column;
            }
            
            .info-label {
                color: var(--text-gray);
                margin-bottom: 5px;
            }
            
            .info-value {
                font-weight: 600;
                color: var(--primary);
            }
            
            .dashboard {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
                gap: 20px;
                margin-bottom: 30px;
            }
            
            .card {
                background: var(--dark-card);
                border-radius: 12px;
                padding: 20px;
                box-shadow: 0 8px 24px rgba(1, 4, 9, 0.5);
                border: 1px solid var(--dark-border);
                transition: all 0.3s ease;
            }
            
            .card:hover {
                transform: translateY(-5px);
                border-color: var(--primary);
                box-shadow: 0 12px 28px rgba(118, 185, 0, 0.2);
            }
            
            .card-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 20px;
                padding-bottom: 15px;
                border-bottom: 1px solid var(--dark-border);
            }
            
            .card-title {
                font-size: 18px;
                font-weight: 600;
                color: var(--text-light);
                display: flex;
                align-items: center;
                gap: 10px;
            }
            
            .card-title svg {
                width: 20px;
                height: 20px;
            }
            
            .card-content {
                height: 250px;
            }
            
            .stats-grid {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                gap: 15px;
            }
            
            .stat-item {
                background: rgba(22, 27, 34, 0.7);
                padding: 15px;
                border-radius: 8px;
                border-left: 3px solid var(--primary);
                transition: all 0.3s ease;
            }
            
            .stat-item:hover {
                background: rgba(118, 185, 0, 0.1);
                transform: translateX(5px);
            }
            
            .stat-label {
                font-size: 14px;
                color: var(--text-gray);
                margin-bottom: 8px;
                display: flex;
                align-items: center;
                gap: 5px;
            }
            
            .stat-value {
                font-size: 24px;
                font-weight: 700;
            }
            
            .gpu-util .stat-value {
                color: var(--primary);
            }
            
            .gpu-temp .stat-value {
                color: var(--danger);
            }
            
            .gpu-mem .stat-value {
                color: var(--secondary);
            }
            
            .gpu-power .stat-value {
                color: var(--warning);
            }
            
            .process-list {
                max-height: 300px;
                overflow-y: auto;
            }
            
            .process-header {
                display: grid;
                grid-template-columns: 40px 1fr 1fr 100px;
                padding: 10px 0;
                border-bottom: 1px solid var(--dark-border);
                font-weight: 600;
                color: var(--text-gray);
            }
            
            .process-item {
                display: grid;
                grid-template-columns: 40px 1fr 1fr 100px;
                padding: 12px 0;
                border-bottom: 1px solid rgba(48, 54, 61, 0.5);
                transition: background 0.2s ease;
            }
            
            .process-item:hover {
                background: rgba(118, 185, 0, 0.05);
            }
            
            .process-pid {
                color: var(--text-gray);
            }
            
            .process-name {
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
            
            .process-mem {
                color: var(--secondary);
                font-weight: 500;
            }
            
            .process-time {
                color: var(--text-gray);
                text-align: right;
            }
            
            .control-panel {
                display: flex;
                gap: 15px;
                margin-bottom: 20px;
                flex-wrap: wrap;
            }
            
            .btn {
                padding: 10px 20px;
                background: var(--dark-card);
                border: 1px solid var(--dark-border);
                color: var(--text-light);
                border-radius: 6px;
                cursor: pointer;
                transition: all 0.2s ease;
                display: flex;
                align-items: center;
                gap: 8px;
                font-weight: 500;
            }
            
            .btn:hover {
                background: rgba(118, 185, 0, 0.1);
                border-color: var(--primary);
            }
            
            .btn-primary {
                background: var(--primary);
                border-color: var(--primary);
                color: #000;
                font-weight: 600;
            }
            
            .btn-primary:hover {
                background: var(--primary-dark);
            }
            
            .btn-purple {
                background: var(--purple);
                border-color: var(--purple);
                color: white;
                font-weight: 600;
            }
            
            .btn-purple:hover {
                background: #7b2cbf;
                border-color: #7b2cbf;
            }
            
            .notification {
                padding: 15px;
                border-radius: 8px;
                margin-bottom: 20px;
                background: rgba(214, 153, 34, 0.1);
                border-left: 4px solid var(--warning);
                display: flex;
                gap: 12px;
            }
            
            .notification svg {
                min-width: 24px;
                height: 24px;
                color: var(--warning);
            }
            
            .scenarios {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
                gap: 20px;
                margin-bottom: 20px;
            }
            
            .scenario-card {
                background: var(--dark-card);
                border-radius: 12px;
                padding: 20px;
                border: 1px solid var(--dark-border);
                transition: all 0.3s ease;
                cursor: pointer;
            }
            
            .scenario-card:hover {
                transform: translateY(-3px);
                border-color: var(--info);
            }
            
            .scenario-card h3 {
                display: flex;
                align-items: center;
                gap: 10px;
                margin-bottom: 15px;
                color: var(--info);
            }
            
            .scenario-card p {
                color: var(--text-gray);
                font-size: 14px;
                line-height: 1.6;
            }
            
            .scenario-card.active {
                border-color: var(--primary);
                background: rgba(118, 185, 0, 0.05);
            }
            
            footer {
                text-align: center;
                padding: 30px 0 20px;
                color: var(--text-gray);
                font-size: 14px;
                border-top: 1px solid var(--dark-border);
                margin-top: 20px;
            }
            
            .gpu-status {
                display: inline-flex;
                align-items: center;
                gap: 8px;
                padding: 5px 12px;
                background: rgba(59, 185, 80, 0.1);
                border-radius: 20px;
                color: var(--success);
                font-weight: 500;
            }
            
            .status-indicator {
                width: 10px;
                height: 10px;
                background: var(--success);
                border-radius: 50%;
            }
            
            .performance-alert {
                background: rgba(248, 81, 73, 0.1);
                border-left: 4px solid var(--danger);
                padding: 10px 15px;
                border-radius: 8px;
                margin-bottom: 20px;
                display: flex;
                align-items: center;
                gap: 10px;
            }
            
            .direct-mode-panel {
                background: rgba(157, 78, 221, 0.1);
                border-left: 4px solid var(--purple);
                padding: 20px;
                border-radius: 8px;
                margin-bottom: 20px;
            }
            
            .mode-toggle {
                display: flex;
                align-items: center;
                gap: 15px;
                margin-top: 15px;
            }
            
            .toggle-switch {
                position: relative;
                display: inline-block;
                width: 60px;
                height: 34px;
            }
            
            .toggle-switch input {
                opacity: 0;
                width: 0;
                height: 0;
            }
            
            .slider {
                position: absolute;
                cursor: pointer;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                background-color: #30363d;
                transition: .4s;
                border-radius: 34px;
            }
            
            .slider:before {
                position: absolute;
                content: "";
                height: 26px;
                width: 26px;
                left: 4px;
                bottom: 4px;
                background-color: #f0f6fc;
                transition: .4s;
                border-radius: 50%;
            }
            
            input:checked + .slider {
                background-color: var(--purple);
            }
            
            input:checked + .slider:before {
                transform: translateX(26px);
            }
            
            .mode-info {
                margin-top: 15px;
                padding: 15px;
                background: rgba(22, 27, 34, 0.5);
                border-radius: 8px;
                display: none;
            }
            
            .mode-info.active {
                display: block;
            }
            
            .mode-info ul {
                padding-left: 20px;
                margin-top: 10px;
            }
            
            .mode-info li {
                margin-bottom: 8px;
                color: var(--text-gray);
            }
            
            @media (max-width: 768px) {
                header {
                    flex-direction: column;
                    align-items: flex-start;
                    gap: 20px;
                }
                
                .system-info {
                    width: 100%;
                    justify-content: space-between;
                    text-align: left;
                }
                
                .dashboard {
                    grid-template-columns: 1fr;
                }
                
                .scenarios {
                    grid-template-columns: 1fr;
                }
                
                .control-panel {
                    flex-direction: column;
                }
            }
       

       
            
                
                   
                        
                            
                            
                            
                            
                        
                   
                   
                        NVIDIA 显卡监控与直连控制
                        实时监控性能参数 + 显卡直连模式切换
                   
                
                
                   
                        系统时间
                        --:--:--
                   
                   
                        运行时间
                        00:00:00
                   
                   
                        GPU 状态
                        
                            
                            运行中
                        
                   
                
            
            
            
                
                   
                        
                   
                    显卡直连模式控制
                
                
                    此功能允许您绕过Omen等控制软件,直接切换显卡直连模式,提升游戏和图形应用性能
                
                
                
                   
                        
                        
                   
                    混合模式 (当前)
                
                
                
                    混合模式
                    在此模式下,系统会根据负载自动切换集成显卡和独立显卡:
                   
                        
  • 日常应用使用集成显卡以节省电力
                        
  • 3D应用和游戏自动切换到独立显卡
                        
  • 适合日常使用,延长电池寿命
                   

                
                
                
                    直连模式
                    在此模式下,显示器直接连接到独立显卡:
                   
                        
  • 绕过集成显卡,减少性能损失
                        
  • 提升游戏帧率5-15%
                        
  • 减少画面延迟和卡顿
                        
  • 需要重启系统以生效
                   

                
            
            
            
                
                   
                
                
                    提示: 直连模式可显著提升游戏性能,但会增加功耗和发热。混合模式适合日常使用以延长电池寿命。
                
            
            
            
                
                   
                
                
                    性能警告: 检测到GPU功率限制在30W,性能可能受限。请检查设备放置和散热条件。
                
            
            
            
                
                   
                        
                   
                    开始监控
                

                
                   
                        
                        
                   
                    刷新数据
                

                
                   
                        
                   
                    应用显卡模式
                

                
                   
                        
                        
                   
                    导出报告
                

            
            
            
                
                   
                        
                            
                        
                        温度与风扇
                   
                    监控GPU核心温度和散热风扇转速,防止过热降频
                
                
                   
                        
                            
                        
                        GPU 使用率
                   
                    实时显示GPU核心利用率,识别性能瓶颈
                
                
                   
                        
                            
                        
                        显存使用
                   
                    监控显存分配和使用情况,避免显存不足
                
                
                   
                        
                            
                        
                        功率消耗
                   
                    跟踪GPU功耗,检测电源限制问题
                
            
            
            
                
                   
                        
                            
                               
                            
                            温度与风扇
                        
                   
                   
                
                
                
                   
                        
                            
                               
                            
                            GPU 使用率
                        
                   
                   
                
                
                
                   
                        
                            
                               
                            
                            显存使用
                        
                   
                   
                
                
                
                   
                        
                            
                               
                            
                            功率消耗
                        
                   
                   
                
            
            
            
                
                   
                        性能指标概览
                   
                   
                        
                            
                               
                                    
                               
                                GPU 使用率
                            
                            0%
                        
                        
                        
                            
                               
                                    
                               
                                GPU 温度
                            
                            0°C
                        
                        
                        
                            
                               
                                    
                               
                                显存使用
                            
                            0/0 MB
                        
                        
                        
                            
                               
                                    
                               
                                功率消耗
                            
                            0 W
                        
                   
                
                
                
                   
                        
                            
                               
                               
                            
                            GPU 进程
                        
                   
                   
                        
                            PID
                            进程名称
                            类型
                            显存使用
                        
                        
                            
                        
                   
                
            
            
            
                NVIDIA 显卡监控与直连控制工具 v2.0 | 专为游戏玩家和开发者设计 | 解决Omen等软件依赖问题 | 结语:移动设备可能导致降频锁频30W,建议保持设备稳定
            
       
       

    功能亮点1. 显卡直连模式控制
  • 混合模式:日常使用,节省电力
  • 直连模式:游戏和图形应用专用,提升性能
  • 一键切换:无需安装Omen等控制软件
  • 模式说明:详细解释每种模式的特点和适用场景
    2. 全面的性能监控
  • GPU使用率:监控核心负载情况
  • 温度与风扇:防止过热降频
  • 显存使用:避免显存不足导致卡顿
  • 功率消耗:检测电源限制问题
    3. 多场景监控模式
  • 温度与风扇:防止过热降频
  • GPU使用率:识别性能瓶颈
  • 显存使用:避免显存不足
  • 功率消耗:检测电源限制问题
    4. 用户体验优化
  • 深色主题:长时间使用不伤眼
  • 响应式设计:适配不同屏幕尺寸
  • 实时图表:直观展示性能变化
  • 性能告警:自动检测功率限制问题
    显卡直连模式说明为什么需要显卡直连?在默认的混合模式下,独立显卡输出需要经过集成显卡,这会带来:
  • 5-15%的性能损失
  • 增加画面延迟
  • 某些高级显示特性不可用
    直连模式优势
  • 性能提升:游戏帧率提高5-15%
  • 降低延迟:减少画面输入延迟
  • 高级功能:支持G-Sync等高级特性
  • 绕过控制软件:不再依赖Omen等厂商软件
    使用提示
  • 切换模式后需要重启系统生效
  • 直连模式会增加功耗和发热
  • 混合模式适合日常使用以延长电池寿命
    结语这个工具解决了无法卸载Omen软件的问题,同时提供了专业的显卡监控功能。通过显卡直连控制,您可以直接在操作系统层面切换显卡模式,无需依赖任何第三方软件。注意:移动设备可能导致显卡降频(如锁频至30W),建议保持设备稳定放置以获得最佳性能。请将上述代码保存为HTML文件,直接在浏览器中打开即可使用


    Screenshot 2025-06-07 at 19-46-52 DeepSeek - 探索未至之境.png (74.73 KB, 下载次数: 0)
    下载附件
    2025-6-7 19:48 上传

  • wudalang123   

    [HTML] 纯文本查看 复制代码
       
       
        NVIDIA显卡性能监控
       
       
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
                font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
            }
            
            :root {
                --primary: #76b900;
                --primary-dark: #5c8f00;
                --secondary: #0078d7;
                --dark-bg: #0d1117;
                --dark-card: #161b22;
                --dark-border: #30363d;
                --text-light: #f0f6fc;
                --text-gray: #8b949e;
                --danger: #f85149;
                --warning: #d29922;
                --success: #3fb950;
            }
            
            body {
                background: linear-gradient(135deg, #0a0e14, #0d1117);
                color: var(--text-light);
                min-height: 100vh;
                padding: 20px;
                overflow-x: hidden;
            }
            
            .container {
                max-width: 1400px;
                margin: 0 auto;
            }
            
            header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 20px 0;
                margin-bottom: 20px;
                border-bottom: 1px solid var(--dark-border);
            }
            
            .logo {
                display: flex;
                align-items: center;
                gap: 15px;
            }
            
            .logo-icon {
                width: 50px;
                height: 50px;
                background: linear-gradient(135deg, var(--primary), var(--primary-dark));
                border-radius: 8px;
                display: flex;
                align-items: center;
                justify-content: center;
                box-shadow: 0 4px 12px rgba(118, 185, 0, 0.3);
            }
            
            .logo-icon svg {
                width: 30px;
                height: 30px;
            }
            
            .logo-text {
                display: flex;
                flex-direction: column;
            }
            
            .logo-text h1 {
                font-size: 28px;
                font-weight: 700;
                background: linear-gradient(90deg, var(--text-light), var(--primary));
                -webkit-background-clip: text;
                background-clip: text;
                -webkit-text-fill-color: transparent;
            }
            
            .logo-text p {
                color: var(--text-gray);
                font-size: 14px;
            }
            
            .system-info {
                display: flex;
                gap: 30px;
                text-align: right;
                font-size: 14px;
            }
            
            .info-item {
                display: flex;
                flex-direction: column;
            }
            
            .info-label {
                color: var(--text-gray);
                margin-bottom: 5px;
            }
            
            .info-value {
                font-weight: 600;
                color: var(--primary);
            }
            
            .dashboard {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
                gap: 20px;
                margin-bottom: 30px;
            }
            
            .card {
                background: var(--dark-card);
                border-radius: 12px;
                padding: 20px;
                box-shadow: 0 8px 24px rgba(1, 4, 9, 0.5);
                border: 1px solid var(--dark-border);
                transition: all 0.3s ease;
            }
            
            .card:hover {
                transform: translateY(-5px);
                border-color: var(--primary);
                box-shadow: 0 12px 28px rgba(118, 185, 0, 0.2);
            }
            
            .card-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 20px;
                padding-bottom: 15px;
                border-bottom: 1px solid var(--dark-border);
            }
            
            .card-title {
                font-size: 18px;
                font-weight: 600;
                color: var(--text-light);
                display: flex;
                align-items: center;
                gap: 10px;
            }
            
            .card-title svg {
                width: 20px;
                height: 20px;
            }
            
            .card-content {
                height: 250px;
            }
            
            .stats-grid {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                gap: 15px;
            }
            
            .stat-item {
                background: rgba(22, 27, 34, 0.7);
                padding: 15px;
                border-radius: 8px;
                border-left: 3px solid var(--primary);
                transition: all 0.3s ease;
            }
            
            .stat-item:hover {
                background: rgba(118, 185, 0, 0.1);
                transform: translateX(5px);
            }
            
            .stat-label {
                font-size: 14px;
                color: var(--text-gray);
                margin-bottom: 8px;
                display: flex;
                align-items: center;
                gap: 5px;
            }
            
            .stat-value {
                font-size: 24px;
                font-weight: 700;
            }
            
            .gpu-util .stat-value {
                color: var(--primary);
            }
            
            .gpu-temp .stat-value {
                color: var(--danger);
            }
            
            .gpu-mem .stat-value {
                color: var(--secondary);
            }
            
            .gpu-power .stat-value {
                color: var(--warning);
            }
            
            .process-list {
                max-height: 300px;
                overflow-y: auto;
            }
            
            .process-header {
                display: grid;
                grid-template-columns: 40px 1fr 1fr 100px;
                padding: 10px 0;
                border-bottom: 1px solid var(--dark-border);
                font-weight: 600;
                color: var(--text-gray);
            }
            
            .process-item {
                display: grid;
                grid-template-columns: 40px 1fr 1fr 100px;
                padding: 12px 0;
                border-bottom: 1px solid rgba(48, 54, 61, 0.5);
                transition: background 0.2s ease;
            }
            
            .process-item:hover {
                background: rgba(118, 185, 0, 0.05);
            }
            
            .process-pid {
                color: var(--text-gray);
            }
            
            .process-name {
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
            
            .process-mem {
                color: var(--secondary);
                font-weight: 500;
            }
            
            .process-time {
                color: var(--text-gray);
                text-align: right;
            }
            
            .control-panel {
                display: flex;
                gap: 15px;
                margin-bottom: 20px;
            }
            
            .btn {
                padding: 10px 20px;
                background: var(--dark-card);
                border: 1px solid var(--dark-border);
                color: var(--text-light);
                border-radius: 6px;
                cursor: pointer;
                transition: all 0.2s ease;
                display: flex;
                align-items: center;
                gap: 8px;
                font-weight: 500;
            }
            
            .btn:hover {
                background: rgba(118, 185, 0, 0.1);
                border-color: var(--primary);
            }
            
            .btn-primary {
                background: var(--primary);
                border-color: var(--primary);
                color: #000;
                font-weight: 600;
            }
            
            .btn-primary:hover {
                background: var(--primary-dark);
            }
            
            .notification {
                padding: 15px;
                border-radius: 8px;
                margin-bottom: 20px;
                background: rgba(214, 153, 34, 0.1);
                border-left: 4px solid var(--warning);
                display: flex;
                gap: 12px;
            }
            
            .notification svg {
                min-width: 24px;
                height: 24px;
                color: var(--warning);
            }
            
            footer {
                text-align: center;
                padding: 30px 0 20px;
                color: var(--text-gray);
                font-size: 14px;
                border-top: 1px solid var(--dark-border);
                margin-top: 20px;
            }
            
            .gpu-status {
                display: inline-flex;
                align-items: center;
                gap: 8px;
                padding: 5px 12px;
                background: rgba(59, 185, 80, 0.1);
                border-radius: 20px;
                color: var(--success);
                font-weight: 500;
            }
            
            .status-indicator {
                width: 10px;
                height: 10px;
                background: var(--success);
                border-radius: 50%;
            }
            
            @media (max-width: 768px) {
                header {
                    flex-direction: column;
                    align-items: flex-start;
                    gap: 20px;
                }
                
                .system-info {
                    width: 100%;
                    justify-content: space-between;
                    text-align: left;
                }
                
                .dashboard {
                    grid-template-columns: 1fr;
                }
            }
       

       
            
                
                   
                        
                            
                            
                            
                            
                        
                   
                   
                        NVIDIA 显卡性能监控
                        实时监控显卡性能参数和系统状态
                   
                
                
                   
                        系统时间
                        --:--:--
                   
                   
                        运行时间
                        00:00:00
                   
                   
                        GPU 状态
                        
                            
                            运行中
                        
                   
                
            
            
            
                
                   
                
                
                    提示: 此工具为纯HTML实现,当前使用模拟数据。实际使用时需连接Python后端获取真实显卡数据。
                
            
            
            
                
                   
                        
                   
                    开始监控
                

                
                   
                        
                        
                   
                    刷新数据
                

                
                   
                        
                        
                   
                    导出数据
                

            
            
            
                
                   
                        
                            
                               
                            
                            GPU 使用率
                        
                   
                   
                
                
                
                   
                        
                            
                               
                            
                            温度与风扇
                        
                   
                   
                
                
                
                   
                        
                            
                               
                            
                            显存使用
                        
                   
                   
                
                
                
                   
                        
                            
                               
                            
                            功率消耗
                        
                   
                   
                
            
            
            
                
                   
                        性能指标概览
                   
                   
                        
                            
                               
                                    
                               
                                GPU 使用率
                            
                            0%
                        
                        
                        
                            
                               
                                    
                               
                                GPU 温度
                            
                            0°C
                        
                        
                        
                            
                               
                                    
                               
                                显存使用
                            
                            0/0 MB
                        
                        
                        
                            
                               
                                    
                               
                                功率消耗
                            
                            0 W
                        
                   
                
                
                
                   
                        
                            
                               
                               
                            
                            GPU 进程
                        
                   
                   
                        
                            PID
                            进程名称
                            类型
                            显存使用
                        
                        
                            
                        
                   
                
            
            
            
                NVIDIA 显卡性能监控工具 v1.0 | 纯HTML实现 | 设计:ECharts + JavaScript | 模拟数据
                实际使用时需连接Python后端获取真实显卡数据
            
       
       

    功能说明这个NVIDIA显卡性能监控工具具有以下功能:
  • 实时监控
  • GPU使用率(实时折线图)
  • 温度和风扇转速(双轴折线图)
  • 显存使用情况(已用/总量对比)
  • 功率消耗(实时折线图)
  • 性能概览
  • 关键指标卡片展示(使用率、温度、显存、功率)
  • GPU进程列表(PID、名称、类型、显存使用)
  • 操作控制
  • 开始/停止监控按钮
  • 手动刷新数据
  • 数据导出功能(模拟)
  • 视觉设计
  • NVIDIA主题配色(绿色为主)
  • 深色模式界面,减轻视觉疲劳
  • 卡片式布局,分区清晰
  • 响应式设计,适应不同屏幕尺寸
    使用说明
  • 将此HTML文件保存为.html格式
  • 直接在浏览器中打开即可运行
  • 点击"开始监控"按钮启动数据模拟
  • 点击"停止监控"暂停数据更新
  • 点击"刷新数据"手动获取最新数据
    技术实现
  • 使用ECharts实现高性能数据可视化
  • 纯JavaScript
  • CSS Grid和Flexbox实现响应式布局
  • NVIDIA品牌色系(绿色为主)的深色主题设计
    此工具为纯HTML实现,无需任何后端支持。在实际使用中,可以通过Python后端替换模拟数据,获取真实的NVIDIA显卡信息。
  • sktao   

    不知道强制提高功率对显卡会有什么样的变化。
    lvhongang   


    sktao 发表于 2025-6-6 10:27
    不知道强制提高功率对显卡会有什么样的变化。

    个人感觉限制功率只是为了电池续航,并没其他深层次意图。
    638   

    感谢楼主。。。。
    lvhongang   


    lvhongang 发表于 2025-6-6 10:38
    个人感觉限制功率只是为了电池续航,并没其他深层次意图。

    很多本子就有个特点:插上电源和拔掉电源性能不一样。
    qq309160   

    感谢分享
    zicheng5   

    让我看看
    hewenbiao7   

    任务管理器不直接都可以显示吗?
    您需要登录后才可以回帖 登录 | 立即注册