You are not logged in.
I can read the CPU's MSR like that
# rdmsr -0 0x198
061b4c2686004b26This is the only way I can do it on my laptop.
This reads register 0x198 from the first CPU. The current voltage ID (VID) is in hexadecimal the last 2 digits and might fluctuate with the core clock if Speedstep is enabled.
In my case it is 26, or 38 in decimal. On a mobile Core2Duo, the formula is 0.7125V + VID*0.0125V. In my case that corresponds to 1.1875V. (keep in mind that VID is in hex, and desktop CPUs use another formula, too).
Now, how can I feed this value translated into Volts into conky display?
Last edited by Lockheed (2012-03-05 08:45:33)
Offline
You can use conky's exec variable and some fancy sed, awk magic to translate the values to something readable. If you can code C, you can add this functionality to the conky code and add a patch for yourself.
Offline
You can use conky's exec variable and some fancy sed, awk magic to translate the values to something readable.
Yes, the forula for this magic is what I am asking about.
Offline
I don't have conky or rdmsr, but this should be able to get you going, although it looks relatively ugly to me:
$ echo 061b4c2686004b26 | awk '{split(substr($1,length($1)-1),s,"") ; print 0.7125+(s[1]*16+s[2])*0.0125}'
1.1875Edited: oops I forgot hex contains a-f, will fix the code.
Edited 2: this should work
echo 061b4c2686004b26 | awk --non-decimal-data '{s="0x" substr($1,length($1)-1) ; print 0.7125+s*0.0125}'
1.1875Last edited by livibetter (2012-03-05 09:23:01)
Offline
Ok, but 061b4c2686004b26 is a dynamic number and is supposed to change on the fly, that's why I'd like the code to call rdmsr each time it takes a read.
Offline
The conky homepage has all the details on how to make this happen.
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Ok, but 061b4c2686004b26 is a dynamic number and is supposed to change on the fly, that's why I'd like the code to call rdmsr each time it takes a read.
Aww.. I was thinking you understood, just replace echo part with that rdmsr command. IIRC, the conky code should look like:
${execi 60 rdmsr -0 0x198 | awk --non-decimal-data '{s="0x" substr($1,length($1)-1) ; print 0.7125+s*0.0125}'}Offline
Thanks, livibetter. You are great help. However, the problem is rdmsr requires sudo to be able to access msr table.
Offline
You can make a cronjob that read this value every 2 seconds as root and put the output in some /tmp file that you can read as a normal user.
Or you can add yourself to the wheel group, make wheel group sufficient for su (so you can su without a pw) and run it with su - ... to execute the command as root
Offline
I got that line into conky config, but it displays nothing at all:
${execi 60 ${exec cat /tmp/voltage} | awk --non-decimal-data '{s="0x" substr($1,length($1)-1) ; print 0.7125+s*0.0125}'}Last edited by Lockheed (2012-03-05 11:15:54)
Offline
I got that line into conky config, but it displays nothing at all:
${execi 60 ${exec cat /tmp/voltage} | awk --non-decimal-data '{s="0x" substr($1,length($1)-1) ; print 0.7125+s*0.0125}'}
It should be:
${execi 60 cat /tmp/voltage | awk --non-decimal-data '{s="0x" substr($1,length($1)-1) ; print 0.7125+s*0.0125}'}Last edited by livibetter (2012-03-05 14:25:46)
Offline
Actually, I found the ideal solution to be
#!/bin/bash
while true
do
rdmsr -0 0x198 | awk --non-decimal-data '{s="0x" substr($1,length($1)-1) ; print 0.7125+s*0.0125}' > /tmp/voltage
sleep 2
doneand then call it from rc.local at boot, adding 'cat /tmp/voltage' to conky.
Offline