It is currently May 19th, 2022, 4:26 pm

Ping plugin suggestion and question

Report bugs with the Rainmeter application and suggest features.
ronzino
Posts: 19
Joined: June 4th, 2020, 4:41 pm

Ping plugin suggestion and question

Post by ronzino »

The question
How many ping packets are shoot when the ping measure is called once ? Just one packet or it is a sort of average made on how many of them ?

The suggestions
- I think it will be useful to add the answer above in the documentation
- It would be useful to have options to specify how many ping packets are producet per single measure run and how often they are produced before the measure is completed and give back the result (that can should be the minimun, or the maximum or the average value). This will offer a good granularity for diagnostic purposes, like the command line interface command offers.
User avatar
Yincognito
Rainmeter Sage
Posts: 4694
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Ping plugin suggestion and question

Post by Yincognito »

ronzino wrote: March 26th, 2022, 12:13 pm The question
How many ping packets are shoot when the ping measure is called once ? Just one packet or it is a sort of average made on how many of them ?

The suggestions
- I think it will be useful to add the answer above in the documentation
- It would be useful to have options to specify how many ping packets are producet per single measure run and how often they are produced before the measure is completed and give back the result (that can should be the minimun, or the maximum or the average value). This will offer a good granularity for diagnostic purposes, like the command line interface command offers.
Just for reference, Wireshark (free software) can easily tell you that:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255

---Measures---

[Ping]
Measure=Plugin
Plugin=PingPlugin
DestAddress=8.8.8.8
UpdateRate=-1
Timeout=9990
TimeoutValue=9990

---Meters---

[MeterTest]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
Text="Ping"
UpdateDivider=-1
DynamicVariables=1
Ping.jpg
You do not have the required permissions to view the files attached to this post.
ronzino
Posts: 19
Joined: June 4th, 2020, 4:41 pm

Re: Ping plugin suggestion and question

Post by ronzino »

Thanks for your help. Yes I know about wire shark I have used a bit, but more than 10y ago, and the learning curve was not so fast.

Asking here was for sure faster :D

I wonder, looking at your example, as the updaterate is - 1 the measure is runned just once at the first scan cycle if the measure is also able to perform the option "finish action" or not. I am asking this because this execution should be async as the updaterate is negative and the conclusion of ping will occur in another scan cycle different by the very first one
User avatar
Yincognito
Rainmeter Sage
Posts: 4694
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Ping plugin suggestion and question

Post by Yincognito »

ronzino wrote: March 26th, 2022, 1:41 pm Thanks for your help. Yes I know about wire shark I have used a bit, but more than 10y ago, and the learning curve was not so fast.

Asking here was for sure faster :D

I wonder, looking at your example, as the updaterate is - 1 the measure is runned just once at the first scan cycle if the measure is also able to perform the option "finish action" or not. I am asking this because this execution should be async as the updaterate is negative and the conclusion of ping will occur in another scan cycle different by the very first one
Yeah, no problem. The finish action will be executed either way, when a value is successfully returned or the timeout has passed. It has nothing to do with the update rate, that's only there to make sure I capture a single measure execution. This is true for other similar measures like WebParser, by the way, though error exceptions are handled a bit differently.
ronzino
Posts: 19
Joined: June 4th, 2020, 4:41 pm

Re: Ping plugin suggestion and question

Post by ronzino »

Yincognito wrote: March 26th, 2022, 1:57 pm Yeah, no problem. The finish action will be executed either way, when a value is successfully returned or the timeout has passed. It has nothing to do with the update rate, that's only there to make sure I capture a single measure execution..
mmm i don't know maybe (or let me say for sure) I am doing something wrong but it does not seem to work.

if i set UpdateRate=-1 on ping measure, the with an action on a meter i perform UpdateMeasure Ping, the ping is measured correctly but the FinishAction is never performed.

Here a snippet of code. The purpose of this code is to run a ping every 30 seconds. When the ping command is executed the variable TestingPing shall be set to 1 and as soon as the ping measurment is completed it shell be set to 0.
Running this code, the ping is executed at the very beginning (first scan cycle) but the variable Testing ping never goes back to 0

Code: Select all


[Rainmeter]
Update = 100

[Variables]
DividerVarPing=300
TestingPing=0


[Ping_Timer]
Measure=calc
OnUpdateAction=[!SetVariable TestingPing 1][!UpdateMeasure Ping]
DynamicVariables=1
UpdateDivider=#DividerVarPing#


[Ping]
Measure=Plugin
Plugin=PingPlugin
DestAddress=www.google.com
UpdateRate=-1
FinishAction=[!SetVariable TestingPing 0]

ronzino
Posts: 19
Joined: June 4th, 2020, 4:41 pm

Re: Ping plugin suggestion and question

Post by ronzino »

I think I have found a bug or glitch

setting this to ping measrue works

UpdateRate=1
UpdateDivider=-1

SO I wonder if the UpdateRate is well explained here

https://docs.rainmeter.net/tips/update-guide/

beacuse it seems to me that this formula (Update x UpdateDivider x UpdateRate / 1000) is not correct
and that updaterate acts as an measure invocation counter. when this expire the measure is perfomed
User avatar
Yincognito
Rainmeter Sage
Posts: 4694
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Ping plugin suggestion and question

Post by Yincognito »

ronzino wrote: March 27th, 2022, 11:35 am I think I have found a bug or glitch

setting this to ping measrue works

UpdateRate=1
UpdateDivider=-1

SO I wonder if the UpdateRate is well explained here

https://docs.rainmeter.net/tips/update-guide/

beacuse it seems to me that this formula (Update x UpdateDivider x UpdateRate / 1000) is not correct
and that updaterate acts as an measure invocation counter. when this expire the measure is perfomed
It's a glitch alright, but not a bug, actually - it's how this measure works. As a matter of fact, this was one of my earliest questions after I became a member here on the forum, and jsmorley (one of the developers and the one managing the forum stuff) clarified things with a similar answer, which I obviously applied to my skin using Ping as well. Thing is, a long time has passed since then, plus I had no idea what you wanted to test out, so I didn't mention it. The solution is like this (I used logging here instead of setting a variable as it's cleaner for these kind of tests):

Code: Select all

[Variables]

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255

---Measures---

[Ping]
Measure=Plugin
Plugin=PingPlugin
DestAddress=www.google.com
UpdateRate=-1
FinishAction=[!Log "Finished"]
DynamicVariables=1

[Ping_Timer]
Measure=Calc
UpdateDivider=3
OnUpdateAction=[!Log "Starting"][!SetOption Ping UpdateRate 0][!UpdateMeasure Ping][!SetOption Ping UpdateRate -1]
DynamicVariables=1

---Meters---

[Text]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
Text=Ping - Watch The Log
DynamicVariables=1
So, basically, you have to temporarily set the update rate to 0 before you set it back to the desired value (no updating of the measure the second time), in order to "manually" trigger the measure in such a case. Well, it's more or less something you discovered too - I'm just recalling what the solution to such a situation was from the developers.

Let's call it a particularity present only for the Ping measure, apparently.

EDIT: Found the thread - take a look here. Didn't get things quite properly back then, in some cases, overcomplicating the matter, but folks were patient and it seems it paid off... :oops:
ronzino
Posts: 19
Joined: June 4th, 2020, 4:41 pm

Re: Ping plugin suggestion and question

Post by ronzino »

Oh yes that is exactly the same thing. I have searched the forum but unfortunatly did not find that thread.

In my opionion this from Jsmorley user must be written in the user guide

"The Ping plugin is driven by an UpdateRate internal counter, much like WebParser is. This counter is an internal loop from 0 to the value of UpdateRate on the measure, incremented by 1 on each update of the measure. It will execute the ping when the counter it is tracking is 0, which it is on the first update, and on the next update each time it reaches the value of UpdateRate, which has a default of 32. So by default, it will ping on load/refresh and then each 32 skin "updates", which with Update=1000 is every 32 seconds."

It should be written there beacuse explains very well that UpdateRate is a timer that runs from ZERO to the user specified number. THAT IS WHY it cannot be set to -1. And that is why the formula in the user documentation
Update x UpdateDivider x UpdateRate is totaly miss leading: actualy it gives the elapsed time betweeb two consecutive trigger, but the ping plugin does not run in that way, and infact setting UpdateDivider to -1 triggers the glitch.

Thankyou very much for your help :great:
User avatar
Yincognito
Rainmeter Sage
Posts: 4694
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Ping plugin suggestion and question

Post by Yincognito »

ronzino wrote: March 27th, 2022, 12:30 pm Oh yes that is exactly the same thing. I have searched the forum but unfortunatly did not find that thread.

In my opionion this from Jsmorley user must be written in the user guide

"The Ping plugin is driven by an UpdateRate internal counter, much like WebParser is. This counter is an internal loop from 0 to the value of UpdateRate on the measure, incremented by 1 on each update of the measure. It will execute the ping when the counter it is tracking is 0, which it is on the first update, and on the next update each time it reaches the value of UpdateRate, which has a default of 32. So by default, it will ping on load/refresh and then each 32 skin "updates", which with Update=1000 is every 32 seconds."

It should be written there beacuse explains very well that UpdateRate is a timer that runs from ZERO to the user specified number. THAT IS WHY it cannot be set to -1. And that is why the formula in the user documentation
Update x UpdateDivider x UpdateRate is totaly miss leading: actualy it gives the elapsed time betweeb two consecutive trigger, but the ping plugin does not run in that way, and infact setting UpdateDivider to -1 triggers the glitch.

Thankyou very much for your help :great:
No problem. ;-)
Yeah, this could be very well be in the manual indeed, since this behavior is specific to the Ping measure (WebParser, for example, doesn't have this particularity - click to see it in action in the log):

Code: Select all

[Variables]

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255

---Measures---

[Google]
Measure=WebParser
URL=https://www.google.com
RegExp=(?siU)^(.*)$
UpdateRate=-1
FinishAction=[!Log "Finished"][!UpdateMeter Text][!Redraw]
OnConnectErrorAction=[!Log "Connect Error"][!UpdateMeter Text][!Redraw]
OnRegExpErrorAction=[!Log "RegExp Error"][!UpdateMeter Text][!Redraw]
DynamicVariables=1

[All]
Group=GoogleGroup
Measure=WebParser
Url=[Google]
StringIndex=1
UpdateDivider=-1
DynamicVariables=1

---Meters---

[Text]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
Text=Google - Watch The Log
UpdateDivider=-1
LeftMouseUpAction=[!Log "Starting"][!CommandMeasure Google "Update"]
DynamicVariables=1
I guess not many use the Ping measure to make it an absolute necessity though... :confused:

P.S. Yeah, that thread is from 2015, so it's a bit difficult to find. Easier for me since I was the OP in that case. :D