It is currently September 29th, 2024, 3:36 pm

Manually input CPU Min/Max Usage Values

General topics related to Rainmeter.
F4lconF16
Posts: 2
Joined: January 31st, 2014, 8:49 am

Manually input CPU Min/Max Usage Values

Post by F4lconF16 »

The topic says it, really. Is there any way to manually input CPU Min/Max usage values for use in various meters?

For instance, if I wanted to have a roundline meter that only displayed a value when the CPU usage got up to a certain percentage (say 50% load), could I set the Min/Max values for the CPU measure to be equal to 50 and 100 (or at least set the meter to interpret it as such)? That way it would display 50% when CPU load was at 75%, if you get what I'm saying.

I'm kinda interested in creating some sort of "alarm" style thing for stress testing, where meters start popping up whenever the CPU loads and temp go above a certain point, turning bright red, triggering siren sounds, just general obnoxiousness to stick on a buddy's computer when she's not looking and so it freaks her out when her comp heats up :sly:
User avatar
Mordasius
Posts: 1178
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Manually input CPU Min/Max Usage Values

Post by Mordasius »

I have a skin that changes the transparency of a full-screen blood effect meter as the CPU load increases.

Code: Select all

[mCPU0]
Measure=CPU
Processor=0
IfCondition=mCPU0 <=15
IfTrueAction=[!SetOption MtCpuAlert ImageAlpha 0] [!UpdateMeter MtCpuAlert ] [!Redraw]
IfCondition2=(mCPU0 > 15 ) && (mCPU0 <= 30)
IfTrueAction2=[!SetOption MtCpuAlert ImageAlpha 40]  [!UpdateMeter MtCpuAlert ] [!Redraw]
IfCondition3=(mCPU0 > 30 ) && (mCPU0 <= 50)
IfTrueAction3=[!SetOption MtCpuAlert ImageAlpha 80]  [!UpdateMeter MtCpuAlert ] [!Redraw]
IfCondition4=(mCPU0 >50 ) && (mCPU0 <= 70)
IfTrueAction4=[!SetOption MtCpuAlert ImageAlpha 120]  [!UpdateMeter MtCpuAlert ] [!Redraw]
IfCondition5=(mCPU0 >70 ) && (mCPU0 <= 85)
IfTrueAction5=[!SetOption MtCpuAlert ImageAlpha 180]  [!UpdateMeter MtCpuAlert ] [!Redraw]
IfCondition6=mCPU0 > 85
IfTrueAction6=[!SetOption MtCpuAlert ImageAlpha 255]  [!UpdateMeter MtCpuAlert ] [!Redraw]

[MtCpuAlert]
Meter=IMAGE
ImageName=#@#Images\bloodeffect\b1
W=1564
H=1034
ImageAlpha=0
UpdateDivider=-1
This example uses IfConditions to change the image alpha but you could use !ShowMeter / !HideMeter bangs to show or hide different meters or !SetOption to change other meter options depending on CPU usage.
You do not have the required permissions to view the files attached to this post.
F4lconF16
Posts: 2
Joined: January 31st, 2014, 8:49 am

Re: Manually input CPU Min/Max Usage Values

Post by F4lconF16 »

Thanks!
Not quite what I was originally thinking, but I'll definitely use that as well. I like the idea of the screen slowly dying as the computer struggles. It does make me realize there might be another way to do what I was thinking, too.

Something along the lines of:

Code: Select all

[Variables]
GraphPercent=0

[mCPU]
Measure=CPU
IfCondition=mCPU <=25
IfTrueAction=[!SetVariable GraphPercent 25] [!UpdateMeter MGraphPercent] [!Redraw]
IfCondition2=(mCPU > 25 ) && (mCPU <= 50)
IfTrueAction2=[!SetVariable GraphPercent 50] [!UpdateMeter MGraphPercent] [!Redraw]
IfCondition3=(mCPU > 50 ) && (mCPU <= 50)
IfTrueAction3=[!SetVariable GraphPercent 25] [!UpdateMeter MGraphPercent] [!Redraw]
IfCondition4=(mCPU0 >50 ) && (mCPU0 <= 75)
IfTrueAction4=[!SetVariable GraphPercent 75] [!UpdateMeter MGraphPercent] [!Redraw]
IfCondition5=(mCPU0 >100)
IfTrueAction5=[!SetVariable GraphPercent 100] [!UpdateMeter MGraphPercent ] [!Redraw]

[MGraphPercent]
Meter=Roundline
MeasureName=GraphPercent
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#Red#
AntiAlias=1
No idea if I did this right, but I'll work it out. Thanks for the help, I'm really new to all of this.

Edit: I missed where you said to use !SetOption. I think that should work, I'll test that tonight instead of the above code.
Last edited by smurfier on January 31st, 2014, 9:28 pm, edited 1 time in total.
Reason: Changed snippet tags to code tags.