SICS-729: The idle CPU usage has been reduced from 20% to <2%.
The select timeout has been set to 10ms and we only check if a socket is writeable when SICS has a message to send. The performance command in SICS now shows a value of about 100 instead of 1000.
This commit is contained in:
@ -395,14 +395,18 @@ void ANETprocess(void)
|
|||||||
{
|
{
|
||||||
int i, status, count = 0, socke = 0, length;
|
int i, status, count = 0, socke = 0, length;
|
||||||
fd_set readMask, writeMask;
|
fd_set readMask, writeMask;
|
||||||
struct timeval tmo = { 0, 10 };
|
struct timeval tmo = { 0, 10000 };
|
||||||
|
|
||||||
FD_ZERO(&readMask);
|
FD_ZERO(&readMask);
|
||||||
FD_ZERO(&writeMask);
|
FD_ZERO(&writeMask);
|
||||||
for (i = 0; i < noConnections; i++) {
|
for (i = 0; i < noConnections; i++) {
|
||||||
socke = connections[i].socket;
|
socke = connections[i].socket;
|
||||||
FD_SET(socke, &readMask);
|
FD_SET(socke, &readMask);
|
||||||
FD_SET(socke, &writeMask);
|
if (connections[i].writeBuffer != NULL) {
|
||||||
|
GetRWBufferData(connections[i].writeBuffer, &length);
|
||||||
|
if (length > 0)
|
||||||
|
FD_SET(socke, &writeMask);
|
||||||
|
}
|
||||||
if (socke > count) {
|
if (socke > count) {
|
||||||
count = socke;
|
count = socke;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user