CPU usage (OpenInsight 32-bit Specific)
At 28 MAY 2010 12:29:41PM Terry Rainville wrote:
In AREV3.111 we use TAME to remove the CPU usage by an idle machine.
In OI I am trying to make a similar thing.
I either would like to have a routine start a program on a regular basis.
OR
I have created a program that loops until a set amount of time, problem with this approach is the CPU is being eaten up, is there anyway to make this work better.
At 29 MAY 2010 05:13AM Eric wrote:
/* requires this DLL prototype entry in your record for DLL_KERNEL32
KERNEL32
ULONG STDCALL Sleep(ULONG) AS DONTASKTHEEMU
*/
In the editor, from the Exec box, enter the command
run declare_fcns "DLL_KERNEL32"
* Then in your program you can
DECLARE SUBROUTINE DONTASKTHEEMU
DONTASKTHEEMU(200)
* You may alter the value to suit your hardware.
* This sheds CPU load by returning timeslice control
* to Windows to process its own event queue (and other tasks,
* threads and events like keystrokes and screen refreshes
* and mouse moving).
Or else you can use YIELD() - see pg. 503 of the OI Programmer's reference manual.