It is currently July 20th, 2019, 6:07 am

Fixing problems with UsageMonitor plugin

Our most popular Tips and Tricks from the Rainmeter Team and others
User avatar
jsmorley
Developer
Posts: 19295
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Fixing problems with UsageMonitor plugin

jsmorley » April 17th, 2016, 2:12 pm

If you are using the UsageMonitor plugin, or either of the PerfMon or AdvancedCPU plugins in your skin, be aware that they use the information being collected by the Performance Monitor (Perfmon.exe) process in Windows.

While rare, there can be issues with Performance Monitor that can cause these plugins to fail to return valid information.

Performance Counters disabled in the Windows Registry

Using RegEdit.exe, check the following Registry Key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance

It should look something like this:
1.png
In particular, ensure that Disable Performance Counters is not set to "1". This must be set to "0" for Performance Monitor to do its job.

By default this is "0" or "enabled" when Windows is installed, but who knows, you may have turned it off inadvertently, or run one of those hideous "tune up your PC" malware utilities that everyone should avoid like poison.

Corrupted Performance Monitor counters database

Run cmd.exe, being sure to run "As administrator". In Windows 10, just right-click the Start button:
2.png
At the command line, enter the following commands in order:
cd c:\windows\system32
lodctr /R
cd c:\windows\sysWOW64
lodctr /R
You should see the following results:

Info: Successfully rebuilt performance counter setting from system backup store
3.png
If you get an error message instead, you can often correct this by running the command a second time.

Note: You can also run any of these commands in PowerShell, just be sure to run "As administrator".
1.png
Corrupted system files

It is possible that one or more system files in Windows have gotten corrupted. This can be corrected by again opening an "As administrator" command prompt, and run sfc (System File Checker) with the following command:
sfc /scannow
5.png
Note that this can take 15-20 minutes to complete. If sfc finds and corrects any errors, you should always run it a second time to verify that no further errors are detected.

Reboot your PC, and give the UsageMonitor, AdvancedCPU, or PerfMon plugins another try. Chances are good that one of these solutions has corrected the issue.

Here is a test skin you can use. It will show the percentage of CPU usage for the process "Rainmeter", using the UsageMonitor, AdvancedCPU, and PefMon plugins. Note that all of them are accurate, but that UsageMonitor is using its own, internal interval for when it checks the counters, and may not be synchronized with AdvancedCPU or PerfMon.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

; ===================
; UsageMonitor Plugin
; ===================

[UsageMonitorRainmeter]
Measure=Plugin
Plugin=UsageMonitor
Alias=CPU
Name=Rainmeter

[MeterUsageMonitorRainmeterPercent]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Percentual=1
NumOfDecimals=2
DynamicVariables=1
Text=[UsageMonitorRainmeter]	[UsageMonitorRainmeter:2]%

; ===================
; AdvancedCPU Plugin
; ===================

[AdvancedCPUMaxValue]
Measure=Plugin
Plugin=AdvancedCPU

[AdvancedCPURainmeterUse]
Measure=Plugin
Plugin=AdvancedCPU
CPUInclude=Rainmeter
TopProcess=1
MaxValue=[AdvancedCPUMaxValue]
DynamicVariables=1

[AdvancedCPURainmeterName]
Measure=Plugin
Plugin=AdvancedCPU
CPUInclude=Rainmeter
TopProcess=2

[MeterAdvancedCPURainmeterPercent]
Meter=String
Y=5R
MeasureName=AdvancedCPURainmeterUse
MeasureName2=AdvancedCPURainmeterName
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Percentual=1
NumOfDecimals=2
Text=%2	%1%

; ===================
; Perfmon Plugin
; ===================

[PerfmonMaxValue]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=Process
PerfMonCounter=% Processor Time
PerfMonInstance=_Total
PerfMonDifference=1

[PerfmonRainmeterUse]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=Process
PerfMonCounter=% Processor Time
PerfMonInstance=Rainmeter
PerfMonDifference=1
MaxValue=[PerfmonMaxValue]
DynamicVariables=1

[MeterPerfmonRainmeterPercent]
Meter=String
MeasureName=PerfmonRainmeterUse
Y=5R
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Percentual=1
NumOfDecimals=2
Text=Rainmeter	%1%
4.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
tjhrulz
Developer
Posts: 225
Joined: October 13th, 2016, 1:28 am
Location: Earth

Re: Fixing problems with PerfMon or AdvancedCPU plugins

tjhrulz » April 29th, 2018, 3:10 am

Just as a reminder all of this also applies to the new UsageMonitor plugin as well since that also uses the Windows Performance Monitor to get its info.
User avatar
jsmorley
Developer
Posts: 19295
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Fixing problems with UsageMonitor plugin

jsmorley » May 9th, 2018, 4:38 pm

tjhrulz wrote:Just as a reminder all of this also applies to the new UsageMonitor plugin as well since that also uses the Windows Performance Monitor to get its info.
Updated the text and the test skin to reflect this...