It is currently March 28th, 2024, 3:09 pm

New UsageMonitor plugin

Changes made during the Rainmeter 4.2 beta cycle.
User avatar
Nodens
Posts: 8
Joined: March 29th, 2013, 4:36 pm

Re: New UsageMonitor plugin

Post by Nodens »

I just tested what GetSystemInfo() returns and it's 36 so the winapi bug scenario is out. I'll see if I can get some time tomorrow to clone the repository and dig in as it's 5am now heh.
User avatar
Yincognito
Rainmeter Sage
Posts: 7023
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New UsageMonitor plugin

Post by Yincognito »

Nodens wrote: November 6th, 2020, 3:05 am I just tested what GetSystemInfo() returns and it's 36 so the winapi bug scenario is out. I'll see if I can get some time tomorrow to clone the repository and dig in as it's 5am now heh.
Same here. :D Thanks for the info - it seems to lean towards being a Rainmeter code issue...
Dayzwell
Posts: 2
Joined: March 28th, 2021, 2:19 am

Re: New UsageMonitor plugin

Post by Dayzwell »

Hi im traing to modify the Robick skin (https://www.deviantart.com/apexxx-sensei/art/Robik-771914763) to get a GPU usage graph using the UsageMonitor plugin, i used the CPU.ini from the Robic skin as a base and modifed whit the examples from here (https://docs.rainmeter.net/manual-beta/plugins/usagemonitor/). So far i got the graph working whit my GPU usage data but instead of a number i get "total" on on mi text for some reason that i dont understand, so how do i get the number working the same as in the CPU one? I dont know that much about coding so this is a Copy+paste, if some one can help me i would thank you a lot.

TL:DR How do i get to display the GPU usage number?

Here is the code that i am using and a picture of what i am getting

Code: Select all

[Rainmeter]
Update=1000
Author=Connect-R
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
AccurateText=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.1 ? 0.1 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.1 ? 0.1 : #Scale#-#ScrollMouseIncrement#)"][!Refresh] 

[Variables]
@include=#@#Variables.inc
Scale=0.22

;-------------------------------------------------------------
;-------------------------------------------------------------

[TopGPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=GPU
Index=0


;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterLine]
Meter=Line
MeasureName=TopGPU
LineColor=#FontColor2#
X=(0*#Scale#)
Y=(0*#Scale#)
W=(1050*#Scale#)
H=(300*#Scale#)
AutoScale=1
AntiAlias=1

[MeterLine2]
Meter=Line
MeasureName=TopGPU
LineColor=#FontColor#,50
X=(0*#Scale#)r
Y=(0*#Scale#)R
W=(1050*#Scale#)
H=(0*#Scale#)
Flip=1
AutoScale=1
AntiAlias=1

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterAverageGPU]
Meter=String
AntiAlias=1
DynamicVariables=1
MeasureName=TopGPU
StringAlign=Left
FontFace=Product Sans
FontColor=#FontColor#
FontSize=(50*#Scale#)
X=(0*#Scale#)
Y=(320*#Scale#)
Text="GPU:%1%"
AntiAlias=1
Percentual=1
AutoScale=1
Captura de pantalla 2021-03-27 203551.png
And here is the CPU one that i used as a base

Code: Select all

[Rainmeter]
Update=1000
Author=Connect-R
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
AccurateText=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.1 ? 0.1 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.1 ? 0.1 : #Scale#-#ScrollMouseIncrement#)"][!Refresh] 

[Variables]
@include=#@#Variables.inc
Scale=0.22

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeasureCPU]
Measure=CPU
Processor=0

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterLine]
Meter=Line
MeasureName=MeasureCPU
LineColor=#FontColor2#
X=(0*#Scale#)
Y=(0*#Scale#)
W=(1050*#Scale#)
H=(300*#Scale#)
AutoScale=1
AntiAlias=1

[MeterLine2]
Meter=Line
MeasureName=MeasureCPU
LineColor=#FontColor#,50
X=(0*#Scale#)r
Y=(0*#Scale#)R
W=(1050*#Scale#)
H=(0*#Scale#)
Flip=1
AutoScale=1
AntiAlias=1

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterAverageCPU]
Meter=String
MeasureName=MeasureCPU
StringAlign=Left
FontFace=Product Sans
FontColor=#FontColor#
FontSize=(50*#Scale#)
X=(0*#Scale#)
Y=(320*#Scale#)
Text="CPU: %1%"
AntiAlias=1
Percentual=1
AutoScale=1
User avatar
Yincognito
Rainmeter Sage
Posts: 7023
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New UsageMonitor plugin

Post by Yincognito »

Dayzwell wrote: March 28th, 2021, 2:43 amSo far i got the graph working whit my GPU usage data but instead of a number i get "total" on on mi text for some reason that i dont understand, so how do i get the number working the same as in the CPU one? I dont know that much about coding so this is a Copy+paste, if some one can help me i would thank you a lot.

How do i get to display the GPU usage number?

Here is the code that i am using and a picture of what i am getting

Code: Select all

[Rainmeter]
Update=1000
Author=Connect-R
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
AccurateText=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.1 ? 0.1 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.1 ? 0.1 : #Scale#-#ScrollMouseIncrement#)"][!Refresh] 

[Variables]
@include=#@#Variables.inc
Scale=0.22

;-------------------------------------------------------------
;-------------------------------------------------------------

[TopGPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=GPU
Index=0


;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterLine]
Meter=Line
MeasureName=TopGPU
LineColor=#FontColor2#
X=(0*#Scale#)
Y=(0*#Scale#)
W=(1050*#Scale#)
H=(300*#Scale#)
AutoScale=1
AntiAlias=1

[MeterLine2]
Meter=Line
MeasureName=TopGPU
LineColor=#FontColor#,50
X=(0*#Scale#)r
Y=(0*#Scale#)R
W=(1050*#Scale#)
H=(0*#Scale#)
Flip=1
AutoScale=1
AntiAlias=1

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterAverageGPU]
Meter=String
AntiAlias=1
DynamicVariables=1
MeasureName=TopGPU
StringAlign=Left
FontFace=Product Sans
FontColor=#FontColor#
FontSize=(50*#Scale#)
X=(0*#Scale#)
Y=(320*#Scale#)
Text="GPU:%1%"
AntiAlias=1
Percentual=1
AutoScale=1
You get the "Total" string shown up because [MeterAverageGPU], being a string meter, automatically takes the string (aka the "text") value of the [TopGPU] measure, which, in the case of UsageMonitor measures, is different from its number value (see the explanation here).

In order to have the number value displayed you need to either create a Calc measure that takes the TopGPU measure in its Formula option, or use the TopGPU measure as a section variable to get its numerical value in the associated meter. These things are explained in detail here, but you should more or less do either:

Code: Select all

[TopGPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=GPU
Index=0

[TopGPUNumber]
Measure=Calc
Formula=TopGPU
...
...
...
[MeterAverageGPU]
Meter=String
DynamicVariables=1
MeasureName=TopGPUNumber
StringAlign=Left
FontFace=Product Sans
FontColor=#FontColor#
FontSize=(50*#Scale#)
X=(0*#Scale#)
Y=(320*#Scale#)
Text="GPU:%1%"
AntiAlias=1
Percentual=1
AutoScale=1
or simply:

Code: Select all

[TopGPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=GPU
Index=0
...
...
...
[MeterAverageGPU]
Meter=String
AntiAlias=1
DynamicVariables=1
MeasureName=[TopGPU]
StringAlign=Left
FontFace=Product Sans
FontColor=#FontColor#
FontSize=(50*#Scale#)
X=(0*#Scale#)
Y=(320*#Scale#)
Text="GPU:[TopGPU:/1024,0,%]%"
AntiAlias=1
The latter choice has some minor drawbacks that you can read in the last link I mentioned, so it's up to you which one you prefer. By the way, that link is a part of what you linked yourself when talking about the UsageMonitor measures, so I guess you either missed reading about these things or just didn't know how to implement them because of what you mentioned about coding. ;-)
User avatar
Yincognito
Rainmeter Sage
Posts: 7023
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New UsageMonitor plugin

Post by Yincognito »

Nodens wrote: November 5th, 2020, 11:54 am Hmm. I took a look at the Measure=CPU code and it's similar to code I've written myself for a benchmarking application. It looks good so this is weird.
I wonder what

Code: Select all

GetSystemInfo(&systemInfo);
c_NumOfProcessors = (int)systemInfo.dwNumberOfProcessors;
is returning on my system. This could be a winapi bug but it doesn't explain why UM doesn't read the performance counters which are there.. unless there's a check in UM making it not even trying to read the counters if name > numofprocessors returned by GetSystemInfo(). Such a check doesn't make much sense though since we're just trying to read perfmon counters. Either the counter is there or it's not..
Sorry for replying a bit late on this, but your original problem might be related to these particularities of the Rainmeter measures involving multiple logical CPUs. In short, for some PerfMon counters (and apparently the Rainmeter measures using related data) there's a limit of 64 logical CPUs in the case of their output. Not exactly your 32 to 35 logical CPU issue, but I have no idea what other implications there are in such cases, so I thought it was worth mentioning this... :confused:
Dayzwell
Posts: 2
Joined: March 28th, 2021, 2:19 am

Re: New UsageMonitor plugin

Post by Dayzwell »

Yincognito wrote: March 28th, 2021, 3:31 am You get the "Total" string shown up because [MeterAverageGPU], being a string meter, automatically takes the string (aka the "text") value of the [TopGPU] measure, which, in the case of UsageMonitor measures, is different from its number value (see the explanation here).

In order to have the number value displayed you need to either create a Calc measure that takes the TopGPU measure in its Formula option, or use the TopGPU measure as a section variable to get its numerical value in the associated meter. These things are explained in detail here, but you should more or less do either:

Code: Select all

[TopGPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=GPU
Index=0

[TopGPUNumber]
Measure=Calc
Formula=TopGPU
...
...
...
[MeterAverageGPU]
Meter=String
DynamicVariables=1
MeasureName=TopGPUNumber
StringAlign=Left
FontFace=Product Sans
FontColor=#FontColor#
FontSize=(50*#Scale#)
X=(0*#Scale#)
Y=(320*#Scale#)
Text="GPU:%1%"
AntiAlias=1
Percentual=1
AutoScale=1
or simply:

Code: Select all

[TopGPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=GPU
Index=0
...
...
...
[MeterAverageGPU]
Meter=String
AntiAlias=1
DynamicVariables=1
MeasureName=[TopGPU]
StringAlign=Left
FontFace=Product Sans
FontColor=#FontColor#
FontSize=(50*#Scale#)
X=(0*#Scale#)
Y=(320*#Scale#)
Text="GPU:[TopGPU:/1024,0,%]%"
AntiAlias=1
The latter choice has some minor drawbacks that you can read in the last link I mentioned, so it's up to you which one you prefer. By the way, that link is a part of what you linked yourself when talking about the UsageMonitor measures, so I guess you either missed reading about these things or just didn't know how to implement them because of what you mentioned about coding. ;-)
Thanks for responding, i end up trying both options and i couldn't make the second one work it was just stuck at 0, so i used the first one just needed to change the Percentual=1 to 0 and it gave me the number whit one decimal so i did the same to the CPU haha so now it lock like this .
Captura de pantalla 2021-03-28 133314.png
Im happy whit it, thaks again Yincognito.
User avatar
Yincognito
Rainmeter Sage
Posts: 7023
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New UsageMonitor plugin

Post by Yincognito »

Dayzwell wrote: March 28th, 2021, 7:34 pm Thanks for responding, i end up trying both options and i couldn't make the second one work it was just stuck at 0, so i used the first one just needed to change the Percentual=1 to 0 and it gave me the number whit one decimal so i did the same to the CPU haha so now it lock like this .

Captura de pantalla 2021-03-28 133314.png

Im happy whit it, thaks again Yincognito.
My bad, the code I posted was untested and made exactly as to provide what your original parameters indicated. To make the 2nd choice work, set its meter to:

Code: Select all

[MeterAverageGPU]
Meter=String
AntiAlias=1
DynamicVariables=1
StringAlign=Left
FontFace=Product Sans
FontColor=#FontColor#
FontSize=(50*#Scale#)
X=(0*#Scale#)
Y=(320*#Scale#)
Text="GPU:[TopGPU:1]%"
AntiAlias=1
GPU.jpg
The division by 1024 in the previous code (set because your original options, aka AutoScale=1 indicated you wanted it this way) probably made the result 0. Now it should be accurate. By the way, you were right to remove the Percentual option from the 1st choice (another parameter I replicated because it was like that in the original code you posted) - as you can see, I removed it from the 2nd choice as well (along with setting the number of decimals to the desired 1). :thumbup:
Ramere4321
Posts: 4
Joined: April 29th, 2020, 9:23 am

Re: New UsageMonitor plugin

Post by Ramere4321 »

Got a question about this.
I've read in many places that this is the best way to monitor CPUs and such in terms of performance. I'm just curious as to if this is better than the normal way of measuring CPU use with rainmeter for example.

Code: Select all

[core1Use]
Measure=CPU
Processor=1
Meaning, is this worse?

Code: Select all

[Core0Usage]
Measure=Plugin
Plugin=UsageMonitor
Category=Processor
Counter=% Processor Time
Name=0
MinValue=0
MaxValue=100
Than this?

As I understood it they both do the same thing in terms of outcome. but when it comes to behind the scenes, I've got no idea which is better or if completely the same.
User avatar
Yincognito
Rainmeter Sage
Posts: 7023
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New UsageMonitor plugin

Post by Yincognito »

Ramere4321 wrote: April 13th, 2021, 2:57 pm Got a question about this.
I've read in many places that this is the best way to monitor CPUs and such in terms of performance. I'm just curious as to if this is better than the normal way of measuring CPU use with rainmeter for example.

Code: Select all

[core1Use]
Measure=CPU
Processor=1
Meaning, is this worse?

Code: Select all

[Core0Usage]
Measure=Plugin
Plugin=UsageMonitor
Category=Processor
Counter=% Processor Time
Name=0
MinValue=0
MaxValue=100
Than this?

As I understood it they both do the same thing in terms of outcome. but when it comes to behind the scenes, I've got no idea which is better or if completely the same.
Generally, no variant is "better" or "worse" than the other - maybe one is shorter (which is why I mostly prefer the CPU measure when it comes to things not involving running processes). However, it appears there are some limitations for the CPU measure that one can workaround using the UsageMonitor measure. I just linked one of those cases above:
Yincognito wrote: March 28th, 2021, 3:43 amthese particularities of the Rainmeter measures involving multiple logical CPUs [...] for some PerfMon counters (and apparently the Rainmeter measures using related data) there's a limit of 64 logical CPUs in the case of their output
In the linked case, while with the CPU measure you're stuck with that limit, with the UsageMonitor one you can choose a newer PerfMon counter instead (i.e. from the Category called Processor Information, and not the "old" Category called Processor).

So, basically, it comes down to user preference and needs. As long as a variant satisfies both, it's perfectly valid for usage, no matter which one is it.
Post Reply