Addition of new tuning parameters for epoll spins and wait time

This commit is contained in:
Mark Riddoch
2014-10-17 12:28:27 +01:00
parent 2edab598b2
commit e729a17fd4
6 changed files with 162 additions and 17 deletions

View File

@ -1106,6 +1106,31 @@ config_threadcount()
return gateway.n_threads;
}
/**
* Return the number of non-blocking polls to be done before a blocking poll
* is issued.
*
* @return The number of blocking poll calls to make before a blocking call
*/
unsigned int
config_nbpolls()
{
return gateway.n_nbpoll;
}
/**
* Return the configured number of milliseconds for which we wait when we do
* a blocking poll call.
*
* @return The number of milliseconds to sleep in a blocking poll call
*/
unsigned int
config_pollsleep()
{
return gateway.pollsleep;
}
static struct {
char *logname;
logfile_id_t logfile;
@ -1126,9 +1151,20 @@ static int
handle_global_item(const char *name, const char *value)
{
int i;
if (strcmp(name, "threads") == 0) {
if (strcmp(name, "threads") == 0)
{
gateway.n_threads = atoi(value);
} else {
}
else if (strcmp(name, "non_blocking_polls") == 0)
{
gateway.n_nbpoll = atoi(value);
}
else if (strcmp(name, "poll_sleep") == 0)
{
gateway.pollsleep = atoi(value);
}
else
{
for (i = 0; lognames[i].logname; i++)
{
if (strcasecmp(name, lognames[i].logname) == 0)
@ -1150,6 +1186,8 @@ static void
global_defaults()
{
gateway.n_threads = 1;
gateway.n_nbpoll = DEFAULT_NBPOLLS;
gateway.pollsleep = DEFAULT_POLLSLEEP;
if (version_string != NULL)
gateway.version_string = strdup(version_string);
else