You are browsing as a guest. Sign up (or log in) to start making projects!

2h 9m 14s logged

f*ck microsoft

After MANY hours of research and wanting to launch this project into orbit WAY too many times, I’ve finally managed to query almost all of the missing and/or incorrect data in windows (CPU frequency and temp and all GPU stuff) except fan speeds i just dont care enough anymore to implement that too (why later).


Why this is SO complicated

In contrast to linux (which has hwmon), windows has no standardized way of getting proper sensor data reliably. CPU temp (accessible via WMI) is often not properly exposed by the manufacturer causing it to return either zero or garbage. CPU frequency is exposed, but it kinda lags behind and is measured/calculated badly. GPU stuff is basically not exposed at all, expect via their half-working API called “D3DKMTHK” (no i did not smash my keyboard) over which you can pretty reliably get GPU temp and memory frequency, but usage and fan speed not so much. For that, I used NVAPI (NVIDIA’s GPU query API).
 

What? AMD and Intel GPUs don’t work with NVAPI?
i know and i will not fix it, i don’t have the energy or time for that (i’m sorry). you’re welcome to give me a PR tho

 
For the CPU stuff (frequency and temperatue) I used PawnIO, a kernel driver that can be scripted to do a lot of things. I use premade “AMX Modules” which basically are such scripts to get these CPU metrics.
The AMX modules in use are:

  • IntelMSR
  • AMDFamily17
  • RyzenSMU

(you can find these here)


The Final Solution

A C++ shim which takes the data from PawnIO, NVAPI, “D3DKMTHK” and all the others and hands it to the java app via stdout. The java process runs the .exe everytime it needs the values, parses the returned json and saves the values.


What were u talking about fan speeds too difficult again?

You see, I could just do the same as with the CPU stuff (AMX modules). The problem is, the module LpcIO which exposes the EC (embedded controller) only exposes a direct path to it, meaning I’d have to implement and parse everything myself. The huge problem with this is: on laptops the EC is vendor-specific and undocumented, and on desktop, there are ~71 supported chips that require different implementations, which is probably the biggest waste of time, so I’ve decided to just skip fan speeds entirely.

0
6

Comments 0

No comments yet. Be the first!