# cpu-temp
An Intel CPU temperature monitoring library for Windows and Linux.
## Features
- Read real-time CPU core temperatures
- Read CPU package temperature
- Support for Intel CPUs
- Multi-core temperature monitoring with physical core mapping
- Cross-platform support (Windows & Linux)
## Platform Details
### Windows
Uses MSR (Model Specific Register) access via the PawnIO driver for low-level temperature reading.
### Linux
Uses the Linux hwmon subsystem (`/sys/class/hwmon`) for temperature readings. No special drivers required.
## Requirements
### Windows
- [PawnIO driver](https://github.com/pawnlib/PawnIO) must be installed for MSR access
- Run as administrator
### Linux
- Root access or appropriate permissions to read `/sys/class/hwmon` files
## Installation
Add this to your `Cargo.toml`:
```toml
[dependencies]
cpu-temp = "0.1"
```
## Usage
```rust
use cpu_temp::cpu::intel::IntelCpuTemperature;
// Create temperature monitor
let mut temp_monitor = IntelCpuTemperature::new()?;
// Read temperatures
let data = temp_monitor.get_temperatures(&mut msr)?;
println!("TjMax: {}°C", data.tj_max);
for core in &data.core_temps {
println!(
"Core {} (logical {}): {:.1}°C",
core.physical_id,
core.logical_id,
core.core_temp.temperature
);
}
```
## CLI Tool
To build the CLI temperature monitoring tool:
```bash
cargo build --release --features cli
```
## License
MIT License - see LICENSE file for details.