It is currently April 20th, 2024, 12:25 pm

Usage monitor / How to use indexes

Get help with creating, editing & fixing problems with skins
User avatar
Pflosch
Posts: 39
Joined: May 24th, 2020, 7:04 am
Location: Switzerland

Usage monitor / How to use indexes

Post by Pflosch »

I'm struggling with the indexes of usage monitor.
I have 2 disks and want to get write / read MB/s for either of them.
In perfmon I have 4 entries:
1.jpg
Index=-1, 0 or 1 do return data. 2 and more returns nothing.
As I understand, -1 is avg, 0 is total.

Then it gets confusing for me. the documentation says:
- Index=1 would return the current value and name of the instance with the highest value for that counter.
Further down it says:
- Index=1, Index=2 etc. This will return the value of the instance in that position in the sorted list, and the name of the corresponding instance as the string value.

It seems to do the former, i think index=1 returns the highest value.

So where I'm stuck:
How do I get values for my 2 disks? :-( :(

This is my measure and meter:

Code: Select all

[mSSDRead]
Measure=Plugin
Plugin=UsageMonitor
Category=PhysicalDisk
Counter=Disk Read Bytes/sec
Index=0
DynamicVariables=1

[mSSDRdSc]
Measure=Calc
Formula=mSSDRead/1000000
MinValue=0
MaxValue=2500

[MtSSDText]
Meter=string
MeasureName=mSSDRdSc
MeasureName2=mSSDWrSc
Text=%1 / %2
FontFace=SF Digital Readout
FontColor=255,150, 50
FontSize=12
StringAlign=Center
X=98
Y=44
DynamicVariables=1
Any help would be appreciated.
You do not have the required permissions to view the files attached to this post.
I think maybe no problem.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Usage monitor / How to use indexes

Post by balala »

Pflosch wrote: June 15th, 2020, 9:34 am How do I get values for my 2 disks? :-( :(
I admit I never worked with Category=PhysicalDisk, only with Category=LogicalDisk, so I might be wrong, but since you didn't get a reply I post what I see.
Try to replace the code of the [mSSDRead] measure with the following one:

Code: Select all

[mSSDRead]
Measure=Plugin
Plugin=UsageMonitor
Category=PhysicalDisk
Counter=Disk Read Bytes/sec
Instance=C:
This returns the information for the first disk.
For the second one I'd create four such measures and one to add together all values of the four measures:

Code: Select all

[mSSDReadD]
Measure=Plugin
Plugin=UsageMonitor
Category=PhysicalDisk
Counter=Disk Read Bytes/sec
Instance=D:

[mSSDReadE]
Measure=Plugin
Plugin=UsageMonitor
Category=PhysicalDisk
Counter=Disk Read Bytes/sec
Instance=E:

[mSSDReadF]
Measure=Plugin
Plugin=UsageMonitor
Category=PhysicalDisk
Counter=Disk Read Bytes/sec
Instance=F:

[mSSDReadT]
Measure=Plugin
Plugin=UsageMonitor
Category=PhysicalDisk
Counter=Disk Read Bytes/sec
Instance=T:

[mSSDRead]
Measure=Calc
Formula=( mSSDReadD + mSSDReadE + mSSDReadF + mSSDReadT )
Unfortunately I'm not sure at all this is the best approach, but might be an alternative.
Also note a detail: to get the scaled value, it's not a good idea to divide the value returned by the [mSSDRead] measure with 1,000,000, especially that the divider should be 1024 x 1024 = 1,048,576, not 1,000,000. So you either should divide with 1048578, or with 1024**2. But an even better approach is to completely remove the [mSSDRdSc] measure (which is not needed) and instead add a AutoScale=1 option to the [MtSSDText] String meter, along with replacing the Text option of the same meter with Text=%1B / %2B. This way the scaling is done automatically, you don't have to to do it "manually". Details: https://docs.rainmeter.net/manual/meters/string/#AutoScale
User avatar
Pflosch
Posts: 39
Joined: May 24th, 2020, 7:04 am
Location: Switzerland

Re: Usage monitor / How to use indexes

Post by Pflosch »

Hi balala and thanks heaps for the answer.

Regarding function:
Your approach didn't work "out of the box", but pointed me in the right direction.
While UsageMonitor appears not to have an "Instance" option, it has "Name", so I used:
"Name=0 C:" and "Name=1 D: E: F: T:", that seems to work.

Nevertheless it would be nice to have the documentation a bit clearer on the "index" and "name".

Regarding scaling:
I use this measure for a rotator and a string meter.
I initially was trying to play around with autoscale, but didn't get anything pleasing, everything becomes nervous and jumping around with autoscale...
So I got annoyed and added the scaling. :confused:
As for 1000/1024, yes of course, you're right, I corrected it. :)

Thank u very much, have a nice day.
I think maybe no problem.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Usage monitor / How to use indexes

Post by balala »

Pflosch wrote: June 16th, 2020, 2:06 am While UsageMonitor appears not to have an "Instance" option, it has "Name", so I used:
"Name=0 C:" and "Name=1 D: E: F: T:", that seems to work.
Did it? To be honest I didn't think to this possibility, but if it does work, I'm glad.
Pflosch wrote: June 16th, 2020, 2:06 am I use this measure for a rotator and a string meter.
I initially was trying to play around with autoscale, but didn't get anything pleasing, everything becomes nervous and jumping around with autoscale...
So I got annoyed and added the scaling. :confused:
Using a Calc measure to scale the value returned by (in this case) the [mSSDRead] measure doesn't make too much sense, at least not as you did. [mSSDRdSc] returns the value of the [mSSDRead] measure, divided by 1,000,000 (or by 1,048,576), by why do you do this? For a manual scaling, I'd use on the [mSSDRdSc] measure a little bit more complicated formula, something like: Formula=(( mSSDRead > ( 1024 ** 3 )) ? ( mSSDRead / ( 1024 ** 3 )) : (( mSSDRead > ( 1024 ** 2 )) ? ( mSSDRead / ( 1024 ** 2 )) : (( mSSDRead > 1024 ) ? ( mSSDRead / 1024 ) : mSSDRead ))), along with adding the MinValue=0 and MaxValue=1024 options to the same [mSSDRdSc] measure.
If you need the unit of the scaled value, you have to add an additional measure. So, if you want to give it a try, add the following measure beside [mSSDRdSc]:

Code: Select all

[MeasureUnit]
Measure=Calc
Formula=(( mSSDRead > ( 1024 ** 3 )) ? 3 : (( mSSDRead > ( 1024 ** 2 )) ? 2 : (( mSSDRead > 1024 ) ? 1 : 0 )))
Substitute="0":"","1":"K","2":"M","3":"G"
Now on the [MtSSDText] String meter you can use the above measures as it follows:

Code: Select all

[MtSSDText]
MeasureName=mSSDRdSc
MeasureName2=MeasureUnit
...
Text=%1 %2B
Also for instance on a Rotator meter, you can use the value of the [mSSDRdSc] measure, to get the rotation, by adding the MeasureName=mSSDRdSc option to it.
User avatar
Pflosch
Posts: 39
Joined: May 24th, 2020, 7:04 am
Location: Switzerland

Re: Usage monitor / How to use indexes

Post by Pflosch »

Hi again,
Thanks, that sounds cool for the text indication, will sure try, but I just got busy for some days, so it will take a while.
I think maybe no problem.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Usage monitor / How to use indexes

Post by balala »

Pflosch wrote: June 18th, 2020, 12:22 pm Thanks, that sounds cool for the text indication, will sure try, but I just got busy for some days, so it will take a while.
Alright, please let me know how have you got it working.
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Usage monitor / How to use indexes

Post by Yincognito »

Pflosch wrote: June 16th, 2020, 2:06 amWhile UsageMonitor appears not to have an "Instance" option, it has "Name", so I used:
"Name=0 C:" and "Name=1 D: E: F: T:", that seems to work.

Nevertheless it would be nice to have the documentation a bit clearer on the "index" and "name".
The documentation is pretty clear in my view: you use index if you were interested in how those values were ordered from max to min (which you were not), and name if you were interested in a specific instance, irrespective of how they were ordered from max to min (which you were). So, what happened is that you didn't realized right from the start that you needed the latter option, but fortunately you eventually got it right.

Same for my case (not exactly what you worked with, but it follows the same principle; the variables in the Name option are pretty self explanatory):

Code: Select all

[MS_UsageMonitor_DiskReadRate]
Group=DiskGroup
Measure=Plugin
Plugin=UsageMonitor
Category=LogicalDisk
Counter=Disk Read Bytes/sec
Name=#DiskIDPrefix##DiskID##DiskIDPostfix#
DynamicVariables=1
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Pflosch
Posts: 39
Joined: May 24th, 2020, 7:04 am
Location: Switzerland

Re: Usage monitor / How to use indexes

Post by Pflosch »

balala:
Yep, that works like a charm for the text, including the unit thingie and it looks nicer. :thumbup:

Yincognito:
Hmm, then I got this totally wrong :oops: Hellyeah... Not native English speaker :confused:
I thought Index returns the value of the entry in the list as sorted in PerfMon didn't figure it's "list sorted from max to min"
Thanks for explaining :)
I think maybe no problem.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Usage monitor / How to use indexes

Post by balala »

Pflosch wrote: June 19th, 2020, 2:38 am balala:
Yep, that works like a charm for the text, including the unit thingie and it looks nicer. :thumbup:
Glad in this case. :thumbup:
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Usage monitor / How to use indexes

Post by Yincognito »

Pflosch wrote: June 19th, 2020, 2:38 amYincognito:
Hmm, then I got this totally wrong :oops: Hellyeah... Not native English speaker :confused:
I thought Index returns the value of the entry in the list as sorted in PerfMon didn't figure it's "list sorted from max to min"
Thanks for explaining :)
Yeah, don't worry, I'm not a native English speaker either, LOL. It wasn't about that, in the end, but rather about paying a bit more attention to the details (I know, it's a bit stressful, this one). For example, the manual's first sentence on Index is:
All instances for the counter are evaluated, totaled and sorted in an indexed list from highest value to lowest value.
This obviously translates to ordered from max to min - it's just another way of saying it, really. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth