It is currently March 28th, 2024, 7:22 pm

New UsageMonitor plugin

Changes made during the Rainmeter 4.2 beta cycle.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New UsageMonitor plugin

Post by jsmorley »

MikeG621 wrote:I've tried searching for this but couldn't find anything so...

While this is clearly meant to replace the other plugins, what about simple things like Measure=CPU? The UsageMonitor doc page shows examples for some of the simple uses, but then to use value formatting the doc says you need to add a new scaling Measure, there's extra lines and options, etc.

You're going from

Code: Select all

[MeasureCPU]
Measure=CPU
to

Code: Select all

[MeasureCPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=CPU

[MeasureCpuScaling]
Measure=Calc
Formula=MeasureCPU
Is Rainmeter already doing this under the hood, so skin makers don't have to worry about it?
Measure=CPU does not directly use the data from Windows perfmon.exe, and doesn't have the performance issues that the Perfmon and AdvancedCPU plugins have. So whether or not you change from that measure to UsageMonitor is up to you. However, it is true that UsageMonitor will return Alias=CPU and Index=0 as both a number value (a percentage from 0-100) and a string value ("Total"), so to use the number value in a String meter you would need to use [MeasureName:] as a section variable, to get the number instead of the string value.

To use it, I would use:

Code: Select all

[MeasureCPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=CPU
Index=0
And then in a String meter:

Code: Select all

[MeterCPU%]
Meter=String
AntiAlias=1
DynamicVariables=1
Text="[MeasureCPU:0]%"
That will display the percentage from 0-100 with no decimal places, followed by a "%".

You really only need a Calc measure to obtain the number value as a string if you are going to be "auto scaling" on the String meter, which you won't be with CPU. That is only going to come into play if you are getting things that are in bytes, like disk space or memory.

I don't know that the UsageMonitor plugin has any particular advantage, perhaps a small disadvantage, compared to the simple Measure=CPU to get the percentage of CPU use for the CPU or individual CPU cores. However, if what you are asking is "What process is using the most CPU, and how much?" or "How much CPU is firefox.exe using?" then UsageMonitor is absolutely the way to go, and if you are using UsageMonitor with Alias=CPU for other purposes like those, then also using it to get the total CPU is in a sense "free". Measure=CPU doesn't use a lot of resources, but by the nature of things it has to be more than "none".

https://docs.rainmeter.net/manual/plugins/usagemonitor/#Performance
User avatar
Youkai1977
Posts: 164
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: New UsageMonitor plugin

Post by Youkai1977 »

Hi guys,

I just came across the fact when working on my drive monitor that the "PerfMon" plugin is probably no longer used or should be used.
Again, new territory for my old brain. I'm so glad that I get the entire English-language stories into German via Google Translator, now that.

Anyway, as far as I understood, the example here in the thread of page 1 was exactly what I was looking for.
So, I went there and copied the sample code into my drive monitor. But puff pie. That does not work.
What am I doing wrong?

Likewise (I do not really know in this thread), I can not get it, the write access to C: the font is changed to red. Try using "IfCondition" in the measure, but that does not seem to work. Or do I overlook something or is my way of thinking fundamentally wrong?
It is very difficult for me to understand everything in English.

Here is the code snippet for drive C: (READ)
If all the code is needed, please say.

Code: Select all

[Rainmeter]
Update=1000
;--------------------------------------------------
;--- VARIABLES & STYLES ---------------------------
;--------------------------------------------------

[Variables]
Images=#@#images\
Fontcolor1=164,164,164,230
FontColor2=0,167,0,230
WriteColor=196,0,0,230
FS1=12
FS2=10
FS3=9

[Style1]
FontColor=#FontColor1#
FontFace=AMDRTG
StringAlign=LEFT
AntiAlias=1

[Style2]
FontColor=#FontColor2#
FontFace=KAITI
StringAlign=RIGHT
StringStyle=NORMAL
AutoScale=1k
NumOfDecimals=2
AntiAlias=1

;--------------------------------------------------
;--- MEASURES -------------------------------------
;--------------------------------------------------

[MeasureDriveFree_C]
Measure=FreeDiskSpace
Drive=C:
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=5

[DiskAccess_C_R]
Measure=Plugin
Plugin=UsageMonitor
Category=PhysicalDisk
Counter=Disk Read Bytes/sec
Name=0 C:

[DiskAccess_C_W]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=LogicalDisk
PerfMonCounter=Disk Write Bytes/sec
PerfMonInstance=C:
IfCondition=DiskAccess_C_W = -1
IfTrueAction=[!SetOption DiskAccess_C_Data_W FontColor #FontColor2#][!UpdateMeter *][!Redraw]
IfCondition2=DiskAccess_C_W = 1
IfTrueAction2=[!SetOption DiskAccess_C_Data_W FontColor #WriteColor#][!UpdateMeter *][!Redraw] 

;--------------------------------------------------
;--- BACKGROUND -----------------------------------
;--------------------------------------------------

[Background1]
Meter=Image
ImageName=#Images#bg_cpu_drives.png
X=0
Y=0
W=230
H=125
LeftMouseUpAction=["shell:MyComputerFolder"] 

[Background2]
Meter=Image
ImageName=#Images#bg_drives.png
X=r
Y=r
W=230
H=125

;--- DRIVES-ACCESS Label --------------------------

[Label_1]
Meter=String
MeterStyle=Style2
FontSize=#FS3#
StringAlign=LEFT
Text=FREE
X=58
Y=25

[Label_2]
Meter=String
MeterStyle=Style2
FontSize=#FS3#
StringAlign=LEFT
Text=READ
X=66r
Y=r

[Label_3]
Meter=String
MeterStyle=Style2
FontSize=#FS3#
StringAlign=LEFT
Text=WRITE
X=68r
Y=r

;--------------------------------------------------
;--- DRIVES-ACCESS METER --------------------------
;--------------------------------------------------

;--- Meter Name -----------------------------------

[NAME]
Meter=STRING
MeterStyle=Style1
FontSize=#FS1#
Text=drive monitor
X=0
Y=2
UpdateDivider=-1

;--- Drive C --------------------------------------

[DiskAccess_C_Label]
Meter=String
MeterStyle=Style2
FontSize=#FS3#
StringAlign=LEFT
Text=C:      
X=4
Y=35r

[DriveFree_C]
Meter=String
MeasureName=MeasureDriveFree_C
MeterStyle=Style2
FontSize=#FS3#
Text=%1B
AutoScale=1
X=82r
Y=r

[DiskAccess_C_Data_R]
Meter=String
MeasureName=DiskAccess_C_R
MeterStyle=Style2
FontSize=#FS3#
Text=%1B
AutoScale=1
X=67r
Y=r

[DiskAccess_C_Data_W]
Meter=String
MeasureName=DiskAccess_C_W
MeterStyle=Style2
FontSize=#FS3#
Text=%1B
AutoScale=1
X=73r
Y=r
drivemonitor.png
You do not have the required permissions to view the files attached to this post.
- Win11 Pro x64 (23H2 - 22631.3085)
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet

The absolutly High-End Machine on 2024 ... at least the graphics card :oops: O.O :rofl:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: New UsageMonitor plugin

Post by balala »

Youkai1977 wrote: November 16th, 2018, 6:00 pm So, I went there and copied the sample code into my drive monitor. But puff pie. That does not work.
What am I doing wrong?
Modify the [DiskAccess_C_R] measure as it follows:

Code: Select all

[DiskAccess_C_R]
Measure=Plugin
Plugin=UsageMonitor
Category=LogicalDisk
Counter=Disk Read Bytes/sec
Name=C:
See that I modified the Category option to Category=LogicalDisk (instead of the original Category=PhysicalDisk) and the Name option to Name=C: (initially Name=0 C:).
Now there is one more thing you have to do: remove the MeasureName option of the [DiskAccess_C_Data_R] meter and replace its Text option with Text=[DiskAccess_C_R:]. Take care that you also will have to add a DynamicVariables=1 option to the [DiskAccess_C_Data_R] meter, to can make it to use the new option (which requires to set up the dynamic variables). This step is needed because the plugin measure returns different string and numeric values. The above Text option shows up the numeric value of the measure, while the original one shows its string value.
User avatar
Youkai1977
Posts: 164
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: New UsageMonitor plugin

Post by Youkai1977 »

Now there is one more thing you have to do: remove the MeasureName option of the [DiskAccess_C_Data_R] meter and replace its Text option with Text=[DiskAccess_C_R:]
This part of your text upsets me when I chase it through the translator.
In short, it does not work. I still do not get a clear message in Rainmeter. Now there is always only C: instead of the bytes per second.

Is it possible to upload an example code snippet here or change my code accordingly, as you mean? Would be nice :-)
- Win11 Pro x64 (23H2 - 22631.3085)
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet

The absolutly High-End Machine on 2024 ... at least the graphics card :oops: O.O :rofl:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: New UsageMonitor plugin

Post by balala »

Youkai1977 wrote: November 16th, 2018, 8:12 pm Is it possible to upload an example code snippet here or change my code accordingly, as you mean? Would be nice :-)
Ok, sure, here it is:

Code: Select all

[Rainmeter]
Update=1000
;--------------------------------------------------
;--- VARIABLES & STYLES ---------------------------
;--------------------------------------------------

[Variables]
Images=#@#images\
Fontcolor1=164,164,164,230
FontColor2=0,167,0,230
WriteColor=196,0,0,230
FS1=12
FS2=10
FS3=9

[Style1]
FontColor=#FontColor1#
FontFace=AMDRTG
StringAlign=LEFT
AntiAlias=1

[Style2]
FontColor=#FontColor2#
FontFace=KAITI
StringAlign=RIGHT
StringStyle=NORMAL
AutoScale=1k
NumOfDecimals=2
AntiAlias=1

;--------------------------------------------------
;--- MEASURES -------------------------------------
;--------------------------------------------------

[MeasureDriveFree_C]
Measure=FreeDiskSpace
Drive=C:
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=5

[DiskAccess_C_R]
Measure=Plugin
Plugin=UsageMonitor
Category=LogicalDisk
Counter=Disk Read Bytes/sec
Name=C:

[MeasureDiskAccess_C_R]
Measure=Calc
Formula=DiskAccess_C_R

[DiskAccess_C_W]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=LogicalDisk
PerfMonCounter=Disk Write Bytes/sec
PerfMonInstance=C:
IfCondition=DiskAccess_C_W = -1
IfTrueAction=[!SetOption DiskAccess_C_Data_W FontColor #FontColor2#][!UpdateMeter *][!Redraw]
IfCondition2=DiskAccess_C_W = 1
IfTrueAction2=[!SetOption DiskAccess_C_Data_W FontColor #WriteColor#][!UpdateMeter *][!Redraw] 

;--------------------------------------------------
;--- BACKGROUND -----------------------------------
;--------------------------------------------------

[Background1]
Meter=Image
ImageName=#Images#bg_cpu_drives.png
X=0
Y=0
W=230
H=125
LeftMouseUpAction=["shell:MyComputerFolder"] 

[Background2]
Meter=Image
ImageName=#Images#bg_drives.png
X=r
Y=r
W=230
H=125

;--- DRIVES-ACCESS Label --------------------------

[Label_1]
Meter=String
MeterStyle=Style2
FontSize=#FS3#
StringAlign=LEFT
Text=FREE
X=58
Y=25

[Label_2]
Meter=String
MeterStyle=Style2
FontSize=#FS3#
StringAlign=LEFT
Text=READ
X=66r
Y=r

[Label_3]
Meter=String
MeterStyle=Style2
FontSize=#FS3#
StringAlign=LEFT
Text=WRITE
X=68r
Y=r

;--------------------------------------------------
;--- DRIVES-ACCESS METER --------------------------
;--------------------------------------------------

;--- Meter Name -----------------------------------

[NAME]
Meter=STRING
MeterStyle=Style1
FontSize=#FS1#
Text=drive monitor
X=0
Y=2
UpdateDivider=-1

;--- Drive C --------------------------------------

[DiskAccess_C_Label]
Meter=String
MeterStyle=Style2
FontSize=#FS3#
StringAlign=LEFT
Text=C:      
X=4
Y=35r

[DriveFree_C]
Meter=String
MeasureName=MeasureDriveFree_C
MeterStyle=Style2
FontSize=#FS3#
Text=%1B
AutoScale=1
X=82r
Y=r

[DiskAccess_C_Data_R]
Meter=String
MeasureName=MeasureDiskAccess_C_R
MeterStyle=Style2
FontSize=#FS3#
Text=%1B
AutoScale=1
X=67r
Y=r
DynamicVariables=1

[DiskAccess_C_Data_W]
Meter=String
MeasureName=DiskAccess_C_W
MeterStyle=Style2
FontSize=#FS3#
Text=%1B
AutoScale=1
X=73r
Y=r
Here I used a bit different approach then my previous one: I added a [MeasureDiskAccess_C_R] measure, which extracts the numeric value returned by the [DiskAccess_C_R] measure, then the [DiskAccess_C_Data_R] string meter shows up this value (through its MeasureName=MeasureDiskAccess_C_R option).
User avatar
Youkai1977
Posts: 164
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: New UsageMonitor plugin

Post by Youkai1977 »

Okay ... now I've got it.
An example code snippet says more than a thousand words (in a foreign language) * lol *

But honestly, purely from a programmatic point of view, is not that nonsense?

I do not know now if it was your idea with the CALC measure, or the new UsageMonitor plugin basically requires such conversions. If the latter, then I can only say what a mischief. Where previously a measure was enough, you now need two to get the same result.

I do not know if I would rather stick to the old plug-in. At least I do not see these highly praised advantages

But still a thousand thanks :thumbup:
- Win11 Pro x64 (23H2 - 22631.3085)
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet

The absolutly High-End Machine on 2024 ... at least the graphics card :oops: O.O :rofl:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: New UsageMonitor plugin

Post by balala »

Youkai1977 wrote: November 16th, 2018, 9:17 pm An example code snippet says more than a thousand words (in a foreign language) * lol *
Definitely agree! And not just in a foreign language.

You're welcome. However you have to know the followings:
  • Youkai1977 wrote: November 16th, 2018, 9:17 pm But honestly, purely from a programmatic point of view, is not that nonsense?
    Yes, probably from "programmatic point of view" it is, however keep in mind that Rainmeter is not a programming language(!).
  • Youkai1977 wrote: November 16th, 2018, 9:17 pm
    I do not know now if it was your idea with the CALC measure, or the new UsageMonitor plugin basically requires such conversions. If the latter, then I can only say what a mischief. Where previously a measure was enough, you now need two to get the same result.
    No, it wasn't. I follow a lot of ideas published here on forum, then later I try to follow them (if I can keep them in my mind).
  • Youkai1977 wrote: November 16th, 2018, 9:17 pm I do not know if I would rather stick to the old plug-in. At least I do not see these highly praised advantages
    The advantages is that plugin is much more efficient then the old one. jsmorley or one of the developers (Brian for example) probably will have a much more detailed explanation. Let's wait them.
User avatar
Youkai1977
Posts: 164
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: New UsageMonitor plugin

Post by Youkai1977 »

Sorry for my late reply ... but life * lol *

Yes, the skins in the sense of no programming language is clear. I expressed myself there a little bit unhappy.
What I meant rather was that as a writer of meters, it has more work. Depending on the complexity of a meter. In the case of my HDD monitor here, with 7 drives in total, there are quite some things coming together.
Once we count up to 7 drives, for every 1 write and one read measure, make 14 measurements. Then with the new Usage Monitor come again 14 measures (CALC). So, for 7 drives alone, 28 measures are only used to evaluate the read and write accesses. PLus still (in my case) umpteen other measures for additional functions. Yes, one falls from the stem O.O

Or if, in the case of a 24-band stereo visualizer, such detours suddenly become necessary via another measure. Well then good night. I am already sick when I see the program code of my (2x12 band) stereo visualizer. O.O
The advantages is that plugin is much more efficient then the old one. jsmorley or one of the developers (Brian for example) probably will have a much more detailed explanation. Let's wait them.
Yes, look, that would certainly be interesting and above all useful
- Win11 Pro x64 (23H2 - 22631.3085)
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet

The absolutly High-End Machine on 2024 ... at least the graphics card :oops: O.O :rofl:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: New UsageMonitor plugin

Post by balala »

Youkai1977 wrote: November 18th, 2018, 9:15 pm Yes, the skins in the sense of no programming language is clear. I expressed myself there a little bit unhappy.
What I meant rather was that as a writer of meters, it has more work. Depending on the complexity of a meter. In the case of my HDD monitor here, with 7 drives in total, there are quite some things coming together.
Once we count up to 7 drives, for every 1 write and one read measure, make 14 measurements. Then with the new Usage Monitor come again 14 measures (CALC). So, for 7 drives alone, 28 measures are only used to evaluate the read and write accesses. PLus still (in my case) umpteen other measures for additional functions. Yes, one falls from the stem O.O

Or if, in the case of a 24-band stereo visualizer, such detours suddenly become necessary via another measure. Well then good night. I am already sick when I see the program code of my (2x12 band) stereo visualizer. O.O
Yep, right, but I think there is not to much to be done. That's it...
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Re: New UsageMonitor plugin

Post by rxtd »

Youkai1977 wrote: November 18th, 2018, 9:15 pm
Youkai1977, UsageMonitor has different number and string values. Most of the other measures have same number and string values, or only have meaningful string value.
When you use old PerfMon plugin in the place where a string value is expected, you will get numbers. Because string value of the PerfMon plugin is the same, as its number value.
When you use UsageMonitor plugin in the place where a string value is expected, you will its string value, which is the name of the instance.
In case of String meter you need to do something to make it show number value. For example:
1) Use Calc measure which will extract number value from UsageMonitor, and set its value to this number. Calc measures have same number and string values.
2) Use [DiskAccess_C_R:] form of the access to a measure, with DynamicVariables enabled. Notice the colon: [DiskAccess_C_R:].
Not all measures/meters will access string value of a measure. Calc measure, as you already know, uses number value. Bar, Line, and some other meters/measures will also get number value. So you don't need to always use Calc. You only need it if you don't want to use dynamic variables or want to pass number value of UsageMonitor to a place, where string value is used (like in MeasureName=somemeasure in String meter).