It is currently October 3rd, 2024, 10:24 pm

Monitor Rainmeter Process

Skins that monitor system information
User avatar
jsmorley
Developer
Posts: 22802
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Monitor Rainmeter Process

Post by jsmorley »

While you are working on skins it can be handy to have some details about the Rainmeter process and performance around.
3-31-2013 8-49-16 PM.png

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Instance=Rainmeter

[MeasureMaxCPU]
Measure=Plugin
Plugin=AdvancedCPU

[MeasureUsedCPU]
Measure=Plugin
Plugin=AdvancedCPU
CPUInclude=#Instance#
MaxValue=[MeasureMaxCPU]
DynamicVariables=1

[MeasureIDProcess]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=ID Process
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=-1

[MeasureHandleCount]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=Handle Count
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=5

[MeasureThreadCount]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=Thread Count
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=5

[MeasurePrivateBytes]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=Private Bytes
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=2

[MeasureWorkingSet]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=Working Set
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=2

[MeterBackground]
Meter=Image
W=250
H=140
SolidColor=0,0,0,255
SolidColor2=50,50,50,255
UpdateDivider=-1

[TextStyle]
FontFace=Segoe UI
FontSize=11
FontColor=200,200,200,255
AntiAlias=1

[LeftStyle]
X=5
Y=2R
StringAlign=Left

[RightStyle]
X=245
Y=0r
StringAlign=Right

[MeterIDProcessL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Y=5
Text=#Instance# (PID)

[MeterIDProcessR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureIDProcess

[MeterUsedCPUL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Percent CPU

[MeterUsedCPUR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureUsedCPU
Percentual=1
NumOfDecimals=1
Text=%1%

[MeterHandleCountL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Handle Count

[MeterHandleCountR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureHandleCount

[MeterThreadCountL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Thread Count

[MeterThreadCountR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureThreadCount

[MeterPrivateBytesL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Private Bytes

[MeterPrivateBytesR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasurePrivateBytes
AutoScale=1
NumOfDecimals=3

[MeterWorkingSetL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Working Set

[MeterWorkingSetR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureWorkingSet
AutoScale=1
NumOfDecimals=3
You do not have the required permissions to view the files attached to this post.
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: Monitor Rainmeter Process

Post by Seahorse »

Clever stuff! 8-)
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
The GhostRider
Posts: 6
Joined: September 29th, 2024, 3:46 pm
Location: 🔥Hell🔥

Re: Monitor Rainmeter Process

Post by The GhostRider »

jsmorley wrote: April 1st, 2013, 12:51 am While you are working on skins it can be handy to have some details about the Rainmeter process and performance around.

3-31-2013 8-49-16 PM.png

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Instance=Rainmeter

[MeasureMaxCPU]
Measure=Plugin
Plugin=AdvancedCPU

[MeasureUsedCPU]
Measure=Plugin
Plugin=AdvancedCPU
CPUInclude=#Instance#
MaxValue=[MeasureMaxCPU]
DynamicVariables=1

[MeasureIDProcess]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=ID Process
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=-1

[MeasureHandleCount]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=Handle Count
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=5

[MeasureThreadCount]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=Thread Count
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=5

[MeasurePrivateBytes]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=Private Bytes
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=2

[MeasureWorkingSet]
Measure=Plugin
Plugin=Perfmon
PerfMonObject=Process
PerfMonCounter=Working Set
PerfMonInstance=#Instance#
PerfMonDifference=0
UpdateDivider=2

[MeterBackground]
Meter=Image
W=250
H=140
SolidColor=0,0,0,255
SolidColor2=50,50,50,255
UpdateDivider=-1

[TextStyle]
FontFace=Segoe UI
FontSize=11
FontColor=200,200,200,255
AntiAlias=1

[LeftStyle]
X=5
Y=2R
StringAlign=Left

[RightStyle]
X=245
Y=0r
StringAlign=Right

[MeterIDProcessL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Y=5
Text=#Instance# (PID)

[MeterIDProcessR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureIDProcess

[MeterUsedCPUL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Percent CPU

[MeterUsedCPUR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureUsedCPU
Percentual=1
NumOfDecimals=1
Text=%1%

[MeterHandleCountL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Handle Count

[MeterHandleCountR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureHandleCount

[MeterThreadCountL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Thread Count

[MeterThreadCountR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureThreadCount

[MeterPrivateBytesL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Private Bytes

[MeterPrivateBytesR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasurePrivateBytes
AutoScale=1
NumOfDecimals=3

[MeterWorkingSetL]
Meter=String
MeterStyle=TextStyle | LeftStyle
Text=Working Set

[MeterWorkingSetR]
Meter=String
MeterStyle=TextStyle | RightStyle
MeasureName=MeasureWorkingSet
AutoScale=1
NumOfDecimals=3
Hi @jsmorley, since I think I understood that you are the right person to ask this question.

I am trying to create an Addon in Rainmeter that allows me to count how many instances are open of a certain program, in this specific case I would like to have a counter of the open instances of "msedge.exe" is there a way to do it?

Thanks in advance for your kind help.
🔥The GhostRider🔥
Thomas Alva Edison:
I have not failed. I've just found 10,000 ways that won't work.
User avatar
Yincognito
Rainmeter Sage
Posts: 8324
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Monitor Rainmeter Process

Post by Yincognito »

The GhostRider wrote: September 29th, 2024, 4:02 pmI am trying to create an Addon in Rainmeter that allows me to count how many instances are open of a certain program, in this specific case I would like to have a counter of the open instances of "msedge.exe" is there a way to do it?
Sure there is, just not with the Process, AdvancedCPU (deprecated by now), PerfMon (deprecated by now, replaced by UsageMonitor) plugins, but by running the suited PowerShell command in a RunCommand measure:

Code: Select all

[Variables]
Process=Rainmeter

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!CommandMeasure ProcessInstances "Run"]

---Measures---

[ProcessInstances]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=@(Get-Process -Name #Process# -ErrorAction 0).count
State=Hide
OutputType=ANSI
FinishAction=[!UpdateMeter *][!Redraw]
DynamicVariables=1

---Meters---

[InstancesOfProcess]
Meter=String
SolidColor=0,255,0,255
AntiAlias=1
MeasureName=ProcessInstances
Text=Instances Of #Process# = %1
LeftMouseUpAction=[!CommandMeasure ProcessInstances "Run"]
DynamicVariables=1
Feel free to change the value of the Process variable to your liking. Or, if you find it more comfortable, you can use the literal name of the process you want and forget about using the said variable. The above runs the measure on skin refresh, but, for conveniency, allows you to run it when you left click on the meter as well - you can keep both or remove the one you're not interested in, of course.

References:
https://docs.rainmeter.net/manual/plugins/deprecated/
https://docs.rainmeter.net/manual/plugins/usagemonitor/
https://docs.rainmeter.net/manual/plugins/runcommand/
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-process?view=powershell-7.4
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22802
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Monitor Rainmeter Process

Post by jsmorley »

Another approach, not demonstrably better, but alternatively:

Code: Select all

[Variables]
Process=msedge.exe

[ProcessInstances]
Measure=Plugin
Plugin=RunCommand
Parameter=tasklist | find /I /C "#Process#"
State=Hide
OutputType=ANSI
Note that while this has an advantage in efficiency / performance if you are checking for the count often, like once a second, it has a disadvantage that ANY instance of msedge.exe, for instance myothermsedge.exe, would match.
User avatar
jsmorley
Developer
Posts: 22802
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Monitor Rainmeter Process

Post by jsmorley »

So it would likely be a better option than Powershell with this:

Code: Select all

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

[Variables]
Process=msedge.exe

[MeasureFireIt]
Measure=Calc
Formula=1
OnUpdateAction=[!CommandMeasure ProcessInstances "Run"]

[ProcessInstances]
Measure=Plugin
Plugin=RunCommand
Parameter=tasklist | find /I /C "#Process#"
State=Hide
OutputType=ANSI

[InstancesOfProcess]
Meter=String
MeasureName=ProcessInstances
SolidColor=0,255,0,255
AntiAlias=1
Text=Instances Of #Process# = %1
User avatar
Yincognito
Rainmeter Sage
Posts: 8324
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Monitor Rainmeter Process

Post by Yincognito »

jsmorley wrote: September 29th, 2024, 6:45 pmthis has an advantage in efficiency / performance
Very good point, dind't think of that! If only "find" had what "findstr" has and viceversa (i.e. both line counting and regex anchors)...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22802
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Monitor Rainmeter Process

Post by jsmorley »

Yincognito wrote: September 29th, 2024, 7:07 pm Very good point, dind't think of that! If only "find" had what "findstr" has and viceversa (i.e. both line counting and regex anchors)...
Yes, fortunately "msedge.exe" is likely to be unique enough to be safe, but some care should be taken with a tool like "find' that is not bounded.
User avatar
Yincognito
Rainmeter Sage
Posts: 8324
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Monitor Rainmeter Process

Post by Yincognito »

jsmorley wrote: September 29th, 2024, 7:09 pm Yes, fortunately "msedge.exe" is likely to be unique enough to be safe, but some care should be taken with a tool like "find' that is not bounded.
Been experimenting a little with:

Code: Select all

tasklist | findstr /i /r /c:"^chrome[.]exe .*$" | find /I /C "chrome"
It's a bit more verbose, but it seems to produce the correct result as well:
ProcessInstances.jpg
That being said, adding the extension like you suggested in your second reply should be a solid choice on its own - I'm already a fan of it, always prefered performance when possible. Only a few extensions are themselves "extensions" of shorter ones, e.g. "html" to "htm", "rar01" to "rar", etc. - and it's not the case for executables anyway (without turning them into non executables, that is). :thumbup:
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
The GhostRider
Posts: 6
Joined: September 29th, 2024, 3:46 pm
Location: 🔥Hell🔥

Re: Monitor Rainmeter Process

Post by The GhostRider »

jsmorley wrote: September 29th, 2024, 7:03 pm So it would likely be a better option than Powershell with this:

Code: Select all

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

[Variables]
Process=msedge.exe

[MeasureFireIt]
Measure=Calc
Formula=1
OnUpdateAction=[!CommandMeasure ProcessInstances "Run"]

[ProcessInstances]
Measure=Plugin
Plugin=RunCommand
Parameter=tasklist | find /I /C "#Process#"
State=Hide
OutputType=ANSI

[InstancesOfProcess]
Meter=String
MeasureName=ProcessInstances
SolidColor=0,255,0,255
AntiAlias=1
Text=Instances Of #Process# = %1
Hi @jsmorley and @Yincognito, thanks for replying and for your help! 😁 Your suggestions have been invaluable. I'm a developer myself, but I've only recently started exploring the world of Rainmeter, and I'm still learning how to make the most of it. I have to say, it's a very interesting and fascinating program, even though a lot of the 'programming' relies on various "workarounds" I might as well call it "WorkaroundMeter"! (Just a bit of ironic humor 😅).

Jokes aside, it really is a great program. As I mentioned earlier, you both were a huge help in getting my skin to the finish line, especially since I was totally stuck with that setting for reading processes. The thing is, I didn't know that "AdvancedCPU" and "PerfMon" were deprecated.
Honestly, I couldn't have imagined it, since I had recently updated Rainmeter. Generally (in programming), when something becomes obsolete or deprecated, it gets removed from updates, so I assumed those plugins were still usable since they were still there.

Anyway, since you were so helpful 🙂, I wanted to share my skin in this 2-minute Youtube Video.
That way (if you're interested or just curious), you can see why I needed to read the "msedge.exe" instances, and I've also given a small overview of other features of my skin while I was at it. 🙂
🔥The GhostRider🔥
Thomas Alva Edison:
I have not failed. I've just found 10,000 ways that won't work.