It is currently April 13th, 2021, 11:04 am

New UsageMonitor plugin

Changes made during the Rainmeter 4.2 beta cycle.
DougS2K
Posts: 13
Joined: July 26th, 2020, 6:33 pm

Re: New UsageMonitor plugin

Post by DougS2K »

Yincognito wrote: July 26th, 2020, 9:59 pm Check this out - it's simple enough to understand, and tries to be similar in terms of colors with what you have on the right side of your desktop:

Code: Select all

[Variables]
TitleFontColor=255,255,255,255
ContentFontColor=113,188,210,255
FontFace=Tahoma
TitleFontSize=14
ContentFontSize=12

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

---Measures---

[MeasureProcessName1]
Measure=Plugin
Plugin=UsageMonitor
Alias=RAM
Index=1
RegExpSubstitute=1
Substitute="#(\d+)$":" (\1)","(^$|^0$)":"(no process)"

[MeasureProcessName2]
Measure=Plugin
Plugin=UsageMonitor
Alias=RAM
Index=2
RegExpSubstitute=1
Substitute="#(\d+)$":" (\1)","(^$|^0$)":"(no process)"

[MeasureProcessName3]
Measure=Plugin
Plugin=UsageMonitor
Alias=RAM
Index=3
RegExpSubstitute=1
Substitute="#(\d+)$":" (\1)","(^$|^0$)":"(no process)"

[MeasureProcessName4]
Measure=Plugin
Plugin=UsageMonitor
Alias=RAM
Index=4
RegExpSubstitute=1
Substitute="#(\d+)$":" (\1)","(^$|^0$)":"(no process)"

[MeasureProcessName5]
Measure=Plugin
Plugin=UsageMonitor
Alias=RAM
Index=5
RegExpSubstitute=1
Substitute="#(\d+)$":" (\1)","(^$|^0$)":"(no process)"

[MeasureProcessValue1]
Measure=Calc
Formula=MeasureProcessName1

[MeasureProcessValue2]
Measure=Calc
Formula=MeasureProcessName2

[MeasureProcessValue3]
Measure=Calc
Formula=MeasureProcessName3

[MeasureProcessValue4]
Measure=Calc
Formula=MeasureProcessName4

[MeasureProcessValue5]
Measure=Calc
Formula=MeasureProcessName5

---Styles---

[BaseStyle]
FontFace=#FontFace#
FontColor=#ContentFontColor#
FontSize=#ContentFontSize#
StringEffect=Shadow
FontEffectColor=0,0,0,255
ClipString=1
AntiAlias=1

---Meters---

[MeterTitle]
Meter=String
MeterStyle=BaseStyle
FontColor=#TitleFontColor#
FontSize=#TitleFontSize#
StringAlign=Center
X=125
Y=0R
W=250
Text="Top RAM Usage"

[MeterProcessName1]
Meter=String
MeterStyle=BaseStyle
X=0
Y=0R
W=125
MeasureName=MeasureProcessName1
Text="%1"

[MeterProcessValue1]
Meter=String
MeterStyle=BaseStyle
X=250
Y=0r
W=125
StringAlign=Right
AutoScale=1k
NumOfDecimals=2
MeasureName=MeasureProcessValue1
Text="%1B"

[MeterProcessName2]
Meter=String
MeterStyle=BaseStyle
X=0
Y=0R
W=125
MeasureName=MeasureProcessName2
Text="%1"

[MeterProcessValue2]
Meter=String
MeterStyle=BaseStyle
X=250
Y=0r
W=125
StringAlign=Right
AutoScale=1k
NumOfDecimals=2
MeasureName=MeasureProcessValue2
Text="%1B"

[MeterProcessName3]
Meter=String
MeterStyle=BaseStyle
X=0
Y=0R
W=125
MeasureName=MeasureProcessName3
Text="%1"

[MeterProcessValue3]
Meter=String
MeterStyle=BaseStyle
X=250
Y=0r
W=125
StringAlign=Right
AutoScale=1k
NumOfDecimals=2
MeasureName=MeasureProcessValue3
Text="%1B"

[MeterProcessName4]
Meter=String
MeterStyle=BaseStyle
X=0
Y=0R
W=125
MeasureName=MeasureProcessName4
Text="%1"

[MeterProcessValue4]
Meter=String
MeterStyle=BaseStyle
X=250
Y=0r
W=125
StringAlign=Right
AutoScale=1k
NumOfDecimals=2
MeasureName=MeasureProcessValue4
Text="%1B"

[MeterProcessName5]
Meter=String
MeterStyle=BaseStyle
X=0
Y=0R
W=125
MeasureName=MeasureProcessName5
Text="%1"

[MeterProcessValue5]
Meter=String
MeterStyle=BaseStyle
X=250
Y=0r
W=125
StringAlign=Right
AutoScale=1k
NumOfDecimals=2
MeasureName=MeasureProcessValue5
Text="%1B"
Preview:
Top RAM.jpg

Obviously, the positions, dimensions and the rest can be adjusted. Didn't put them all into variables (like I usually do), as this format might be easier to understand for a beginner.

P.S. Edited the code a bit to match the color in your right side skins precisely.
Nice and thanks! I may just use this one when I get back to my PC instead of continuing the edit the one I have. The coding here does look a little easier to follow like you said. And actually I like to have the numbers a different colour then the text and this looks like I can easily change that here as well.
User avatar
balala
Rainmeter Sage
Posts: 12546
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: New UsageMonitor plugin

Post by balala »

DougS2K wrote: July 26th, 2020, 9:00 pm but had to add MeasureName=MeasureTop1RAMScal instead of MeasureName=MeasureTop1RAM to get it to fully work
You're perfectly right, that's my mistake. It has been probably some copying / pasting issue. Sorry for it, but I'm glad you succeeded figuring it out.
DougS2K
Posts: 13
Joined: July 26th, 2020, 6:33 pm

Re: New UsageMonitor plugin

Post by DougS2K »

balala wrote: July 27th, 2020, 6:56 am You're perfectly right, that's my mistake. It has been probably some copying / pasting issue. Sorry for it, but I'm glad you succeeded figuring it out.
No worries. Would have never got it done without your help in the first place so thanks again. :thumbup:
User avatar
balala
Rainmeter Sage
Posts: 12546
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: New UsageMonitor plugin

Post by balala »

:thumbup:
User avatar
Nodens
Posts: 8
Joined: March 29th, 2013, 4:36 pm

Re: New UsageMonitor plugin

Post by Nodens »

I have found a problem. It seems than on an Intel 18/36 cpu I can not get values for the last four logical cores. (Name=32-35). The rest of the cores produce proper values. Also it's not a perfmon issue as the counters there are properly populated (in any case I rebuilt them anyhow as part of the troubleshooting process). There's also nothing in the log (with debug on).

Also a side question. Is there any benefit in pulling these values with UsageMonitor compared to Measure=CPU? Any pros and cons? Perhaps higher accuracy vs lower resource load?

PS Measure=CPU works properly for these logical cores.

EDIT: Scrap that. Measure=CPU produces the same load output on all 4 logical cores..Not sure what's wrong here..
User avatar
Yincognito
Posts: 3053
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New UsageMonitor plugin

Post by Yincognito »

Nodens wrote: November 4th, 2020, 8:36 pm I have found a problem. It seems than on an Intel 18/36 cpu I can not get values for the last four logical cores. (Name=32-35). The rest of the cores produce proper values. Also it's not a perfmon issue as the counters there are properly populated (in any case I rebuilt them anyhow as part of the troubleshooting process). There's also nothing in the log (with debug on).

Also a side question. Is there any benefit in pulling these values with UsageMonitor compared to Measure=CPU? Any pros and cons? Perhaps higher accuracy vs lower resource load?

PS Measure=CPU works properly for these logical cores.

EDIT: Scrap that. Measure=CPU produces the same load output on all 4 logical cores..Not sure what's wrong here..
Some strange "powers of 2" limitation?

Out of curiosity, have you tried getting the CPU load / usage (maybe even the temperatures) using plugins like HWiNFO, MSI AB, etc., and if so, do they work or do they exhibit the same behavior? If they do and you're sure it's a problem, maybe you could post a simple / simplified example of this in the Bugs & Feature Suggestions as well, in order to cover the Measure=CPU side of things (along with the UsageMonitor one) - hopefully folks having similar number of logical CPUs can confirm it. Me, I can't confirm it since I don't have that many logical CPUs, but this reminds me that I should increase the number of supported "cores" in my skins as well (incidentally, also 32).

P.S. The CPU or system specifications could be of some use if you decide to post the potential bug.
User avatar
Nodens
Posts: 8
Joined: March 29th, 2013, 4:36 pm

Re: New UsageMonitor plugin

Post by Nodens »

Yincognito wrote: November 4th, 2020, 9:52 pm Some strange "powers of 2" limitation?

Out of curiosity, have you tried getting the CPU load / usage (maybe even the temperatures) using plugins like HWiNFO, MSI AB, etc., and if so, do they work or do they exhibit the same behavior? If they do and you're sure it's a problem, maybe you could post a simple / simplified example of this in the Bugs & Feature Suggestions as well, in order to cover the Measure=CPU side of things (along with the UsageMonitor one) - hopefully folks having similar number of logical CPUs can confirm it. Me, I can't confirm it since I don't have that many logical CPUs, but this reminds me that I should increase the number of supported "cores" in my skins as well (incidentally, also 32).

P.S. The CPU or system specifications could be of some use if you decide to post the potential bug.
That's kind of impossible. The shortest integer data type in MSVC, __int8, is 1 byte long and has max value of 127.

Yes I can get it properly with hwinfo and coretemp. And the counters look great on perfmon. It's just UsageMonitor and Measure=CPU that don't work and with different results. With UsageMonitor my bars are stuck at 0, Measure=CPU presents the same load for all 4 logical cores which doesn't *seem* to match any other core (so taking an educated guess I'd say it's reading _Total/CPU average). It could be some accidental hardcoded limit somewhere. I got handed over this Intel 10980XE to use for software development and I was trying to adjust my skin from the 16 logical of the old CPU to the 36 of the new one. You may want to increase your skins to much higher as there are now 64/128 AMD CPUs out. I wonder if there's a way to template this and populate core gauges automatically via count variable but that's a story for another topic I guess. :)

I'll wait till I hear from UM developer on this one before posting another thread as I think it's counterproductive handling an issue in multiple threads.

The below is what I'm using for UM

Code: Select all

[Mse_Core_33]
Measure=Plugin
Plugin=UsageMonitor
Category=Processor
Counter=% Processor Time
Name=32
MinValue=0
MaxValue=100

[Core_33_Text]
Meter=STRING
X=(28 + #SidePadding#)
Y=8r
FontColor=#font1#
FontSize=7
FontFace=#Font1Name#
AntiAlias=#AA#
Text="Core 33"

[Core_33_Bar_Back]
Meter=IMAGE
X=(75 + #SidePadding#)
Y=3r
W=180
H=5
SolidColor=#Bar_BG_Color#
AntiAlias=#AA#

[Core_33_Bar]
Meter=BAR
MeasureName=Mse_Core_33
X=0r
Y=0r
W=180
H=5
BarColor=#color4#
BarOrientation=HORIZONTAL
AntiAlias=#AA#
And replacing [Mse_Core_33] with the below is for Measure=CPU

Code: Select all

[Mse_Core_33]
Measure=CPU
Processor=33
The CPU is Intel 10980XE on a Rampage VI Extreme Encore running Win 10 Education 20H2. OS installation is in perfect condition, passing sfc and dism checks. Let me know if you need any other info or if there's some way to get further debugging output (other than the log checkbox).
Last edited by eclectic-tech on November 4th, 2020, 10:49 pm, edited 1 time in total.
Reason: Please use code tags. It is the </> symbol.
User avatar
Yincognito
Posts: 3053
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New UsageMonitor plugin

Post by Yincognito »

Yeah, the code should work indeed. When I talked about a limit, I didn't refer to data types in the programming environment, but rather to a "hardcoded limit" somewhere. If interested, you can check the code for Measure=CPU here and here (the CPU measure might be simpler to debug, unless the issue comes from some place else in either Rainmeter or some weird C++ / Windows particularity).

Good advice and reference on increasing the supported CPU count in own skins, thanks. I don't use multiple meters for "cores", I just aggregate everything in one String measure which I then format on multiple lines before displaying the result in a single meter / element, so I only have to increase the number of measures and add corresponding IfConditions to enable/disable them based on the CPU count - bottom line, it's an easy job, but I just released a new version of my skins recently so I will probably wait to have more stuff to add besides this.

I don't think it's a problem if you post the CPU measure issue at the same time in a separate thread, after all the UsageMonitor plugin is different from the CPU measure, but obviously you do as you want. I talked about mentioning the specifications not necessarily for me, as I'm not able to test the code having less "cores" than you do, but generally, on a "bug report", whether it is here or on another thread.

So yeah, we might need to wait for a developer to have a say on this. :sly:
User avatar
Nodens
Posts: 8
Joined: March 29th, 2013, 4:36 pm

Re: New UsageMonitor plugin

Post by Nodens »

Hmm. I took a look at the Measure=CPU code and it's similar to code I've written myself for a benchmarking application. It looks good so this is weird.
I wonder what

Code: Select all

GetSystemInfo(&systemInfo);
c_NumOfProcessors = (int)systemInfo.dwNumberOfProcessors;
is returning on my system. This could be a winapi bug but it doesn't explain why UM doesn't read the performance counters which are there.. unless there's a check in UM making it not even trying to read the counters if name > numofprocessors returned by GetSystemInfo(). Such a check doesn't make much sense though since we're just trying to read perfmon counters. Either the counter is there or it's not..

I'll do a check on what GetSystemInfo() returns on my dev system later today, since I have some work to finish first, and I'll get back to you.


PS Thanks on the advice on reducing the copy/paste clutter on core gauges by the way. I am not really adept in RM skin making. I am just hacking at a really old skin, which I really like/I'm used to/been using for ages, updating it over the years as things "break" heh. Perhaps it's time to tidy it up, bring it to 2020/make some static parts of it dynamic and release it heh. In fact I think I'll do that once I get the core thing working since I *am* already maintaining the damn thing for years. I'm one of those nutjobs who use rainmeter for monitoring multithreaded code scalling and performance when testing heavy impact changes, before I get into actual number crunching profiling. So getting output from all the cores, is important for me and while I can adapt the skin to use hwinfo or coretemp I don't want a dependency I can avoid (which also happens to do hardware polling on intervals which comes with its own caveats). Some years ago I started writing a *very* lightweight RM plugin for reading hardware sensors directly, without an external app and polling only what you needed when you needed it, as I was developing a hardware API for Asus ROG Realbench but that fell down the drain as Asus decided not to pay for an EV certificate for signing the ring0 driver and the already signed one I have can not be extended to be able to read/write things other than MSR registers etc (which works for things like core temperatures but not much else).
User avatar
Yincognito
Posts: 3053
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New UsageMonitor plugin

Post by Yincognito »

Yeah, you probably should be able to check what's going on, or compile / debug Rainmeter yourself. Don't know about loading a skin and testing it, but even though one isn't the author of the software, generally adding a Watch or something to follow what is the value of a variable at runtime might be able to provide some sort of direction in narrowing down the potential culprits for this. Unfortunately, while I have some knowledge in the C++ / C# department, it's not nearly enough or as much as I'd like it to be, although I worked in C#, Delphi, Javascript and a couple of others over the years. Nevertheless, I'm quite interested in what you can find, so please share. Until a developer steps in, it might be the best chance to have an idea why or where the "issue" happens.

Personally, I started using Rainmeter as a Process Explorer "alternative" that it's both light and comfortable to use by showing critical things always on top on the screen. Obviously, its artistic side added a very nice touch to it, but generally it has not been an absolute priority over efficiency and availabilty in my own setup, so I built a minimal suite that complements MSI AB/ RTSS' skin-like capabilities in D3D while in desktop mode. Naturally, working with skins I improved my Rainmeter abilities and became quite good at fitting relatively unlimited information in a limited space. Eventually, I should tackle the plugin side of Rainmeter as well, but I'd have to have some good reason to do it, like adding something I really really need to it. Fortunately, there are lots of plugins already so most needs are more or less covered by the existing array of plugins.