I'm using callgrind to tell why my program is consuming all CPU and it turns out select is being called tens of thousands of times a second. I wonder it would be a good idea to place a usleep inside the while(s->run).
Here is a snippet of callgrind_control called a few seconds after process start:
I'm using callgrind to tell why my program is consuming all CPU and it turns out
select
is being called tens of thousands of times a second. I wonder it would be a good idea to place ausleep
inside thewhile(s->run)
.Here is a snippet of callgrind_control called a few seconds after process start:
https://github.com/evgenido/stomp/blob/fd6145ff234fa1ecd11ba41a0f171ff0fc6eb1e5/src/stomp.c#L795