I have a need to do a 400ms sleep in a Unidata program. Is it possible?
Page 1 / 1
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
If it was a later system then, callout to Python...
pytime = pyImport('time')z = pyCallMethod(pytime,'sleep',0.4)
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
the AIX freeware tools have a updated version of sleep. You can sleep milliseconds
AE BP WAIT
Top of "WAIT" in "BP", 4 lines, 90 characters.
001: CRT "START"
002: PCPERFORM "timex /opt/freeware/bin/sleep 0.5" CAPTURING NED
003: CRT NED
004: CRT "DONE"
Bottom.
*--: fibr
Filed "WAIT" in file "BP".
Compiling Unibasic: BP/WAIT in mode 'u'.
compilation finished
START
þreal 0.50þuser 0.00þsys 0.00þþ
DONE
Nik
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
You could do this
sleep 0.001
And you can install the package "yum install AIX_Toolbox" if you don't have it.
Nik
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
My gut feel tells me microseconds... or maybe worst case 10 mS.
I was trying to figure a good truss command to see how much... I will look deeper and see if I can find something
cheers
Nik
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
START.TIME = SYSTEM(12)
PCPERFORM "echo Testing" CAPTURING BUFF
END.TIME = SYSTEM(12)
DURATION = END.TIME - START.TIME
PRINT DURATION
*
** Since PCPERFORM overhead and execution may vary from moment to moment do this:
*
Then take your 400 milliseconds - (Duration * 2) to come up with the sleep time you need.
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
It does make an assumption that the overhead is going to be constant, but then again even if the timer were baked into Unidata, there would be some variability based on load. But dang, a great idea!
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
I used system(12) as suggested by @David Green and it looks like the cost is 6-8mS
STIME=SYSTEM(12)
PCPERFORM "/opt/freeware/bin/sleep 0.5" CAPTURING NED
ETIME=SYSTEM(12)
TTIME=ETIME-STIME
CRT TTIME
My test ran on a IBM Power 924
On a P980 with 4K users, the times were 10-15mS scewed
Nik
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
You could also leverage openSocket's millisecond timeout parameter, and go to a non-listening address:
DESIRED.SLEEP.TIME = 400 ;* in milliseconds
* openSocket tries 3 times, so scale down
* the desired sleep time by 1/3...
SOCKET.TIMEOUT = INT(DESIRED.SLEEP.TIME/3)
NON.LISTENING.IP = "192.0.2.0" ; * see https://tools.ietf.org/html/rfc5737
NON.LISTENING.PORT = 0
BLOCKING = 1
START.TIME = SYSTEM(12)
RET = openSocket(NON.LISTENING.IP, NON.LISTENING.PORT, BLOCKING, SOCKET.TIMEOUT, OUT.HANDLE)
END.TIME = SYSTEM(12)
PRINT "Elapsed Time: " : (END.TIME - START.TIME)
I have a need to do a 400ms sleep in a Unidata program. Is it possible?
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.