Page 14 of 15

Re: New PerfMon Plugin

Posted: April 27th, 2018, 1:30 am
by jsmorley
SilverAzide wrote:I assume you mean on the measure? OK, I did, but for me the code snippet above is returning a value hovering around 600%.
Well, not sure. tjhrulz will have to weigh in on this.

Re: New PerfMon Plugin

Posted: April 27th, 2018, 1:35 am
by jsmorley

Code: Select all

[MeasureDiskIdleTimeAll]
Measure=Plugin
Plugin=UsageMonitor
Category=LogicalDisk
Counter="% Idle Time"
Name=_Total
See if that doesn't work.

Re: New PerfMon Plugin

Posted: April 27th, 2018, 2:04 am
by raiguard
New issue: % Idle Time measures are somehow reporting values of >100%, e.g. 100.03543. Because of this, my read/write time calc measures (Formula=(100 - MeasureDiskAIdleTime)) will go into the negatives, causing the meter to show a negative percentage of disk read/write time.

I've worked around this by adding an absolute value argument to the calc measure, but that is only temporary. The old PerfMon plugin always went up to exactly 100.0.

Edit: code

Code: Select all

[MeasureDiskAIdleTime]
Measure=Plugin
Plugin=UsageMonitor
Category=LogicalDisk
Counter=% Idle Time
Name=A:
Group=DiskA
Disabled=#hideDiskA#

[MeasureDiskARWTime]
Measure=Calc
Formula=abs(100 - MeasureDiskAIdleTime)
MaxValue=100
MinValue=0
Group=DiskA
Disabled=#hideDiskA#

Re: New PerfMon Plugin

Posted: April 27th, 2018, 2:25 am
by tjhrulz
raiguard wrote:New issue: % Idle Time measures are somehow reporting values of >100%, e.g. 100.03543. Because of this, my read/write time calc measures (Formula=(100 - MeasureDiskAIdleTime)) will go into the negatives, causing the meter to show a negative percentage of disk read/write time.

I've worked around this by adding an absolute value argument to the calc measure, but that is only temporary. The old PerfMon plugin always went up to exactly 100.0.
While uncommon it is possible for that counter to end up with a value of greater than 100, even in the perfmon.exe. I don't think there is nothing I can do about that, blame microsoft there.

Not sure why though you did not have that happening before though, mind posting the old PerfMon version of the code?

Re: New PerfMon Plugin

Posted: April 27th, 2018, 2:26 am
by jsmorley

Code: Select all

[MeasureDiskARWTime]
Measure=Calc
Formula=100 - (MeasureDiskAIdleTime > 100 ? 100 : MeasureDiskAIdleTime)
MaxValue=100
MinValue=0
Seems like a reasonable solution until we can figure out how anything can be more than 100% of itself... ;-)

Re: New PerfMon Plugin

Posted: April 27th, 2018, 2:37 am
by raiguard
tjhrulz wrote:While uncommon it is possible for that counter to end up with a value of greater than 100, even in the perfmon.exe. I don't think there is nothing I can do about that, blame microsoft there.

Not sure why though you did not have that happening before though, mind posting the old PerfMon version of the code?
Aha, I was actually wrong. The PerfMon measures did report >100% as well, it's just that it never showed up in the meters because the meters had Percentual=1 when I was using PerfMon, but got removed when I switched to UsageMonitor.

So this is actually a much older bug...

Code: Select all

[MeasureDiskAIdleTime]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=LogicalDisk
PerfMonCounter="% Idle Time"
PerfMonInstance="A:"
Group=DiskA
Disabled=#hideDiskA#

[MeasureDiskARWTime]
Measure=Calc
Formula=(100 - ((MeasureDiskAIdleTime / (#gadgetUpdateRate# / 1000)) / 100000))
MaxValue=100
MinValue=0
Group=DiskA
Disabled=#hideDiskA#
(Excuse the overuse of quotation marks, I'm fixing up the code style as I rewrite the measures...)

Re: New PerfMon Plugin

Posted: April 27th, 2018, 2:41 am
by jsmorley
Better yet...

Code: Select all

[MeasureDiskARWTime]
Measure=Calc
Formula=100 - Clamp(MeasureDiskAIdleTime,0,100)
MaxValue=100
MinValue=0

Re: New PerfMon Plugin

Posted: April 27th, 2018, 10:58 am
by SilverAzide
jsmorley wrote:

Code: Select all

[MeasureDiskIdleTimeAll]
Measure=Plugin
Plugin=UsageMonitor
Category=LogicalDisk
Counter="% Idle Time"
Name=_Total
See if that doesn't work.
Holy CRAP... That actually works! It's actually working even better than the old PerfMon; PerMon always returns a value that is scaled weirdly, but UsageMonitor is returning a proper value.

I'm looking forward to reading the documentation on this... Index=0 and Name=Total returns totals and Name=_Total returns an average -- sometimes....

Re: New PerfMon Plugin

Posted: April 27th, 2018, 11:15 am
by jsmorley
SilverAzide wrote:Holy CRAP... That actually works! It's actually working even better than the old PerfMon; PerMon always returns a value that is scaled weirdly, but UsageMonitor is returning a proper value.

I'm looking forward to reading the documentation on this... Index=0 and Name=Total returns totals and Name=_Total returns an average -- sometimes....
There is no Name=Total, just Name=_Total.

Here is the best I could come up with for now, as I'm not sure there is any hard and fast rule for when Index=0 or Name=_Total is the best bet. Perfmon is a bit of a swamp.

https://docs.rainmeter.net/manual-beta/plugins/usagemonitor/#Name

Re: New PerfMon Plugin

Posted: April 27th, 2018, 12:28 pm
by SilverAzide
jsmorley wrote:There is no Name=Total, just Name=_Total.

Here is the best I could come up with for now, as I'm not sure there is any hard and fast rule for when Index=0 or Name=_Total is the best bet. Perfmon is a bit of a swamp.

https://docs.rainmeter.net/manual-beta/plugins/usagemonitor/#Name
Oops, yes, I got things twisted around. Index=0 shows "Total" as the string value of the measure, while Name=_Total returns "_Total" -- which might be an average instead of a total, thank you Microsoft. :)