February 11th, 2000, 01:26 AM
It is really possible to control the execution speed on various computers using the Sleep API. But can someone go even better than this, like nano-, picoseconds, etc. Any cheeky technique.
|
Click to See Complete Forum and Search --> : Speed Control finer than milliseconds? February 11th, 2000, 01:26 AM It is really possible to control the execution speed on various computers using the Sleep API. But can someone go even better than this, like nano-, picoseconds, etc. Any cheeky technique. Cakkie February 11th, 2000, 02:49 AM Don't know for sure, but the api is called with the parameter 'dwMilliseconds as Long'. Try sending a value < 1, like 0.1 It's worth a try Tom Cannaerts slisse@planetinternet.be The best way to escape a problem, is to solve it. Chris Eastwood February 11th, 2000, 03:25 AM But a 'long' is still a 'whole' number. The CCRP project team (http://www.mvps.org/ccrp) provide a 'high-resolution' timer object that allows you to capture 1ms events, but as for any lower than that - I wouldn't have thought the average PC was upto the job. Chris Eastwood CodeGuru - the website for developers http://codeguru.developer.com/vb Atique Ahmad February 14th, 2000, 11:14 PM Why shouldn't a PC do the job. There are lots and lots of MHz, i.e., millions of pulses per second... There must be a way! AndyK February 15th, 2000, 09:57 AM All these "sleep" to a 0.001 second...all that is crap, timers are really inaccurate, but altough SLEEP function is much more accurate then using TIMER keyword, sleep is still probably will never be "perfect". Even thought current Intel CPU can support up to 2 billion operations per sec, windows cuts that power maybe like 50%, and VB is "slow" language itself, so the result is slippery. To tell the truth, I don't like the windows by it's speed, because it's really slow and it slows down other programs, but it's easy-to-use!!! For ex. to play games over internet you don't need CABLE modem (like DSL or T1) to have optimal performance, you need it because you play games throught windows, where windows makes it really slow transfering of bytes, so it sucks!! WINDOWS SUCKS!! (if you think from programming point of view) Clearcode February 15th, 2000, 10:10 AM The API call GetProcessTimes theoretically allows time slices to be as small as 100 nanoseconds (but no PC will allow this low a resolution that I know of). The declarations are: Type FILETIME dwLowDateTime as Long dwHighDateTime as Long End Type Declare Function GetProcessTimes Lib "kernel32" Alias "GetProcessTimes" (byval hProcess as Long, lpCreationTime as FILETIME, lpExitTime as FILETIME, lpKernelTime as FILETIME, lpUserTime as FILETIME) as Long You will have to experiment to see how low a resolution you can get in practice. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |