improve some defaults to tune performance if you use -heavy_timer, try not using it

This commit is contained in:
Anthony Minessale
2011-03-22 13:27:37 -05:00
parent 3b56c119a7
commit 5d7831348b
4 changed files with 32 additions and 10 deletions

View File

@@ -606,16 +606,8 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
switch_assert(SWITCH_GLOBAL_dirs.temp_dir);
}
SWITCH_DECLARE(int32_t) set_high_priority(void)
static int32_t set_priority(void)
{
#ifdef WIN32
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
#else
#ifdef USE_SETRLIMIT
struct rlimit lim = { RLIM_INFINITY, RLIM_INFINITY };
#endif
#ifdef USE_SCHED_SETSCHEDULER
/*
* Try to use a round-robin scheduler
@@ -637,13 +629,40 @@ SWITCH_DECLARE(int32_t) set_high_priority(void)
*/
if (setpriority(PRIO_PROCESS, getpid(), -10) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not set nice level\n");
return -1;
}
#else
if (nice(-10) != -10) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not set nice level\n");
return -1;
}
#endif
return 0;
}
SWITCH_DECLARE(int32_t) set_normal_priority(void)
{
return set_priority();
}
SWITCH_DECLARE(int32_t) set_high_priority(void)
{
int pri;
#ifdef WIN32
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
#else
#ifdef USE_SETRLIMIT
struct rlimit lim = { RLIM_INFINITY, RLIM_INFINITY };
#endif
if ((pri = set_priority())) {
return pri;
}
#ifdef USE_SETRLIMIT
/*
* The amount of memory which can be mlocked is limited for non-root users.