Crates.io | hw |
lib.rs | hw |
version | 0.1.4 |
source | src |
created_at | 2024-12-06 13:59:06.246822 |
updated_at | 2024-12-11 16:27:46.059669 |
description | 强大而统一的跨平台硬件监控工具 |
homepage | https://gitee.com/eternalnight996 |
repository | |
max_upload_size | |
id | 1474275 |
size | 282,352 |
Powerful and Unified Cross-Platform Hardware Monitoring Tool
English | 简体中文
cargo install hw
git clone https://github.com/eternalnight996/hw.git
cd hw
cargo install just
just
Command Differences:
10
: Number of tests2000
: Target value3000
: Error range (-1000~5000)100
: CPU load percentage[dependencies]
# All features
hw = {version="0.1"}
# Package all features
hw = {version="0.1",feature=["build","built"]}
# OHM only
hw = {version="0.1", default-features = false, feature=["ohm"]}
# Add cli for command line
# Log supports log and tracing, cli defaults to println output
hw = {version="0.1", default-features = false, feature=["ohm","cli","log"]}
CPU Clock Monitoring Example
hw --api OS --task data --args CPU Clock
Compiling hw v0.1.2 (D:\MyApp\hw)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.18s
Running `target\x86_64-pc-windows-msvc\debug\hw.exe --api OHM --task data --args CPU Clock`
Started OpenHardwareMonitor.exe with PID: 5332
Loading... (100%/100%)
...
--------------------------------
Average(1068MHz 0.0%) Data:1068
Close Load
=== Summary -> CPU Central Processing Unit ===
--- Sensor -> Clock Frequency MHz ---
Result: PASS
Data: 1068
Target: 0.0 MHz
Average: 1068.0 MHz
Minimum: 901.2 MHz
Maximum: 1101.5 MHz
Count: 1
Error Count: 0
Load: 0.0%
Average Load: 0.0%
Allowed Error: ±0.0
Allowed Range: 0.0 ~ 0.0 MHz
====================
R<{"content":"1068","status":true,"opts":null}>R
hw --api OHM --task print --full --args CPU Clock
...
R<{"content":"{\"api\":\"OHM\",\"hw_type\":\"CPU\",\"sensor_type\":\"Clock\",\"res\":\"PASS\",\"data\":\"1102\",\"min\":1101.5174560546875,\"max\":1101.5174560546875,\"avg\":1102.0,\"total\":6609.104736328125,\"samples\":6,\"test_secs\":0,\"error_count\":0,\"load\":{\"min\":0.0,\"max\":0.0,\"avg\":0.0,\"total\":0.0,\"status\":[]},\"status\":[...]}","status":true,"opts":null}>R
hw --api OHM --task check --full --args CPU Clock -- 10 2000 3000 100
...
--- CPU Status at Second 10 ---
CPU Core #1 - Current=2904.0 MHz(Frequency) Error: ±3000.0
CPU Core #6 - Current=2904.0 MHz(Frequency) Error: ±3000.0
CPU Core #5 - Current=2904.0 MHz(Frequency) Error: ±3000.0
CPU Core #4 - Current=2904.0 MHz(Frequency) Error: ±3000.0
CPU Core #3 - Current=2904.0 MHz(Frequency) Error: ±3000.0
CPU Core #2 - Current=2904.0 MHz(Frequency) Error: ±3000.0
--------------------------------
Average(2904MHz 99.0%) Data:2904
Close Load
=== Summary -> CPU Central Processing Unit ===
--- Sensor -> Clock Frequency MHz ---
Result: PASS
Data: 2904
Target: 2000.0 MHz
Average: 2904.0 MHz
Minimum: 2904.0 MHz
Maximum: 2904.0 MHz
Count: 10
Error Count: 0
Load: 100.0%
Average Load: 99.0%
Allowed Error: ±3000.0
Allowed Range: -1000.0 ~ 5000.0 MHz
====================
R<{"content":"{\"api\":\"OHM\",\"hw_type\":\"CPU\",\"sensor_type\":\"Clock\",\"res\":\"PASS\",\"data\":\"2904\",\"min\":2904.000732421875,\"max\":2904.001708984375,\"avg\":2904.0,\"total\":174240.07470703125,\"samples\":60,\"test_secs\":0,\"error_count\":0,\"load\":{\"min\":0.0,\"max\":0.0,\"avg\":99.0,\"total\":5946.0,\"status\":[]},\"status\":[...]}","status":true,"opts":null}>R
# CPU Temperature Monitoring
hw --api OHM --task check --args CPU Temperature
# CPU Frequency Test (5 times, target 3000MHz, error ±2000MHz, 100% load)
hw --api OHM --task check --args CPU Clock -- 5 3000 2000 100
# Fan Speed Test (5 times, target 3000RPM, error ±2000RPM)
hw --api OHM --task check --args ALL Fan -- 5 3000 2000
# Overall System Status
hw --api OS --task print
# CPU Load Monitoring
hw --api OS --task check --args CPU Load
# Memory Usage Monitoring
hw --api AIDA64 --task check --args RAM Load
# CPU Core Voltage Monitoring
hw --api AIDA64 --task check --args CPU Voltage
# Get Complete System Information
hw --api OSMore --task OsFullVersion
# Get Memory Size
hw --api OSMore --task MemoryTotal
# Get Office Version
hw --api OSOffice --task check-with-cache --args V2016 test
# Activate System
hw --api OSSystem --task active --args XXXXX-XXXXX-XXXXX-XXXXX-XXXXX activation_temp
# Check System Activation Status and Query Activation Code Cache
hw --api OSSystem --task check-with-cache --args activation_temp
# Export DLL|SO Dynamic Library
hw --api FileInfo --task copy-lib --args target/debug/hw.exe target/debug/_libs
# Print File Nodes
hw --api FileInfo --task print --args target/debug/hw.exe
# Print File Nodes
hw --api FileInfo --task nodes --args target/debug/hw.exe
# Test PING
hw --api NetManage --task ping --args 127.0.0.1 baidu.com 3
# Test PING Nodes
hw --api NetManage --task ping-nodes --args baidu.com 3
# Set DHCP ~is_connected means the currently connected network card
hw --api OSMore --task NetManage --args dhcp -- ~is_connected
# Set Static IP
hw --api OSMore --task NetManage --args set-ip "Ethernet" 192.168.1.100 255.255.255.0 192.168.1.1
# Set DNS
hw --api OSMore --task NetManage --args set-dns "Ethernet" 223.5.5.5 114.114.114.114
# Desktop Nodes
hw --api OSMore --task Desktop --args nodes
# Print
hw --api OSMore --task Desktop --args print
# Scan Drives
hw --api Drive --task scan
# Print Drive
hw --api Drive --task print -- =net "*I225-V #6"
hw --api Drive --task print -- "@pci*" "*I225-V #6"
hw --api Drive --task print -- "@pci*" "PCI*" "*E0276CFFFFEEA86B00"
# --full Complete data but more resource consuming, recommended to use = and @ for filtering
hw --api Drive --task print --full -- =net "*I225-V #6"
{
"id": "PCI\\VEN_8086&DEV_15F3&SUBSYS_00008086&REV_03\\E0276CFFFFEEA86B00",
"drive_node": "1:",
"name": "Intel(R) Ethernet Controller (3) I225-V #6",
"inf_file": "c:\\drivers\\lan.intel\\pro2500\\e2f68.inf",
"inf_section": "E15F3_3.10.0.1..17763",
"driver_descript": "Intel(R) Ethernet Controller (3) I225-V #6",
"manufacturer_name": "Intel",
"provider_name": "Intel",
"driver_date": "2021/1/6",
"driver_version": "1.0.2.13",
"driver_node_rank": "16719872",
"driver_node_flags": "00003044",
"signed": false
}
# Drive Nodes
hw --api Drive --task nodes -- =net
# Export Drive
hw --api Drive --task export --args oem6.inf D:\\drives
hw --api Drive --task export --args oem*.inf .
# Restart Drive
hw --api Drive --task restart -- =net "Intel(R) Ethernet Controller (3) I225-V #5"
hw --api Drive --task restart -- "@PCI\VEN_8086&DEV_15F3&SUBSYS_00008086&REV_03\E0276CFFFFEEA86A00"
# Enable Drive
hw --api Drive --task enable -- =net "Intel(R) Ethernet Controller (3) I225-V #5"
# Disable Drive
hw --api Drive --task disable -- "@PCI\VEN_8086&DEV_15F3&SUBSYS_00008086&REV_03\E0276CFFFFEEA86A00"
# Delete Drive
hw --api Drive --task delete -- "@PCI\VEN_8086&DEV_15F3&SUBSYS_00008086&REV_03\E0276CFFFFEEA86A00"
# Add Drive
hw --api Drive --task add --args D:\\drives\\oem6.inf /install
# Add Drive Folder
hw --api Drive --task add-folder --args D:\\drives /install
# Sync Time
hw --api OSMore --task NetManage --args sync-datetime time.windows.com
# "~Less100" Speed less than 100
# "~100" Speed greater than or equal to 100
# "~1000" Speed greater than or equal to 1000
# "~Big1000" Speed greater than or equal to 10000
# "~is_connected" Currently connected
# "~has_dhcp_ip" Has DHCP IP
# Check MAC Duplication and Initialize
hw --api OSMore --task NetInterface --args check-mac "*I225-V #1" -- ~has_dhcp_ip
# Network Interface
hw --api OSMore --task NetInterface --args print -- ~has_dhcp_ip
# Network Interface Nodes
hw --api OSMore --task NetInterface --args nodes -- ~has_dhcp_ip
Backend | Windows | Linux | MacOS | Status | Description | Supported Features |
---|---|---|---|---|---|---|
OHM |
✓100% |
-0% |
-0% |
✓Completed |
Get hardware sensor data All features completed |
HardwareType,SensorType |
AIDA64 |
✓100% |
-0% |
-0% |
✓Completed |
Get hardware sensor data All features completed |
HardwareType,SensorType |
OS |
⚡10% |
⚡10% |
⚡10% |
🔄Testing |
Interface Rust system cross-platform basic functions available Support for more information retrieval |
CPU,RAM |
OSMore |
⚡70% |
⚡70% |
⚡70% |
✓Completed |
Mainly used for getting more information and management | MemoryTotal,CpuCoreCount,OsVersion OsFullVersion,KernelVersion,HostName,Uptime CpuUsage,MemoryUsage,CpuArch,UserNames, NetInterface,NetManage[Network Management(DHCP,PING,Sync Time,Static IP Configuration)],Desktop,Drive, |
Drive |
✓100% |
⚡0% |
⚡0% |
✓Completed |
Interface with PNPUTIL and devcon | scan,add-folder,add,delete,delete-find, print,nodes,restart,enable,disable,remove,export |
FileInfo |
✓100% |
⚡99% |
⚡99% |
✓Completed |
Get file dependencies dll or so, support one-click export dependencies | copy-lib,print,nodes |
OSSystem |
✓100% |
-0% |
-0% |
✓Completed |
System | check,check-with-cache,activate,deactivate,kms,clear-kms,clear-cache,cache-kms |
OSOffice |
✓90% |
-0% |
-0% |
✓Completed |
Office | check,check-with-cache,activate,kms,clear-kms,clear-cache,cache-kms |
Note:
- OpenHardwareMonitor (OHM) and AIDA64 only support Windows platform
- sysinfo supports cross-platform but has limited functionality
- Specific sensor support may vary by hardware
Sensor Type | Unit | Format | Description |
---|---|---|---|
Clock | MHz | {value} MHz | Processor, memory clock frequency |
Temperature | °C | {value} °C | CPU, GPU, motherboard temperature |
Load | % | {value}% | Processor load, memory usage |
Fan | RPM | {value} RPM | Fan speed |
Voltage | V | {value} V | Various voltage values |
Power | W | {value} W | Power consumption |
Flow | L/h | {value} L/h | Liquid cooling flow rate |
Control | % | {value}% | Fan control level |
Level | % | {value}% | Battery level |
Data | B | {value} B | Data size |
GBData | GB | {value} GB | Large capacity data |
Throughput | B/s | {value} B/s | Data throughput |
DataRate | B/s | {value} B/s | Data transfer rate |
SmallData | B | {value} B | Small data |
GBSmallData | GB | {value} GB | Large capacity small data packets |
FSB | MHz | {value} MHz | Front Side Bus frequency |
Multiplexer | MHz | {value} MHz | Multiplier |
ClockAverage | MHz | {value} MHz | Average clock frequency |
Hardware Type | Description | Common Sensors |
---|---|---|
CPU | Central Processing Unit | Clock, Temperature, Load, Power |
RAM | Memory | Data, Load, Clock |
Mainboard | Motherboard | Temperature, Voltage, Fan |
GpuNvidia | NVIDIA Graphics Card | Clock, Temperature, Load, Fan |
GpuAti | AMD/ATI Graphics Card | Clock, Temperature, Load, Fan |
HDD | Hard Disk Drive | Temperature, Load, Data |
SuperIO | Super I/O Chip | Fan, Temperature, Voltage |
TBalancer | T-Balancer Device | Fan, Flow, Temperature |
Heatmaster | Heatmaster Device | Fan, Flow, Temperature |
When using OHM or AIDA64 interface, the program first checks if the process exists;
If not, it checks if OpenHardwareMonitor.exe
or aida64.exe
exists in the current directory
AUTOTEST2.exe
In the field of hardware monitoring, we often face these challenges:
This tool aims to solve these problems by providing:
Hardware Testing
System Monitoring
Development Debugging
Automation Integration
💡 Design Philosophy:
- Simplicity first
- Unified interface standards
- Cross-platform compatibility
- Extensible architecture
We welcome any form of contribution!
Before submitting a PR, please ensure:
This project is dual-licensed under MIT and Apache 2.0.