100% CPU utilization for sync calls.

Jochen Katz katz____agentpp.com
Tue May 23 09:58:15 CEST 2000


Hi,

> When I send a get request to a agent that is not running
> using snmp++, the CPU utilization goes to 100% on NT for the
> timeout period.
> SNMPProcessPendingEvents has a select call where the timeout
> is set to 0. I suspect this is causing 100% CPU utilization.

SNMPProcessPendingEvents is called within a loop from
SNMPBlockForResponse which is called from the sync get request
method. 

I would suggest to add a Sleep(0) to SNMPBlockForResponse. This
will not fix the 100% CPU load but the thread will give up his
time slice if other threads are ready to run:

  do {
    yield_pump(); 
    SNMPProcessPendingEvents();
#ifdef WIN32
    Sleep(0); // from winbase.h
#endif
  } while (!snmpEventList->Done());

The other possibility is, to add a small timeout to the select
call in SNMPProcessPendingEvents.

Any other suggestions?

Best regards,
  Jochen



More information about the AGENTPP mailing list