Mirror

How to assign an application to have a smaller percentage of the CPU cycles (Views: 100)


Problem/Question/Abstract:

How to assign an application to have a smaller percentage of the CPU cycles

Answer:

The rest of this may take a little time, and is quite CPU intensive, so try and drop to a lower priority if possible. Drop to low priority for CPU-intensive parts.


saved_priority_class := GetPriorityClass(GetCurrentProcessID);
if saved_priority_class <> 0 then
  SetPriorityClass(GetCurrentProcess, IDLE_PRIORITY_CLASS);

{ CPU intensive stuff here ... }

{Restore normal priority}
if saved_priority_class <> 0 then
  SetPriorityClass(GetCurrentProcess, saved_priority_class);

<< Back to main page