It is currently March 28th, 2024, 6:12 pm

How to show cpu current core speed?

Get help with creating, editing & fixing problems with skins
swiftord
Posts: 4
Joined: August 13th, 2019, 6:45 am

How to show cpu current core speed?

Post by swiftord »

How to show cpu current core speed?

This is the code i use:

Code: Select all

[MeasureCPUSpeed]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=HARDWARE\DESCRIPTION\System\CentralProcessor\0
RegValue=~MHz
UpdateDivider=-1
but it can't change the value according to the current speed
please help me to fix it
(Sorry, my english isn't good)
Last edited by balala on August 13th, 2019, 6:59 am, edited 1 time in total.
Reason: Please use <code> tags whenever are zou posting code snippets. It!s the </> button.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to show cpu current core speed?

Post by balala »

swiftord wrote: August 13th, 2019, 6:50 am but it can't change the value according to the current speed
please help me to fix it
Yes, there probably are more possibilities. One works if you're using the CoreTemp application and the related CoreTemp plugin:

Code: Select all

[MeasureCore1Speed]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=CoreSpeed
CoreTempIndex=0
Group=CoreTemp1
RegExpSubstitute=1
Substitute="^(.*)[^k]$":"\1 M","^(.*)k$":"\1 G"

[MeterSpeed]
Meter=STRING
MeasureName=MeasureCore1Speed
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1Hz
AutoScale=2
DynamicVariables=1
The [MeasureCore1Speed] measure returns the speed of the first core. You have to add similar measures to each core of your CPU and have to include them into the string meter to show them up as well.
Disadvantage: this method works only if CoreTemp is installed and runs in background.
swiftord
Posts: 4
Joined: August 13th, 2019, 6:45 am

Re: How to show cpu current core speed?

Post by swiftord »

balala wrote: August 13th, 2019, 7:11 am Yes, there probably are more possibilities. One works if you're using the CoreTemp application and the related CoreTemp plugin:

Code: Select all

[MeasureCore1Speed]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=CoreSpeed
CoreTempIndex=0
Group=CoreTemp1
RegExpSubstitute=1
Substitute="^(.*)[^k]$":"\1 M","^(.*)k$":"\1 G"

[MeterSpeed]
Meter=STRING
MeasureName=MeasureCore1Speed
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1Hz
AutoScale=2
DynamicVariables=1
The [MeasureCore1Speed] measure returns the speed of the first core. You have to add similar measures to each core of your CPU and have to include them into the string meter to show them up as well.
Disadvantage: this method works only if CoreTemp is installed and runs in background.
I am using this skin: https://www.deviantart.com/chroneco/art/Nisekoi-Rainmeter-Skin-437221174
This skin will show my cpu usage, i am trying to rewrite its file to change the CPU usage to the CPU core speed.
Can I use your code in this file?

This is the code in its file:

Code: Select all

[Rainmeter]
Update=350

[Variables]
;Bar setting
label = CPU
font_family = Segoe UI
font_size = 20
font_color_label = 255,255,255,255
font_color_text = 20,20,20,255

;Specify thresholds
low = 35
med = 70
high = 100

;Meter variables
size = 200

plate_margin = 60

text_margin_top = 0
text_margin_side = 6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Measures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;CPU
[CPUState]
Measure=CPU
Processor=0
UpdateDivider=3

[CPUCalc]
Measure = Calc
Formula = round([CPUState],0)
DynamicVariables = 1

;Face
[FrameCalc]
Measure=Calc
Formula=(Counter%2)+1

[HeadCalc]
Measure=Calc
Formula=([CPUCalc]<#high# ? 1:2)
Substitute="1":"head1","2":"head2"
DynamicVariables=1

[FaceCalc]
Measure=Calc
Formula=([CPUCalc]<#low#? 11:([CPUCalc]<#med#? 22:33))
DynamicVariables=1
Substitute="11":"hap[FrameCalc]","22":"neu[FrameCalc]", "33":"ang[FrameCalc]"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Meters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;Character
[MeterHead]
Meter=Image
ImageName=[HeadCalc]
W=#size#
X=5
Y=110
DynamicVariables=1

[MeterFace]
Meter=Image
ImageName=[FaceCalc].png
W=#size#
X=5
Y=110
DynamicVariables=1

;Bar
[MeterPlate]
Meter = Image
ImageName = plate.png
W = #size#
Y = (#size#+#plate_margin#)

[MeterLabel]
Meter = String
Text = #label#
FontFace = #font_family#
FontSize = #font_size#
FontColor = #font_color_label#
StringAlign = Left
AntiAlias = 1
X = #text_margin_side#
Y = (#size# + #text_margin_top# + #plate_margin#)

[MeterState]
Meter = String
Text = [CPUCalc]%
FontFace = #font_family#
FontSize = #font_size#
FontColor = #font_color_text#
StringAlign = Right
AntiAlias = 1
X = (#size# - #text_margin_side#)
Y = (#size# + #text_margin_top# + #plate_margin#)
DynamicVariables=1
Last edited by balala on August 13th, 2019, 11:48 am, edited 1 time in total.
Reason: Please use <code> tags whenever are zou posting code snippets. It!s the </> button.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to show cpu current core speed?

Post by balala »

swiftord wrote: August 13th, 2019, 7:55 am I am using this skin: https://www.deviantart.com/chroneco/art/Nisekoi-Rainmeter-Skin-437221174
This skin will show my cpu usage, i am trying to rewrite its file to change the CPU usage to the CPU core speed.
Can I use your code in this file?
Yes, you can, IF you are using the Core Temp program. Are you? Is it installed?
swiftord
Posts: 4
Joined: August 13th, 2019, 6:45 am

Re: How to show cpu current core speed?

Post by swiftord »

balala wrote: August 13th, 2019, 11:49 am Yes, you can, IF you are using the Core Temp program. Are you? Is it installed?
Yes,i installed it.And it will change the value according to the current speed now, thanks!
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to show cpu current core speed?

Post by balala »

swiftord wrote: August 13th, 2019, 12:27 pm Yes,i installed it.And it will change the value according to the current speed now, thanks!
Ok, let's see if I understood well what would you like. I suppose you'd like to change the CPU loading with the current speed of the CPU, into the Nisekoi\Kirisaki\kirisaki.ini skin. Am I right?
If I am, here is what to do: first add the following measure to your code:

Code: Select all

[MeasureCPUSpeed]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=CpuSpeed
RegExpSubstitute=1
Substitute="^(.*)[^k]$":"\1 M","^(.*)k$":"\1 G"
This measure returns the needed speed.
Now just to can easily turn back to show the CPU load, I recommend to add a Speed variable to the [Variables] section. This variable will control what to be shown: if it's 0, the CPU load will be shown (same way as before), but if it's 1, the speed will be. So, add it:

Code: Select all

[Variables]
...
Speed=1
Now modify the [MeterState] meter, because it is extremely weirdly written. Remove its Text option, because immediately we'll set it through !SetOption bangs and remove the DynamicVariables=1 option as well. It won't be needed anymore. Add the following three options to the same [MeterState] meter: MeasureName=CPUCalc, MeasureName2=MeasureCPUSpeed and AutoScale=2.
And finally you have to add one more measure, which controls what you see: the CPU load or its speed. Add the following measure:

Code: Select all

[MeasureSpeed]
Measure=Calc
Formula=#Speed#
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!SetOption MeterState Text "%2Hz"][!UpdateMeter "MeterState"][!Redraw]
IfFalseAction=[!SetOption MeterState Text "%1%"][!UpdateMeter "MeterState"][!Redraw]
Now you might use for the Speed variable either 0 (in which case you'll get the CPU loading), or 1, to get the speed.
Please let me know if this is what you wanted and if you've succeeded getting it to work.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to show cpu current core speed?

Post by xenium »

balala wrote: August 13th, 2019, 4:13 pm

Code: Select all

[MeasureCPUSpeed]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=CpuSpeed
RegExpSubstitute=1
Substitute="^(.*)[^k]$":"\1 M","^(.*)k$":"\1 G"
Hi,
I have a question:
What is RegExpSubstitute used for in CPUSpeed Measure ?

Code: Select all

RegExpSubstitute=1
Substitute="^(.*)[^k]$":"\1 M","^(.*)k$":"\1 G"
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to show cpu current core speed?

Post by balala »

xenium wrote: August 14th, 2019, 8:47 am What is RegExpSubstitute used for in CPUSpeed Measure ?
To get properly scaled the value returned by the measure. From my previous observations this is the way to get the results according to those shown in the Task Manager. Unfortunately I can't explain why you have to apply it, but this is the only way I got the same results as in Task Manager.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to show cpu current core speed?

Post by xenium »

balala wrote: August 14th, 2019, 11:37 am To get properly scaled the value returned by the measure. From my previous observations this is the way to get the results according to those shown in the Task Manager. Unfortunately I can't explain why you have to apply it, but this is the only way I got the same results as in Task Manager.
Thanks for the clarification.
P.S
For me with RegExpSubstitute added the result is the same, different from Task Manager.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to show cpu current core speed?

Post by balala »

xenium wrote: August 14th, 2019, 3:18 pm For me with RegExpSubstitute added the result is the same, different from Task Manager.
Note that a difference can be seen because the skin and the Task Manager don't update simultaneously. But the two values are pretty much the same.
Post Reply