It is currently July 7th, 2020, 3:18 am

[Feature Req] CPU Core Count variable

Report bugs with the Rainmeter application and suggest features.
User avatar
DavidRGreen
Posts: 34
Joined: May 5th, 2020, 10:19 am

[Feature Req] CPU Core Count variable

Post 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.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Feature Req] CPU Core Count variable

Post 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.
User avatar
DavidRGreen
Posts: 34
Joined: May 5th, 2020, 10:19 am

Re: [Feature Req] CPU Core Count variable

Post 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!
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Feature Req] CPU Core Count variable

Post 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
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Feature Req] CPU Core Count variable

Post 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...
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Feature Req] CPU Core Count variable

Post by jsmorley »

However, the logic of the CPU measure is based on "logical processors", so just using the Environment variable might be enough.
User avatar
DavidRGreen
Posts: 34
Joined: May 5th, 2020, 10:19 am

Re: [Feature Req] CPU Core Count variable

Post by DavidRGreen »

Very interesting and enlightening.
I'll be looking into those.
Thanks.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Feature Req] CPU Core Count variable

Post 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.
User avatar
DavidRGreen
Posts: 34
Joined: May 5th, 2020, 10:19 am

Re: [Feature Req] CPU Core Count variable

Post 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…