CPU100% in while loop

Author: marco.aquino@dedalus.eu (Marco)

Hi, I saw that in a cycle on entity, clear/e "entity" ... ;fields assignement retrieve/e "entity" if ($status = 0) setocc "entity", 1 while ($status > 0) ... ; some elaboration setocc "entity", curocc(entity) + 1 endwhile endif the uniface.exe, or userver.exe, process takes all available CPU, so if there is only one processor the machine becomes unusable for the processing time. If I use a sleep statement, with 1 millisecond, the CPU doesn't take all the resources but the processing time increases. there is a solution to ensure that the loop does not take all the resources without use a sleep statement? There isn't a implicit sleep comunication to the SO so it manages others processes?   Thanks.


  1. Hello, for batch processes, we don't launch directly uniface.exe, but use the start command with a low priority. for instance:

    start /low bin\uniface.exe -bat -asn=.\adm\myAsn.asn myAps.aps myComponent myParams

      So, this process leave cpu time for other processes as needed. I haven't tested with userver.exe for an UST in urouter.asn, perhaps it may work as well. Philippe

    Author: Philippe (philippe.grangeray@agfa.com)
  2. Hi Marco, Could it be that there is some other stuff going on in other triggers (eg. format, read, etc) that is performing some expensive processing that you may not be aware of? Maybe you could run a debug trace and an ioprint=<SuperHigh> just to be sure. Cheers Ronny

    Author: rkrite (rkrite@gmail.com)
  3. What version of Uniface (including any patches) is it? And what OS version? 

    Author: Adrian Gosbell (adrian.gosbell@synapse-i.jp)
  4. Uniface 9.4.01 patch R132. It happens on Windows XP Windows 7 Windows Server 2003 Windows Server 2008R2 Marco

    Author: Marco (marco.aquino@dedalus.eu)
  5. Hi Marco, I'd put something like this in my ASN file (under [settings]); $putmess_logfile c:\temp\logfile.txt $proc_tracing_addition "$f:%%$formname/$e:%%$entname/$f:%%$fieldname/$s:%%$status/$p:%%$procerror/%%$clock : " $proc_tracing true The $clock statement should give you an indication as to the component (if you're running application partitioning) where things take time... Good luck, Knut

    Author: Knut (knut.dybendahl@gmail.com)