Bleedin Posted April 7, 2013 Report Posted April 7, 2013 Hello Pete! I have a question about the Lua ipc.sleep function. I have noticed that longer "sleeps" seems a bit shorter than they should. For instance “a sleep” with a duration of 60 000 ms only lasts about 54 seconds. First I thought that it might be something wrong with my environment but after have tried it on another computer I can say it behaves the same way. Any idea about the reason for this? Thanks for a otherwise excellent product. Best regards Bleedin
Pete Dowson Posted April 7, 2013 Report Posted April 7, 2013 I have a question about the Lua ipc.sleep function. I have noticed that longer "sleeps" seems a bit shorter than they should. For instance “a sleep” with a duration of 60 000 ms only lasts about 54 seconds. They simply call the Windows "sleep()" function, but they do it in a loop with "sleep(9)" interspersed with checks on whether the user (or FSUIPC through an aircraft change) has tried to 'kill' it. Each Sleep(9) is deducted from the total needed by 10, allowing 1 millisecond for process/thread switching and abort testing. This works very well for shorter intervals and on less capable PCs with a lot going on, but on a powerful system with less going in it may induce as much as the 10% difference you've noticed. This might be much more likely on an FS9 installation which loads the PC so much less than FSX. Do you need great accuracy? I could probably implement an accurate one based on the microsecond timer instead, but for 99.9% of uses this is over the top, and would certainly result in a minimum delay of more than the current code allows. I won't be changing FSUIPC3 for such a requirement, but FSUIPC4 and WideClient are still open to small changes when needed. Just give me a good reason, please. Note that even with a more accurate system, other factors could still contrive to make the interval longer than requested. Regards Pete
Bleedin Posted April 7, 2013 Author Report Posted April 7, 2013 Thanks for the quick reply. I'm actually using FSX but on a rather powerful rig (i7@5ghz). I'm using the sleep function in a custom lib that plays sounds to a Teamspeak channel. The “play-function” returns the sound files duration witch I used in a ipc.sleep. I noticed the problem when new sounds began playing before the previous sound had finished. I guess I can solve this by multiply the duration by 1.1- but that will maybe get me new possible problems? Best regards Bleedin
Pete Dowson Posted April 7, 2013 Report Posted April 7, 2013 I guess I can solve this by multiply the duration by 1.1- but that will maybe get me new possible problems? I wouldn't have thought so, but I'll release an updated FSUIPC4 which is more accurate with Sleeps with larger values. Give me a few minutes ... ... BTW, how did you get your i7 stable at 5GHz? I'm running at 4.8GHz. It will go to 4.9 but is a little unstable then. I guess i need better tweaking somewhere. It was a specially selected processor, higher price. Pete
Bleedin Posted April 7, 2013 Author Report Posted April 7, 2013 Fantastic! Thanks Pete. You're the best. /Bleedin
Pete Dowson Posted April 7, 2013 Report Posted April 7, 2013 I wouldn't have thought so, but I'll release an updated FSUIPC4 which is more accurate with Sleeps with larger values. Give me a few minutes ... Get this and let me know, please, before I release it. FSUIPC4869.zip ... BTW, how did you get your i7 stable at 5GHz? I'm running at 4.8GHz. It will go to 4.9 but is a little unstable then. I guess i need better tweaking somewhere. It was a specially selected processor, higher price. Pete
Bleedin Posted April 7, 2013 Author Report Posted April 7, 2013 Work like a charm. Thank you! I run a Intel Core i7 2700K @ 5GHz with a Corsair H80 cooler on a Asus Sabertooth Z77. No stability issues whatsoever. I'm not sure if it's good hardware or just plain luck. Best regards Bleedin
Pete Dowson Posted April 7, 2013 Report Posted April 7, 2013 I run a Intel Core i7 2700K @ 5GHz with a Corsair H80 cooler on a Asus Sabertooth Z77. No stability issues whatsoever. I'm not sure if it's good hardware or just plain luck. Luck with the processor I guess. Mine is not quite as up to date as yours. H100 cooler, but Asus Maximus Extreme P67. Maybe it's the Z77 chipset. Ah well. I doubt I'd really notice the difference between 4.8 and 5.0 -- it was just a magic number I originally targetted. ;-) Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now