目录

前言

1、tlp 电源管理

(1)查看电池容量、使用量、为Thinkpad设定电池充电开始结束阈值

(2)查看硬盘比如NVME SSD的型号种类、当前温度、读写量等信息;

(3)查看CPU型号以及频率上下限、睿频的p-state占整个处理器允许的p-state的百分比;显卡、无线&蓝牙、USB等

2、dmidecode

(1)查看内存信息(例)

3、watch grep \'cpu MHz\' /proc/cpuinfo

4、sensors

5、s-tui

6、upower -d


前言

本文章有两个作用,在麒麟V10SP1操作系统下,一是介绍一些常见的系统CPU、内存、硬盘、风扇等硬件监控管理工具,二是读者可以获取硬件信息,精准地对硬件设备进行升级替代,比如购买同样内存时序的内存。

1、tlp 电源管理

tlp 主要用于为笔记本电脑节省电量,进行各种硬件的使用查看或配置。

TLP - Optimize Linux Laptop Battery Life — TLP 1.5 documentation

但它不还可以

(1)查看电池容量、使用量、为Thinkpad设定电池充电开始结束阈值

sudo tlp-stat -b
QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0
--- TLP 1.3.1 --------------------------------------------

+++ Battery Features: Charge Thresholds and Recalibrate
natacpi    = active (data, thresholds)
tpacpi-bat = active (recalibrate)
tp-smapi   = inactive (ThinkPad not supported)

+++ ThinkPad Battery Status: BAT0 (Main / Internal)
/sys/class/power_supply/BAT0/manufacturer                   = Celxpert
/sys/class/power_supply/BAT0/model_name                     = 5B10W13954
/sys/class/power_supply/BAT0/cycle_count                    =      3
/sys/class/power_supply/BAT0/energy_full_design             =  51000 [mWh]
/sys/class/power_supply/BAT0/energy_full                    =  49480 [mWh]
/sys/class/power_supply/BAT0/energy_now                     =  49480 [mWh]
/sys/class/power_supply/BAT0/power_now                      =      0 [mW]
/sys/class/power_supply/BAT0/status                         = Full

/sys/class/power_supply/BAT0/charge_start_threshold         =     96 [%]
/sys/class/power_supply/BAT0/charge_stop_threshold          =    100 [%]
tpacpi-bat.BAT0.forceDischarge                              =      0

Charge                                                      =  100.0 [%]
Capacity                                                    =   97.0 [%]
 

(2)查看硬盘比如NVME SSD的型号种类、当前温度、读写量等信息;

sudo tlp-stat -d
QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0
--- TLP 1.3.1 --------------------------------------------

+++ Storage Devices
Devices = nvme0n1 sda

/dev/nvme0n1:
  Type      = NVMe
  Model     = WDC PC SN730 SDBQNTY-256G-1001          
  Firmware  = 11170101
  Scheduler = [none] mq-deadline bfq (multi queue)

  Runtime PM: control = auto, autosuspend_delay_ms = (not available)

  SMART info:
    Critical Warning:                   0x00
    Temperature:                        51 Celsius
    Available Spare:                    100%
    Available Spare Threshold:          10%
    Percentage Used:                    0%
    Data Units Written:                 528,481 [270 GB]
    Power Cycles:                       76
    Power On Hours:                     37
    Unsafe Shutdowns:                   18
    Media and Data Integrity Errors:    0

/dev/sda: not present.

+++ AHCI Link Power Management (ALPM)
No AHCI-enabled host controller detected.
 

(3)查看CPU型号以及频率上下限、睿频的p-state占整个处理器允许的p-state的百分比;显卡、无线&蓝牙、USB等

sudo tlp-stat -p
QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0
--- TLP 1.3.1 --------------------------------------------

+++ Processor
CPU model      = Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  4900000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference = balance_performance [HWP.EPP]
/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power 
 

2、dmidecode

dmidecode, 使用该命令可以查询BIOS、系统、主板、处理器、内存、缓存等非常重要信息。下面是其常用的几个命令:

# dmidecode | grep 'Product Name'                           // 查看服务器型号
# dmidecode | grep 'Serial Number'                         // 查看主板的序列号
# dmidecode -s system-serial-number                        // 查看系统序列号
# dmidecode -t memory                                          // 查看内存信息
# dmidecode -t 11                                               // 查看OEM信息
# dmidecode | grep "Maximum Capacity" |sed  "s/^[ \t]*//"                     // 最大支持内存容量:
 

(1)查看内存信息(例)

sudo dmidecode -t memory
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.

Handle 0x0002, DMI type 16, 23 bytes
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: None
    Maximum Capacity: 32 GB
    Error Information Handle: Not Provided
    Number Of Devices: 2

Handle 0x0003, DMI type 17, 84 bytes
Memory Device
    Array Handle: 0x0002
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 8192 MB
    Form Factor: SODIMM
    Set: None
    Locator: ChannelA-DIMM0
    Bank Locator: BANK 0
    Type: DDR4
    Type Detail: Synchronous
    Speed: 3200 MT/s
    Manufacturer: Micron
    Serial Number: 00000000
    Asset Tag: None
    Part Number: 4ATF1G64HZ-3G2E1    (信息baidu为镁光8G内存条)
    Rank: 1
    Configured Memory Speed: 2667 MT/s
    Minimum Voltage: Unknown
    Maximum Voltage: Unknown
    Configured Voltage: 1.2 V
    Memory Technology: DRAM
    Memory Operating Mode Capability: Volatile memory
    Firmware Version: Not Specified
    Module Manufacturer ID: Bank 1, Hex 0x2C
    Module Product ID: Unknown
    Memory Subsystem Controller Manufacturer ID: Unknown
    Memory Subsystem Controller Product ID: Unknown
    Non-Volatile Size: None
    Volatile Size: 8 GB
    Cache Size: None
    Logical Size: None

Handle 0x0004, DMI type 17, 84 bytes
Memory Device
    Array Handle: 0x0002
    Error Information Handle: Not Provided
    Total Width: Unknown
 

3、watch grep \'cpu MHz\' /proc/cpuinfo

查看当前cpu各线程主频

Every 2.0s: grep 'cpu MHz' /proc/cpuinfo       akCDB-thinkpadt14gen1: Wed May 10 15:56:02 2023

cpu MHz         : 3400.034
cpu MHz         : 3400.022
cpu MHz         : 3400.010
cpu MHz         : 3400.024
cpu MHz         : 3400.022
cpu MHz         : 3400.041
cpu MHz         : 3400.133
cpu MHz         : 3399.995


4、sensors

查看传感器状态,温度、风扇等

$ sensors
ucsi_source_psy_USBC000:002-isa-0000
Adapter: ISA adapter
in0:           5.00 V  (min =  +5.00 V, max = +20.00 V)
curr1:         3.00 A  (max =  +3.25 A)

iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:        +55.0°C  

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        3380 RPM
temp1:        +63.0°C  
temp2:            N/A  
temp3:        +40.0°C  
temp4:         +0.0°C  
temp5:        +63.0°C  
temp6:        +63.0°C  
temp7:        +63.0°C  
temp8:            N/A  

BAT0-acpi-0
Adapter: ACPI interface
in0:          13.07 V  

ucsi_source_psy_USBC000:001-isa-0000
Adapter: ISA adapter
in0:           0.00 V  (min =  +0.00 V, max =  +0.00 V)
curr1:         0.00 A  (max =  +0.00 A)

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +61.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +59.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:        +61.0°C  (high = +100.0°C, crit = +100.0°C)
Core 2:        +60.0°C  (high = +100.0°C, crit = +100.0°C)
Core 3:        +61.0°C  (high = +100.0°C, crit = +100.0°C)

pch_cannonlake-virtual-0
Adapter: Virtual device
temp1:        +63.0°C  

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +63.0°C  (crit = +128.0°C)
 

5、s-tui

sudo s-tui

在terminal内以图形方式,查看系统cpu温度、主频、利用率、功率、风扇转速等的状态

  

6、upower -d

查看电池信息

upower -d
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              2023年05月10日 星期三 13时41分10秒 (8309 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              yes
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               Celxpert
  model:                5B10W13954
  serial:               1462
  power supply:         yes
  updated:              2023年05月10日 星期三 15时59分37秒 (2 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    warning-level:       none
    energy:              49.48 Wh
    energy-empty:        0 Wh
    energy-full:         49.48 Wh
    energy-full-design:  51 Wh
    energy-rate:         0 W
    voltage:             13.068 V
    percentage:          100%
    capacity:            97.0196%
    technology:          lithium-polymer
    icon-name:          'battery-full-charged-symbolic'

Device: /org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o001
  native-path:          ucsi-source-psy-USBC000:001
  power supply:         yes
  updated:              2023年05月10日 星期三 13时41分10秒 (8309 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              no
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o002
  native-path:          ucsi-source-psy-USBC000:002
  power supply:         yes
  updated:              2023年05月10日 星期三 13时41分10秒 (8309 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              yes
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              2023年05月10日 星期三 08时52分56秒 (25603 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               fully-charged
    warning-level:       none
    energy:              49.48 Wh
    energy-full:         49.48 Wh
    energy-rate:         0 W
    percentage:          100%
    icon-name:          'battery-full-charged-symbolic'

Daemon:
  daemon-version:  0.99.11
  on-battery:      no
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: PowerOff

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐