Get cpu temps from terminal using Cygwin?

1

I am using Cygwin 64 on Windows 8 and would like to use the bash interface to get cpu temperatures (4 cores, as well as gpu temps). Is this possible? I am using the temperature monitor application and have that interfacing through Rainmaker but I would like to have them print out into a text file at intervals of my selection as I want to benchtest some of my code and see how it heats up the computer.

Any ideas?

drjrm3

Posted 2013-08-14T00:11:45.247

Reputation: 1 164

What temperature monitor application are you using? – VL-80 – 2013-08-14T00:58:16.947

Speedfan. Sorry, on my old computer it was literally called 'Temperature Monitor'! – drjrm3 – 2013-08-14T12:34:56.607

Alright. Check out my answer. – VL-80 – 2013-08-16T00:50:31.453

looks decent - haven't had the time to try it out yet but when I do I will let you know how it works and list it as the answer when I confirm it. Thanks. – drjrm3 – 2013-08-16T19:52:03.317

Answers

1

Speed Fan has logging option. Enable it in configuration. You will find log files in the directory where Speed Fan was installed. In my case it was Program Files\SpeedFan\SFLog(date).csv

I installed UnixTools for Windows. If I understand correctly Cygwin has same sort of capabilities as UnixTools and gives you possibility to use Unix-like commands in Windows.

So, now we have log file (which updates once in 3 seconds) with all the data we want. We can use it to obtain last values from SpeedFan with following script:

for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c%%a%%b)

tail -n 1 "C:\Program Files\SpeedFan\SFLog%mydate%.csv" | gawk {print$2}

First, we set variable mydate as current date formatted in style of Speed Fan log. We will need it to find latest logfile.

After that we use command tail with option -n 1 to get last row of the file (most recent data).

And we supply this row to the gawk command with option {print$2} to get second 'column' of the row, since first 'column' is timestamp.

So script will echo most recent value of the second column of the logfile. If you need more than just one value - make another script which requests third column by giving option {print$3} to gawk.

Let's say SpeedFan's log file has following format:

Timestamp  CPU1_temp  CPU2_temp  MotherBoard_temp  CPUFan_RPM

You can have 4 scripts - each one will be getting one of the values (use gawk's {print$X} option to determine which column it will be reading).

Now you can call these scripts from another programs when they need temperature readings from SpeedFan.

VL-80

Posted 2013-08-14T00:11:45.247

Reputation: 3 867

my log file only prints the times. There is a note on the 'log' tab which says "remember to select what readings you want to log" - where do I select these readings? – drjrm3 – 2013-08-16T20:41:06.387

1Go to temperatures tab (first one). You will see list of sensors. Click one and at the bottom of the window you will see checkbox "Logged". Check it if you want data from this sensors to be logged. Same thing with Fans, Voltages, etc – VL-80 – 2013-08-16T21:08:22.640