mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 09:58:17 +00:00
add fsctl min_idle_cpu and min-idle-cpu feature to refuse calls after the system fallse below a certian percentage of idle cpu
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16962 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -630,6 +630,10 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
||||
uint32_t x, tick = 0;
|
||||
switch_time_t ts = 0, last = 0;
|
||||
int fwd_errs = 0, rev_errs = 0;
|
||||
int profile_tick = 0;
|
||||
|
||||
runtime.profile_timer = switch_new_profile_timer();
|
||||
switch_get_system_idle_time(runtime.profile_timer, &runtime.profile_time);
|
||||
|
||||
#ifdef HAVE_CPU_SET_MACROS
|
||||
if (runtime.timer_affinity > -1) {
|
||||
@@ -741,6 +745,11 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
||||
tick += STEP_MS;
|
||||
|
||||
if (tick >= TICK_PER_SEC) {
|
||||
if (++profile_tick == 1) {
|
||||
switch_get_system_idle_time(runtime.profile_timer, &runtime.profile_time);
|
||||
profile_tick = 0;
|
||||
}
|
||||
|
||||
if (runtime.sps <= 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Rate of %d!\n", runtime.sps_total);
|
||||
}
|
||||
@@ -803,6 +812,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
||||
globals.RUNNING = 0;
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
|
||||
switch_delete_profile_timer(&runtime.profile_timer);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Soft timer thread exiting.\n");
|
||||
|
||||
return SWITCH_STATUS_TERM;
|
||||
|
Reference in New Issue
Block a user