Page 1 of 2

PerfMon plugin lagging similar to AdvancedCPU

Posted: February 15th, 2018, 5:35 pm
by raiguard
I am at a complete loss here. In my last report, AdvancedCPU was exhibiting a "lag" behavior that spiked Rainmeter's CPU usage up by over 10%. However, now I've discovered that the PerfMon plugin is doing the same thing.

I have a simple skin that monitors two specific processes: Rainmeter and Factorio. It monitors both the CPU usage and the amount of RAM used by these applications. All of the measures use PerfMon.

I already tried to rebuild the counters, twice. And I restarted my computer multiple times, reinstalled a clean slate of Rainmeter, went back and forth between beta and stable, all to no avail. The lag caused by these five measures is horrendous.

Here is the code for the skin in question. NOTE: THIS SKIN REQUIRES SEVERAL EXTERNAL FILES AND WILL NOT WORK WITHOUT THEM. For debugging, you'll have to download the process-meter branch of ModernGadgets' GitHub, or copy the measures into another skin.

ProcessDebug.ini:

Code: Select all

[Rainmeter]
Update=1000
MiddleMouseDownAction=[!Refresh]
MouseOverAction=[!ToggleMeterGroup ConfigButton][!UpdateMeterGroup Background][!Redraw]
MouseLeaveAction=[!ToggleMeterGroup ConfigButton][!UpdateMeterGroup Background][!Redraw]
LeftMouseDoubleClickAction=["taskmgr.exe"]
Group=ModernGadgets | MgGlobalRefresh | MgImportRefresh
AccurateText=1

; Custom Context Menu
ContextTitle=Process Meter settings
ContextAction=[!ActivateConfig "ModernGadgets\Config\Process" "Config.ini"]
ContextTitle2=Global settings
ContextAction2=[!ActivateConfig "ModernGadgets\Config\Global" "Config.ini"]
ContextTitle3=HWiNFO config tool
ContextAction3=[!ActivateConfig "ModernGadgets\Config\Hwinfo" "Config.ini"]
ContextTitle4=Gadget manager
ContextAction4=[!ActivateConfig "ModernGadgets\Config\GadgetManager" "Config.ini"]

[Metadata]
Name=Process Meter
Author=raiguard
Information=Displays processes sorted by CPU or RAM usage. Individual processes can also be specified for constant monitoring.
License=Creative Commons BY-NC-SA 3.0
Version=1.3.0-beta.4

[Variables]
@includeStyleSheet=#@#StyleSheet.inc
@includeGlobalSettings=#@#Settings\GlobalSettings.inc
@includeProcessSettings=#@#Settings\ProcessSettings.inc

textRamUsed=
textFactorioRamUsed=

[StyleStringProcessLabel]
FontFace=#processLabelFontFace#
W=(#contentWidth# - 73)
ClipString=1
Group=Label

[StyleStringRam]
X=(#contentMarginRight# - 40)
FontFace=#processLabelFontFace#
StringAlign=Right

[StyleStringProcessPercentage]
NumOfDecimals=1
Text="%1%"
Group=Percentage

; ========= Measures =========

[MeasureFixedPrecisionFormatScript]
Measure=Script
ScriptFile=#@#Scripts\FixedPrecisionFormat.lua

[MeasureMaxCpu]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=Process
PerfMonCounter=% Processor Time
PerfMonInstance=_Total

[MeasureRainmeterPerfMon]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=Process
PerfMonCounter=% Processor Time
PerfMonInstance=Rainmeter
MaxValue=[MeasureMaxCpu]
DynamicVariables=1

[MeasureFactorioPerfMon]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=Process
PerfMonCounter=% Processor Time
PerfMonInstance=Factorio
MaxValue=[MeasureMaxCpu]
DynamicVariables=1

[MeasureRainmeterRamUsed]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=Process
PerfMonCounter=Working Set - Private
PerfMonInstance=Rainmeter
PerfMonDifference=0
IfCondition=1
IfTrueAction=[!CommandMeasure MeasureFixedPrecisionFormatScript "FormatNumber([MeasureRainmeterRamUsed], 3, '1k', 'textRamUsed')"]
OnChangeAction=[!CommandMeasure MeasureFixedPrecisionFormatScript "FormatNumber([MeasureRainmeterRamUsed], 3, '1k', 'textRamUsed')"]

[MeasureFactorioRamUsed]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=Process
PerfMonCounter=Working Set - Private
PerfMonInstance=Factorio
PerfMonDifference=0
IfCondition=1
IfTrueAction=[!CommandMeasure MeasureFixedPrecisionFormatScript "FormatNumber([MeasureFactorioRamUsed], 3, '1k', 'textFactorioRamUsed')"]
OnChangeAction=[!CommandMeasure MeasureFixedPrecisionFormatScript "FormatNumber([MeasureFactorioRamUsed], 3, '1k', 'textFactorioRamUsed')"]

; ========= Meters =========

[Background]
Meter=Image
MeterStyle=StyleBackground

[ConfigButton]
Meter=Image
MeterStyle=StyleSettingsButton

; ----- Header -----

[GadgetHeaderImage]
Meter=String
MeterStyle=StyleString
X=#contentMargin#
Y=(#contentMargin#)
FontFace=ElegantIcons
FontColor=50,200,50
FontSize=10
Text="[\xe0e9]"
Antialias=0

[GadgetNameString]
Meter=String
MeterStyle=StyleString | StyleStringGadgetHeader
X=3R
Text="Process Meter"

; ----- Pinned Processes -----

; Rainmeter
[RainmeterLabel]
Meter=String
MeterStyle=StyleString | StyleStringProcessLabel
Text=Rainmeter

[RainmeterRamUsed]
Meter=String
MeterStyle=StyleString | StyleStringInfo | StyleStringRam
Text="#textRamUsed#B"
DynamicVariables=1

[RainmeterPercentage]
Meter=String
MeterStyle=StyleString | StyleStringRightAlign | StyleStringProcessPercentage
MeasureName=MeasureRainmeterPerfMon
Percentual=1

[RainmeterBar]
Meter=Bar
MeterStyle=StyleBar
MeasureName=MeasureRainmeterPerfMon
BarColor=255,0,0

; Factorio
[FactorioLabel]
Meter=String
MeterStyle=StyleString | StyleStringProcessLabel
Text=Factorio

[FactorioRamUsed]
Meter=String
MeterStyle=StyleString | StyleStringInfo | StyleStringRam
Text="#textFactorioRamUsed#B"
DynamicVariables=1

[FactorioPercentage]
Meter=String
MeterStyle=StyleString | StyleStringRightAlign | StyleStringProcessPercentage
MeasureName=MeasureFactorioPerfMon
Percentual=1

[FactorioBar]
Meter=Bar
MeterStyle=StyleBar
MeasureName=MeasureFactorioPerfMon
BarColor=0,255,0

[BackgroundHeight]
Meter=Image
MeterStyle=StyleBackgroundHeight
2018-02-15 10_37_06-.png

Re: PerfMon plugin lagging similar to AdvancedCPU

Posted: February 16th, 2018, 1:42 am
by SilverAzide
Hm. I haven't experimented with this extensively, but is there any chance the culpit is this:

PerfMonCounter=Working Set - Private ???

I don't know what Windows is doing to retrieve this value, but seems like when I have a lot of PerfMon measures using this counter, performance goes downhill pretty quickly, though I have not seen "lagging", per se, just high CPU usage. The Disks Meter skin has a bazillion PerfMon measures and they seem to chug along pretty nicely, but they are all for other counters.

Re: PerfMon plugin lagging similar to AdvancedCPU

Posted: February 17th, 2018, 2:09 am
by raiguard
The lag actually occurs most with the CPU usage measures. The RAM measures don't appear to have much if any lag on my system.

Re: PerfMon plugin lagging similar to AdvancedCPU

Posted: February 17th, 2018, 8:33 pm
by SilverAzide
raiguard wrote:The lag actually occurs most with the CPU usage measures. The RAM measures don't appear to have much if any lag on my system.
Hmm, you're right. I switched from using the AdvancedCPU plugin to PerfMon to get process CPU usage, and the performance was pretty awful. Rainmeter CPU usage doubled and the skin was so laggy I could hardly move it.

Re: PerfMon plugin lagging similar to AdvancedCPU

Posted: February 22nd, 2018, 3:42 am
by tjhrulz
If you are only using it for by process breakdowns for things like CPU, RAM, or IO I would recommend you to NomFerp if you want something more efficient.

PerfMon has extra overheard that NomFerp does not have as well as NomFerp has some other performance enhancements. Although do note that NomFerp does not support non english languages.

Re: PerfMon plugin lagging similar to AdvancedCPU

Posted: February 22nd, 2018, 4:26 am
by raiguard
tjhrulz wrote:If you are only using it for by process breakdowns for things like CPU, RAM, or IO I would recommend you to NomFerp if you want something more efficient.

PerfMon has extra overheard that NomFerp does not have as well as NomFerp has some other performance enhancements. Although do note that NomFerp does not support non english languages.
I’m using NomFerp to monitor the top processes. However, I am also allowing users to specify specific processes to monitor constantly. NomFerp does not let you monitor processes by name.

Re: PerfMon plugin lagging similar to AdvancedCPU

Posted: February 22nd, 2018, 4:37 am
by tjhrulz
raiguard wrote:I’m using NomFerp to monitor the top processes. However, I am also allowing users to specify specific processes to monitor constantly. NomFerp does not let you monitor processes by name.
My bad I did not catch that (In fact now that I think about it you were the one who posted about that in the NomFerp thread). Yeah for now then it is something you will have to deal with for the time being.
We are looking into rolling a more feature rich version of NomFerp into Rainmeter but it is very early stages and I can not give you a timeline for it, especially with my schedule these days. I will add single process filtering to the list of features to add for it.

Re: PerfMon plugin lagging similar to AdvancedCPU

Posted: February 23rd, 2018, 4:19 pm
by raiguard
tjhrulz wrote:My bad I did not catch that (In fact now that I think about it you were the one who posted about that in the NomFerp thread). Yeah for now then it is something you will have to deal with for the time being.
We are looking into rolling a more feature rich version of NomFerp into Rainmeter but it is very early stages and I can not give you a timeline for it, especially with my schedule these days. I will add single process filtering to the list of features to add for it.
Glad to hear it, thanks for your time. I'll wait patiently. :)

Re: PerfMon plugin lagging similar to AdvancedCPU

Posted: February 23rd, 2018, 5:14 pm
by SilverAzide
tjhrulz wrote:We are looking into rolling a more feature rich version of NomFerp into Rainmeter but it is very early stages and I can not give you a timeline for it, especially with my schedule these days.
If you need any motivation, I'll pick up the bar tabs for all the Rainmeter devs. :beer:

(Not all of us are quite so patient... ;))

Re: PerfMon plugin lagging similar to AdvancedCPU

Posted: February 26th, 2018, 7:33 pm
by tjhrulz
SilverAzide wrote:If you need any motivation, I'll pick up the bar tabs for all the Rainmeter devs. :beer:

(Not all of us are quite so patient... ;))
I am a sailor so send a handle of rum my way and it will be done tomorrow :p