It is currently April 8th, 2020, 11:37 pm

Odd timing with Update/UpdateRate

Help with creating, editing & fixing problems with skins
Wallboy
Posts: 69
Joined: October 1st, 2012, 4:53 am

Odd timing with Update/UpdateRate

Post by Wallboy »

I'm curious to how accurate Update/UpdateRate actually is. I'm currently working with a low Update of 20 in the [Rainmeter] section of my skin, so I adjusted my WebParser's UpdateRate to 3000 so that it would grab the feed every 60 seconds. Also put UpdateDivider=1 manually on it. I have a FinishAction to run a script, and in that script I have a print("Updating...") statement to tell me every time it runs. I would expect in the Log to see it print that statement every 60 seconds. However, it seems to only run every ~90-95 seconds according to the Time in the Log.

Code: Select all

Debug 00:33:53.130 Updating...
Debug 00:32:18.624 Updating...
Debug 00:30:44.103 Updating...
I've read that the update can take longer if the computer is busy or it's a complicated skin, but every meter in my skin has a UpdateDivider=-1 on it, those get updated manually. And I've checked Process Explorer and the skin uses virtually 0.00% CPU inbetween Feed Updates. So I'm not sure why my feed takes an extra ~30 seconds to update.

Update x UpdateDivider x UpdateRate / 1000

20 * 1 * 3000 / 1000 = 60

Pretty sure my math is right. What might the problem be?

Edit: I should also note that with the default Update=1000 and a UpdateRate=60, it does update the feed every ~60 seconds.
User avatar
jsmorley
Developer
Posts: 20460
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Odd timing with Update/UpdateRate

Post by jsmorley »

The one thing I would point out is that as I understand it, it isn't just about "how much work the skin does", but rather "how much work all loaded skins do" between each update that can play a role in how reliable Update is when set very low. Still, I am surprised to see that much difference. Not sure, I think maybe poiru might need to weigh in on this one.
Wallboy
Posts: 69
Joined: October 1st, 2012, 4:53 am

Re: Odd timing with Update/UpdateRate

Post by Wallboy »

All other skins are turned off, With Update of 1000 and UpdateRate of 60, I get a feed update every 60 seconds, 62 max. With the other fast update settings, there's a 30 second delay. And again, watching in Process Explorer, Rainmeter uses virtually 0.00% CPU between feed updates, and the print() message is the first statement in the called script.
Wallboy
Posts: 69
Joined: October 1st, 2012, 4:53 am

Re: Odd timing with Update/UpdateRate

Post by Wallboy »

Was messing around with this again and made this little test skin that I would like some of you guys to try. It has an Update of 20 and a single measure that just keeps counting to 1000 and displaying a message in the Log each time it completes. You would expect to see the message every 20 seconds (20 * 1000 = 20000ms). However on my PC I get the message to the Log every ~30 seconds. I'm curious if this differs from PC to PC or if low Update settings are just really inaccurate in Rainmeter.

I've included the test skin:
You do not have the required permissions to view the files attached to this post.
User avatar
moshi
Posts: 1850
Joined: November 13th, 2012, 9:53 pm

Re: Odd timing with Update/UpdateRate

Post by moshi »

my guess would be that WebParsers's count to the next update starts after finish. else it would have the capability to "auto-hiccup". UpdateRate =\= UpdateDivider
Wallboy
Posts: 69
Joined: October 1st, 2012, 4:53 am

Re: Odd timing with Update/UpdateRate

Post by Wallboy »

It's nothing to do with WebParser as tested in my previous post with the test skin on just a plain calc measure.
User avatar
moshi
Posts: 1850
Joined: November 13th, 2012, 9:53 pm

Re: Odd timing with Update/UpdateRate

Post by moshi »

Mr. Morley needs to write a sticky post on why Rainmeter isn't used at the Olympics. ;)
Wallboy
Posts: 69
Joined: October 1st, 2012, 4:53 am

Re: Odd timing with Update/UpdateRate

Post by Wallboy »

I know Rainmeter is not meant to be accurate for precise timekeeping things. And if it was a matter of a few percent off, who cares. But we're talking roughly between 30-50% discrepancy for when you would expect the update to happen. Also for all I know it's just a problem on my end.

For my original post I just use a UpdateRate of 2000 which on my system makes it update every 1 minute. I'll look into the Rainmeter source as well and see if I can figure out whats going on. :???:
Last edited by Wallboy on August 26th, 2014, 11:26 pm, edited 1 time in total.
User avatar
iNjUST
Posts: 118
Joined: June 20th, 2012, 12:44 am

Re: Odd timing with Update/UpdateRate

Post by iNjUST »

Wallboy wrote:Was messing around with this again and made this little test skin that I would like some of you guys to try. It has an Update of 20 and a single measure that just keeps counting to 1000 and displaying a message in the Log each time it completes. You would expect to see the message every 20 seconds (20 * 1000 = 20000ms). However on my PC I get the message to the Log every ~30 seconds. I'm curious if this differs from PC to PC or if low Update settings are just really inaccurate in Rainmeter.

I've included the test skin:
I'm experiencing similar results. Your Update Test skin produced logs on average every 31 seconds for me, despite intended to trigger every 20 seconds.

The ironic part is at Update=30, it still updates on average every 30-31 seconds (intended 30 seconds).
At Update=10, it takes about 16-17 seconds (intended 10 seconds).
And when you reverse the design: Update=1000, Counter up to 20; it updates consistently every 20-21 seconds as intended.

Setting Rainmeter.exe priority to Realtime seems to offer no improvements.

Definitely seems like a finite limitation on Raimeter's update frequency, and rather arbitrary at that.

EDIT: FYI, I ran this skin independently, nothing else loaded.
Wallboy
Posts: 69
Joined: October 1st, 2012, 4:53 am

Re: Odd timing with Update/UpdateRate

Post by Wallboy »

Alright, after digging around Rainmeter source, I found out what was going on. Rainmeter uses SetTimer() and a WM_TIMER event to determine when to update based off what Update value you have set in [Rainmeter]. The problem is with the resolution of SetTimer() being at best 10ms on Windows NT and greater. And you have to take into consideration anything else in the Windows Message queue that has to be processed first.

So when your Update can differ +-10ms or more and you have a really low Update setting -- that value multiplied by any large UpdateRate/UpdateDivider could show a large deviation from when you'd expect the update to happen.

There are more accurate timers than SetTimer() which are multimedia timers, but come at a cost of being more CPU expensive and is probably why they weren't used for Rainmeter as most skins don't use such low Update settings in [Rainmeter].

Basically, if your Update in [Rainmeter] is less than ~30, be prepared to use arbitrary UpdateDividers/UpdateRate to figure out when your measure/meter is actually updating.