Page 1 of 1

[Feature Req] CPU Core Count variable

Posted: May 31st, 2020, 1:48 pm
by DavidRGreen
For widgets that monitor CPU Core/s, I thought it might be helpful if the number of Cores on the CPU was visible as a Rainmeter System variable, something like #CPUCORECOUNT#.

Given that Rainmeter CPU Core 0 yields an average Core performance value, I suspect the core count could be being used internally, so if it could be brought to the surface, it might be useful for dynamically adjusting widgets.

Re: [Feature Req] CPU Core Count variable

Posted: May 31st, 2020, 1:57 pm
by jsmorley

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeterCores]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Number of processors is : %NUMBER_OF_PROCESSORS%
That environment variable reflects the number of logical processors.

Re: [Feature Req] CPU Core Count variable

Posted: May 31st, 2020, 2:08 pm
by DavidRGreen
So it is there.
Thanks for pointing it out.
Now I can have a "Doh!" moment for not discovering it in the manual.
Maybe this, and other CPU related environment variables could be mentioned on the CPU Measure page of the manual
Thanks!

Re: [Feature Req] CPU Core Count variable

Posted: May 31st, 2020, 2:12 pm
by jsmorley
DavidRGreen wrote: ↑May 31st, 2020, 2:08 pm So it is there.
Thanks for pointing it out.
Now I can have a "Doh!" moment for not discovering it in the manual.
Maybe this, and other CPU related environment variables could be mentioned on the CPU Measure page of the manual
Thanks!
It's nothing to do with Rainmeter, it is a Windows %ENVIRONMENT% variable. You can see what exists for your system by opening a cmd.exe console and typing "set".

https://docs.rainmeter.net/manual/variables/#EnvironmentVariables

Re: [Feature Req] CPU Core Count variable

Posted: May 31st, 2020, 2:24 pm
by jsmorley
If you want to distinguish between "physical cores" and "logical processors", I might suggest something like:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!CommandMeasure MeasureGetCores "Run"]

[MeasureGetCores]
Measure=Plugin
Plugin=RunCommand
OutputType=ANSI
Parameter=WMIC CPU Get DeviceID,NumberOfCores,NumberOfLogicalProcessors /format:csv

[MeasureGetPhysical]
Measure=String
String=[MeasureGetCores]
DynamicVariables=1
RegExpSubstitute=1
Substitute="(?siU)^.*,.*,.*,.*,.*,(.*),(.*)$":"\1","#CRLF#":""

[MeasureGetLogical]
Measure=String
String=[MeasureGetCores]
DynamicVariables=1
RegExpSubstitute=1
Substitute="(?siU)^.*,.*,.*,.*,.*,(.*),(.*)$":"\2","#CRLF#":""

[MeterCores]
Meter=String
MeasureName=MeasureGetPhysical
MeasureName2=MeasureGetLogical
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Physical Cores	%1#CRLF#Logical Cores	%2

1.jpg


I like the /format:csv comma delimited format with wmic.exe, as it makes it quite a bit easier to parse. Just count commas...

Re: [Feature Req] CPU Core Count variable

Posted: May 31st, 2020, 2:39 pm
by jsmorley
However, the logic of the CPU measure is based on "logical processors", so just using the Environment variable might be enough.

Re: [Feature Req] CPU Core Count variable

Posted: May 31st, 2020, 2:42 pm
by DavidRGreen
Very interesting and enlightening.
I'll be looking into those.
Thanks.

Re: [Feature Req] CPU Core Count variable

Posted: May 31st, 2020, 2:44 pm
by jsmorley
Just FYI, another good option for wmic.exe is to use /format:list which will output like:

Code: Select all

DeviceID=CPU0
NumberOfCores=8
NumberOfLogicalProcessors=16
Which is also pretty easy to parse.

Re: [Feature Req] CPU Core Count variable

Posted: May 31st, 2020, 9:28 pm
by DavidRGreen
With that /format:list version of output, it could be interpreted as part of the Variables section; pipe it to a file and include it. It's just missing the [Variables] header, unless that header is optional when included the [Variables] section…