It is currently May 2nd, 2024, 2:50 am

[v1.0 ready]Skin collection - Some help with testing needed

Get help with creating, editing & fixing problems with skins
User avatar
Saiho
Posts: 46
Joined: September 24th, 2012, 2:11 pm

[v1.0 ready]Skin collection - Some help with testing needed

Post by Saiho »

Below is part of a skin I'm writing that will monitor computer performance (which in turn is part of collection of skins). The idea for this bit is to be able to monitor up to 4 processors and hide/disable unneeded meters/measures. My problem is, as I only have one computer with 2 cores, I can't fully test if it's functional. I've tested as much as I could with fake measures in place of CPU 3 and 4, and it should work in a real situation, but then that's what I've thought about every single thing that didn't work when I tested it. As I'm planning to share this, I'd feel much safer if someone more experienced could take a look at it. I would much appreciate if anyone could
a)look over the code and spot any obvious mistakes, or
b)copy the whole thing to a skin and see if it actually works for 4 processors, whichever is easier.
Any suggestion for improvements is of course very welcome too!

Code: Select all

[Rainmeter]
Update=1000

[Variables]
TintColor=B8B8FFF0

[StyleInfo]
SolidColor=00000001
StringAlign=Center
FontFace=#PrimaryFont#
FontColor=#TintColor#
;StringStyle=Bold
FontSize=9
y=10
Autoscale=1
AntiAlias=1

[StyleLines]
SolidColor=00000001
LineColor=#TintColor#
PrimaryColor=AF333325
w=200
h=50
AntiAlias=1

[Measures]

;====Processors====
[mCores]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\CurrentControlSet\Control\Session Manager\Environment
RegValue=NUMBER_OF_PROCESSORS
UpdateDivider=-1

[mShowCore2]
Measure=Calc
Formula=([mCores]-1)
IfBelowValue=1
IfBelowAction=[!HideMeterGroup gCPU2][!DisableMeasureGroup gmCPU2]
IfAboveValue=0
IfAboveAction=[!ShowMeterGroup gCPU2][!EnableMeasureGroup gmCPU2]
DynamicVariables=1

[mShowCore3]
Measure=Calc
Formula=([mCores]-2)
IfBelowValue=1
IfBelowAction=[!HideMeterGroup gCPU3][!DisableMeasureGroup gmCPU3]
IfAboveValue=0
IfAboveAction=[!ShowMeterGroup gCPU3][!EnableMeasureGroup gmCPU3]
DynamicVariables=1

[mShowCore4]
Measure=Calc
Formula=([mCores]-3)
IfBelowlValue=1
IfBelowValue=1
IfBelowAction=[!HideMeterGroup gCPU4][!DisableMeasureGroup gmCPU4]
IfAboveValue=0
IfAboveAction=[!ShowMeterGroup gCPU4][!EnableMeasureGroup gmCPU4]
DynamicVariables=1

;------------------------------------
[mCPUMaxTemp]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=TjMax
CoreTempIndex=0
UpdateDivider=-1

;------------------------------------
[mCPU1Load]
Measure=CPU
Processor=1

[mCPU1Temp]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=Temperature
CoreTempIndex=0
IfEqualValue=0
IfEqualAction=[!HideMeter CPU1Temp][!HideMeter CPU1TempLine]
IfAboveValue=0
IfAboveAction=[!ShowMeter CPU1Temp][!ShowMeter CPU1TempLine]

[mCPU1TempPercent]
Measure=Calc
Formula=[mCPU1Temp]/[mCPUMaxTemp]
DynamicVariables=1

;------------------------------------
[mCPU2Load]
Measure=CPU
Group=gmCPU2
Processor=2

[mCPU2Temp]
Measure=Plugin
Group=gmCPU2
Plugin=CoreTemp
CoreTempType=Temperature
CoreTempIndex=1
IfEqualValue=0
IfEqualAction=[!HideMeter CPU2Temp][!HideMeter CPU2TempLine]
IfAboveValue=0
IfAboveAction=[!ShowMeter CPU2Temp][!ShowMeter CPU2TempLine]

[mCPU2TempPercent]
Measure=Calc
Group=gmCPU2
Formula=[mCPU2Temp]/[mCPUMaxTemp]
DynamicVariables=1

;------------------------------------
[mCPU3Load]
Measure=CPU
Group=gmCPU3
Processor=3

[mCPU3Temp]
Measure=Plugin
Group=gmCPU3
Plugin=CoreTemp
CoreTempType=Temperature
CoreTempIndex=2
IfEqualValue=0
IfEqualAction=[!HideMeter CPU3Temp][!HideMeter CPU3TempLine]
IfAboveValue=0
IfAboveAction=[!ShowMeter CPU3Temp][!ShowMeter CPU3TempLine]

[mCPU3TempPercent]
Measure=Calc
Group=gmCPU3
Formula=[mCPU3Temp]/[mCPUMaxTemp]
DynamicVariables=1

;------------------------------------
[mCPU4Load]
Measure=CPU
Group=gmCPU4
Processor=4

[mCPU4Temp]
Measure=Plugin
Group=gmCPU4
Plugin=CoreTemp
CoreTempType=Temperature
CoreTempIndex=3
IfEqualValue=0
IfEqualAction=[!HideMeter CPU4Temp][!HideMeter CPU4TempLine]
IfAboveValue=0
IfAboveAction=[!ShowMeter CPU4Temp][!ShowMeter CPU4TempLine]

[mCPU4TempPercent]
Measure=Calc
Group=gmCPU4
Formula=[mCPU4Temp]/[mCPUMaxTemp]
DynamicVariables=1


[Meters]
[CPU1Temp]
Meter=Histogram
MeterStyle=StyleLines
Group=gCPU1
MeasureName=mCPU1TempPercent
x=255
y=42

[CPU1TempLine]
Meter=Line
MeterStyle=StyleLines
Group=gCPU1
MeasureName=mCPU1TempPercent
LineColor=AF3333AF
x=255
y=42

[CPU1Load]
Meter=Line
MeterStyle=StyleLines
Group=gCPU1
MeasureName=mCPU1Load
x=r
y=r

[CPU1Info]
Meter=String
MeterStyle=StyleInfo
Group=gCPU1
MeasureName=mCPU1Load
MeasureName2=mCPU1Temp
x=-23r
y=10r
Text=%1%#CRLF#%2C#CRLF#CPU1

;------------------------------------
[CPU2Temp]
Meter=Histogram
MeterStyle=StyleLines
Group=gCPU2
MeasureName=mCPU2TempPercent
x=582
y=42
GraphStart=Left

[CPU2TempLine]
Meter=Line
MeterStyle=StyleLines
Group=gCPU2
MeasureName=mCPU2TempPercent
LineColor=AF3333AF
x=582
y=42
GraphStart=Left

[CPU2Load]
Meter=Line
MeterStyle=StyleLines
Group=gCPU2
MeasureName=mCPU2Load
x=r
y=r
GraphStart=Left

[CPU2Info]
Meter=String
MeterStyle=StyleInfo
Group=gCPU2
MeasureName=mCPU2Load
MeasureName2=mCPU2Temp
x=23R
y=10r
Text=%1%#CRLF#%2C#CRLF#CPU2

;------------------------------------
[CPU3Temp]
Meter=Histogram
MeterStyle=StyleLines
Group=gCPU3
MeasureName=mCPU3TempPercent
x=255
y=117
Flip=1

[CPU3TempLine]
Meter=Line
MeterStyle=StyleLines
Group=gCPU3
MeasureName=mCPU3TempPercent
LineColor=AF3333AF
x=255
y=117
Flip=1

[CPU3Load]
Meter=Line
MeterStyle=StyleLines
Group=gCPU3
MeasureName=mCPU3Load
x=r
y=r
Flip=1

[CPU3Info]
Meter=String
MeterStyle=StyleInfo
Group=gCPU3
MeasureName=mCPU3Load
MeasureName2=mCPU3Temp
x=-23r
y=-5r
Text=CPU3#CRLF#%2C#CRLF#%1%


;------------------------------------
[CPU4Temp]
Meter=Histogram
MeterStyle=StyleLines
Group=gCPU4
MeasureName=mCPU4TempPercent
x=582
y=117
GraphStart=Left
Flip=1

[CPU4TempLine]
Meter=Line
MeterStyle=StyleLines
Group=gCPU4
MeasureName=mCPU4TempPercent
LineColor=AF3333AF
x=582
y=117
GraphStart=Left
Flip=1

[CPU4Load]
Meter=Line
MeterStyle=StyleLines
Group=gCPU4
MeasureName=mCPU4Load
LineColor=#TintColor#
x=r
y=r
GraphStart=Left
Flip=1

[CPU4Info]
Meter=String
MeterStyle=StyleInfo
Group=gCPU4
MeasureName=mCPU4Load
MeasureName2=mCPU4Temp
x=23R
y=-5r
Text=CPU4#CRLF#%2C#CRLF#%1%
Last edited by Saiho on October 19th, 2012, 2:35 pm, edited 1 time in total.
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [WIP]Skin collection - Some help with testing needed

Post by Brian »

Instead of trying to detect how many cores a user has, try making 2 or 3 versions of the skin. I think that is an easier approach. Not trying to discourage you, as I think it works as intended (I have 8 cores and all 4 of the cpu graphs worked).

I also noticed a lot of padding to the left of the skin, which might be caused because you have used a variable #PrimaryFont# that is not defined anywhere.

You have "labeled" two sections called [Measures] and [Meters]. Rainmeter actually tries to read any line that starts with a "[" and ends in a "]" as a section. Even though in this case Rainmeter will ignore this (because nothing is defined in those sections), it is a bad habit to get into. I would just comment that out with a semicolon ";".

Since I don't have CoreTemp installed I couldn't test those graphs, only the CPU ones - which worked just fine.

On line 58 in the section [mShowCore4], you have IfBelowlValue=1 which needs to be completely deleted since you have the corrected IfBelowValue=1 on line 59.

Other than those small items, I think you are off to a good start.

-Brian
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [WIP]Skin collection - Some help with testing needed

Post by Brian »

Also, you don't need DynamicVariables=1 in your Calc measures. Just drop the brackets and it works the same way. You also don't need parentheses for a simple calculation in a Calc measure.

For example:

Code: Select all

[mShowCore2]
Measure=Calc
Formula=mCores-1
IfBelowValue=1
IfBelowAction=[!HideMeterGroup gCPU2][!DisableMeasureGroup gmCPU2]
IfAboveValue=0
IfAboveAction=[!ShowMeterGroup gCPU2][!EnableMeasureGroup gmCPU2]
And:

Code: Select all

[mCPU1TempPercent]
Measure=Calc
Formula=mCPU1Temp/mCPUMaxTemp
-Brian
User avatar
Saiho
Posts: 46
Joined: September 24th, 2012, 2:11 pm

Re: [WIP]Skin collection - Some help with testing needed

Post by Saiho »

Brian wrote:Instead of trying to detect how many cores a user has, try making 2 or 3 versions of the skin. I think that is an easier approach. Not trying to discourage you, as I think it works as intended (I have 8 cores and all 4 of the cpu graphs worked).
I thought of that, but the same skin also shows hard disk usage and I'm planning to make versions for different numbers of disks instead. Making skins for all combinations of disks and cores would be well... lots of skins :) And since I found in Enigma's code a way to count cores, I figured it would make things a little simpler. (I imagine counting disks would be harder, if not impossible, especially with partitions coming into play.)
Speaking of which, I had no idea where to find the number of processors in the registry, so the [mCores] part is shamelessly stolen from Enigma. I hope it's alright to use it?
Brian wrote:I also noticed a lot of padding to the left of the skin, which might be caused because you have used a variable #PrimaryFont# that is not defined anywhere.
This is actually because as I said, this is part of a bigger skin. The padding is because there's an image and other things included in the left and the font variable is retrieved from an inc file. So this part at least is working as intended :)

I have a tendency to make fewer skins that do a lot of things each, rather than many smaller ones (another one I'm making for the same collection has time, date, weather and reader :oops: ). I'm not sure if that's a good habit in general, but it seems to be working for this set at least.
Brian wrote:You have "labeled" two sections called [Measures] and [Meters]. Rainmeter actually tries to read any line that starts with a "[" and ends in a "]" as a section. Even though in this case Rainmeter will ignore this (because nothing is defined in those sections), it is a bad habit to get into. I would just comment that out with a semicolon ";".
Now that's great to know, thanks for spotting it! I thought variables, meters and measures actually have to be labeled like that, not sure why. I probably misunderstood some part of the manual. So it's only [Rainmeter], [Metadata] and[Variables] that need the brackets or should I omit some of those too?
Brian wrote:Since I don't have CoreTemp installed I couldn't test those graphs, only the CPU ones - which worked just fine.
Those are the ones I was mostly worried about, since the calcs to show/hide them are getting a little too complicated to just type them and declare "it should work". Thank you so much for taking the time to help with this, and for actually reading the whole thing to spot my mistakes, it's really appreciated!
User avatar
Saiho
Posts: 46
Joined: September 24th, 2012, 2:11 pm

Re: [WIP]Skin collection - Some help with testing needed

Post by Saiho »

Also, DynamicVariables are one of those things I have truly conquered yet. If in doubt, I add them and hope. But I'll take your word for it!
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [WIP]Skin collection - Some help with testing needed

Post by Brian »

Saiho wrote:Speaking of which, I had no idea where to find the number of processors in the registry, so the [mCores] part is shamelessly stolen from Enigma. I hope it's alright to use it?
It should be fine to use since it is one of the only ways to really get the number of processors. There may be changes to the SysInfo plugin to address the number of processors in the future, since this is a widely used method. If you want, since you are admitting to using a "feature" from Enigma, you should probably credit Kaelri (the author of Enigma).
Saiho wrote:I have a tendency to make fewer skins that do a lot of things each, rather than many smaller ones (another one I'm making for the same collection has time, date, weather and reader :oops: ). I'm not sure if that's a good habit in general, but it seems to be working for this set at least.
Good, I am glad you have those working for you. Generally it is good practice to have smaller skins that users can load/unload instead of one gigantic skin that includes everything. But this is really just a matter of taste.
Saiho wrote:So it's only [Rainmeter], [Metadata] and[Variables] that need the brackets or should I omit some of those too?
No, all sections need to start with a "[" and end with a "]". The reason you don't need a [Measures] and [Meters] section is because you are already telling Rainmeter what "type" of section is being used with Meter= and Measure=.

As of right now, there are 3 types of sections that are reserved in a Rainmeter skin. [Rainmeter], [Metadata], and [Variables]. Every other section needs a Meter= or Measure=. Anything else is considered a MeterStyle.
Saiho wrote:Also, DynamicVariables are one of those things I have truly conquered yet. If in doubt, I add them and hope. But I'll take your word for it!
No worries, I still find myself doing that from time to time.

Good luck!

-Brian
User avatar
spx
Developer
Posts: 686
Joined: August 15th, 2009, 2:41 pm
Location: Osaka, JPN

Re: [WIP]Skin collection - Some help with testing needed

Post by spx »

Brian wrote: It should be fine to use since it is one of the only ways to really get the number of processors. There may be changes to the SysInfo plugin to address the number of processors in the future, since this is a widely used method.
Use %NUMBER_OF_PROCESSORS% instead of that registry value. It's a environment variable.
User avatar
Saiho
Posts: 46
Joined: September 24th, 2012, 2:11 pm

Re: [WIP]Skin collection - Some help with testing needed

Post by Saiho »

Brian wrote:If you want, since you are admitting to using a "feature" from Enigma, you should probably credit Kaelri (the author of Enigma).
Absolutely! You're all getting credit for the help when I'm done with this little project and have it ready to upload :)
spx wrote:Use %NUMBER_OF_PROCESSORS% instead of that registry value. It's a environment variable.
Not sure I understand this. Do I use it instead of something else in the measure that counts cores or can I just insert it as a variable anywhere in any skin?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: [WIP]Skin collection - Some help with testing needed

Post by Kaelri »

Saiho wrote:Not sure I understand this. Do I use it instead of something else in the measure that counts cores or can I just insert it as a variable anywhere in any skin?
You can use it anywhere as a variable, just like #Variable#. (Thanks, spx, I didn't know about that one. :)
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [WIP]Skin collection - Some help with testing needed

Post by jsmorley »

It is worth going out to a cmd prompt and typing "Set". That will give you the complete list of available environment variables. There are quite a few that can be useful, and they can be used just like any variable in Rainmeter, only with %VARNAME% instead of #VARNAME#.