mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
improve some defaults to tune performance if you use -heavy_timer, try not using it
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user