It is currently April 20th, 2024, 10:11 am

[Very basic] Different update frequences, why?

Get help with creating, editing & fixing problems with skins
ichbinsinaction
Posts: 5
Joined: February 2nd, 2017, 12:10 pm

[Very basic] Different update frequences, why?

Post by ichbinsinaction »

For all of you, this will be very basic. I want to edit the basic Network skin so that it shows me my ping instead of my IP.

For this, I took following code:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,255
[MeasurePing]
Measure=Plugin
Plugin=PingPlugin
DestAddress=www.google.com
[MeterPing]
Meter=String
MeasureName=MeasurePing
X=5
Y=5
W=200
H=20
FontColor=255,255,255,255
Text=google.com: %1ms
getting this:

Code: Select all

; Lines starting ; (semicolons) are commented out.
; That is, they do not affect the code and are here for demonstration purposes only.
; ----------------------------------

[Rainmeter]
; This section contains general settings that can be used to change how Rainmeter behaves.
Update=1000
Background=#@#Background.png
; #@# is equal to Rainmeter\Skins\illustro\@Resources
BackgroundMode=3
BackgroundMargins=0,34,0,14

[Metadata]
; Contains basic information of the skin.
Name=Network
Author=poiru
Information=Shows your Ping and network activity.
License=Creative Commons BY-NC-SA 3.0
Version=1.0.0

[Variables]
; Variables declared here can be used later on between two # characters (e.g. #MyVariable#).
fontName=Trebuchet MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205
maxDownload=2840000
MaxUpload=360000
; Set maxDownload and maxUpload to your maximum download and upload speed in bits.
; To convert kilobits, megabits, kilobytes, and megabytes into bits, go to www.google.com
; and search for something like "10 megabytes in bits".

; ----------------------------------
; MEASURES return some kind of value
; ----------------------------------


[MeasurePing]
Measure=Plugin
Plugin=PingPlugin
DestAddress=www.google.com

[measureNetIn]
Measure=NetIn
NetInSpeed=#maxDownload#
; NetInSpeed must be set so your maximum download speed for the download bar to scale correctly

[measureNetOut]
Measure=NetOut
NetOutSpeed=#maxUpload#

; ----------------------------------
; STYLES are used to "centralize" options
; ----------------------------------

[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=Left
; Meters using styleLeftText will be left-aligned.
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleBar]
BarColor=#colorBar#
BarOrientation=HORIZONTAL
SolidColor=255,255,255,15

[styleSeperator]
SolidColor=255,255,255,15

; ----------------------------------
; METERS display images, text, bars, etc.
; ----------------------------------

[meterTitle]
Meter=String
MeterStyle=styleTitle
; Using MeterStyle=styleTitle will basically "copy" the
; contents of the [styleTitle] section here during runtime.
X=100
Y=12
W=190
H=18
Text=Network
; Even though the text is set to Network, Rainmeter will display
; it as NETWORK, because styleTitle contains StringCase=Upper.

[meterPingLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=40
W=190
H=14
Text=Ping

[meterPingValue]
Meter=String
MeterStyle=styleRightText
MeasureName=MeasurePing
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1ms
; %1 stands for the value of MeasureName (measureIP in this case).

[meterSeperator]
Meter=Image
MeterStyle=styleSeperator
X=10
Y=52
W=190
H=1

[meterUploadLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=60
W=190
H=14
Text=Upload

[meterUploadValue]
Meter=String
MeterStyle=styleRightText
MeasureName=measureNetOut
X=200
Y=0r
W=190
H=14
Text=%1B/s
NumOfDecimals=1
AutoScale=1
; Because NetOut returns the current upload speed in bytes, we must use AutoScale=1 to
; automatically scale the value into a more readable figure.

[meterUploadBar]
Meter=Bar
MeterStyle=styleBar
MeasureName=measureNetOut
X=10
Y=72
W=190
H=1

[meterDownloadLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=80
W=190
H=14
Text=Download

[meterDownloadValue]
Meter=String
MeterStyle=styleRightText
MeasureName=measureNetIn
X=200
Y=0r
W=190
H=14
Text=%1B/s
NumOfDecimals=1
AutoScale=1

[meterDownloadBar]
Meter=Bar
MeterStyle=styleBar
MeasureName=measureNetIn
X=10
Y=92
W=190
H=1
Now, after including it in the skin code, it works and it looks good, BUT the ping does only refresh every 30 seconds, while the Upload/Download values refresh every second.
Even after searching for a long time, I don't understand why. The main update frequency is 1000ms, why does it differ for the ping then?
Can anybody help me?
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: [Very basic] Different update frequences, why?

Post by mak_kawa »

Insert a line UpdateRate=1 to the MeasurePing.

Default UpdateRate of PingPlugin is 32, means that the measure is updated every 1000*32 ms = 32 seconds.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Very basic] Different update frequences, why?

Post by jsmorley »

Why would you ever check your ping once a second? Bit of a waste of bandwidth in my view.
ichbinsinaction
Posts: 5
Joined: February 2nd, 2017, 12:10 pm

Re: [Very basic] Different update frequences, why?

Post by ichbinsinaction »

mak_kawa wrote:Insert a line UpdateRate=1 to the MeasurePing.

Default UpdateRate of PingPlugin is 32, means that the measure is updated every 1000*32 ms = 32 seconds.
Thank you very much, now it works just fine. :)
ichbinsinaction
Posts: 5
Joined: February 2nd, 2017, 12:10 pm

Re: [Very basic] Different update frequences, why?

Post by ichbinsinaction »

jsmorley wrote:Why would you ever check your ping once a second? Bit of a waste of bandwidth in my view.
I don't think this affects the bandwith at all, but if it did, I could also set it to 3 seconds or so. 30 seconds (or 32 as makkawa just wrote) is just too much.

Btw, many games have a ping refresh rate of a second, so I really doubt this affects performance...
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Very basic] Different update frequences, why?

Post by jsmorley »

Well, be careful. If the site you are pinging is down, the default Timeout value of 30000 milliseconds (30 seconds at an Update of 1000) will cause the plugin to get in a mode of starting a ping "thread", waiting 1 second, terminating the thread with extreme prejudice, and starting another one, while never registering that the ping actually ever "failed".

You might want to get the UpdateRate and Timeout values into line to be sure you don't end up with the plugin getting unstable. By default the UpdateRate is 32 (32000ms at Update=1000) and the Timeout is 30000ms, so they don't step on each other.
ichbinsinaction
Posts: 5
Joined: February 2nd, 2017, 12:10 pm

Re: [Very basic] Different update frequences, why?

Post by ichbinsinaction »

Good to know, although to be honest, I have to admit that I have no idea what that does mean... Two seconds then?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Very basic] Different update frequences, why?

Post by jsmorley »

ichbinsinaction wrote:Good to know, although to be honest, I have to admit that I have no idea what that does mean... Two seconds then?
I'm just saying that if you want to use an UpdateRate of 1 (1000ms at a skin Update of 1000), it might be wise to set the Timeout value to 800 or 900 or something just a bit less than 1000, so if the site is "down", it has enough time to register that the ping has "failed" before starting another one.

To each his own, but I am of the opinion that a single "ping" is of no value at all, other than an indication of the site in question being "reachable" or "unreachable". I don't think a single ping tells you anything at all of value concerning network latency or other performance data. I would never waste the resources, minimal or not, to do a single stand-alone ping once a second. Even the default ping command in cmd.exe does 4 pings and gives you an average, which has at least some minimal value. I think the intent of the Ping plugin in Rainmeter is to check if a server is "up", and while it's good for that, I don't think it has a lot of other value.
ichbinsinaction
Posts: 5
Joined: February 2nd, 2017, 12:10 pm

Re: [Very basic] Different update frequences, why?

Post by ichbinsinaction »

jsmorley wrote:I'm just saying that if you want to use an UpdateRate of 1 (1000ms at a skin Update of 1000), it might be wise to set the Timeout value to 800 or 900 or something just a bit less than 1000, so if the site is "down", it has enough time to register that the ping has "failed" before starting another one.

To each his own, but I am of the opinion that a single "ping" is of no value at all, other than an indication of the site in question being "reachable" or "unreachable". I don't think a single ping tells you anything at all of value concerning network latency or other performance data. I would never waste the resources, minimal or not, to do a single stand-alone ping once a second. Even the default ping command in cmd.exe does 4 pings and gives you an average, which has at least some minimal value. I think the intent of the Ping plugin in Rainmeter is to check if a server is "up", and while it's good for that, I don't think it has a lot of other value.
Well, we use a 6Mbit connection getting around 2.8Mbit (the maximum we can get over here), which is divided for five people using the internet.
The main use for the ping is to know if somebody else is downloading (the ping instantly goes up to 200-1000ms for a few seconds) or if a site doesn't work properly. Even when somebody is using the phone, the ping goes up.

In the past, I only used the upload/download monitor to know if there is something downloading in the background, but if a game is lagging, for example, I would like to know if it's the game, if it is something downloading in the background, or if my ping is too high for whatever reason.

But if I am wrong (which could be the easily the case), can you explain me why a lower setting does solve the error from a ping exceeding the time limit (one second) or not coming back? If the ping was 1000ms, how would this work out?