I have a netconf server with libnetconf2,i found the cpu usage is too high。After analysing and testing . I found it is because nc_ps_poll use usleep(NC_TIMEOUT_STEP), the NC_TIMEOUT_STEP is 50 Microseconds, it is too small 。When NC_TIMEOUT_STEP is 50 Microseconds, cpu is 8%。Then i modify NC_TIMEOUT_STEP, when it is 1000 Microseconds, cpu is 1.7%。If the usleep time can be a config , so we can modify it。
I have a netconf server with libnetconf2,i found the cpu usage is too high。After analysing and testing . I found it is because nc_ps_poll use usleep(NC_TIMEOUT_STEP), the NC_TIMEOUT_STEP is 50 Microseconds, it is too small 。When NC_TIMEOUT_STEP is 50 Microseconds, cpu is 8%。Then i modify NC_TIMEOUT_STEP, when it is 1000 Microseconds, cpu is 1.7%。If the usleep time can be a config , so we can modify it。