I.E., add the line with "NAP" in it.
You may want to try different NAP intervals to work out the best balance
between snappy user response and CPU usage.
________________________________________________________
OK = 0 ; START.DT = DATE() ; START.TM = TIME(); TIME.OUT = 900 LOOP
INPUTIF PSN THEN OK = @TRUE ELSE
NAP 100 ; Doze 100 milliseconds = 1/10 sec
OK = ((DATE()-START.DT)*86400)+TIME()-START.TM > TIME.OUT
IF OK THEN
IF EDIT.FLG THEN PSN = '' ELSE PSN = 'Q'
END
END
UNTIL OK DO
REPEAT
__________________________________________________________
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Wednesday, 27 October 2010 10:14 a.m.
To: [email protected]
Subject: Re: [U2] INPUTIF statement in Universe
In a message dated 10/26/2010 11:58:58 AM Pacific Daylight Time,
[email protected] writes:
> In testing, it's the INPUTIF statement that's utilizing the CPU, not
the
> timer calculation.
>
> Is there a better, less CPU intensive way to do this?
>
> Thanks in advance. >>
>
INPUTIF checks the type-ahead buffer every time slice. You're getting
so
many slices that your CPU is consumed with this one task of checking the
type-ahead buffer. It's frenetic, a CPU on crystal meth.
In the old days, we would say Release Timeslices RQM. Today you can
solve
that issue as well, by adding a Sleep for a 1 second. On systems that
allow
sleeping for periods less than a second, you only really need to add a
sleep for a tenth of a second, to see your CPU suddenly quiesce.
Will Johnson
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
The information contained in this Internet Email message is intended
for the addressee only and may contain privileged information, but not
necessarily the official views or opinions of the New Zealand Defence Force.
If you are not the intended recipient you must not use, disclose, copy or
distribute this message or the information in it.
If you have received this message in error, please Email or telephone
the sender immediately.
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users