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:
Anthony Minessale
2010-03-10 20:21:34 +00:00
parent 869c221f3a
commit b1ddb70cf1
8 changed files with 94 additions and 26 deletions
+19
View File
@@ -1485,6 +1485,10 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
return NULL;
}
if (runtime.min_idle_time > 0 && runtime.profile_time < runtime.min_idle_time) {
return NULL;
}
PROTECT_INTERFACE(endpoint_interface);
switch_mutex_lock(runtime.throttle_mutex);
@@ -1640,6 +1644,21 @@ SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit)
return session_manager.session_limit;
}
SWITCH_DECLARE(double) switch_core_min_idle_cpu(double new_limit)
{
if (new_limit >= 0) {
runtime.min_idle_time = new_limit;
}
return runtime.min_idle_time;
}
SWITCH_DECLARE(double) switch_core_idle_cpu(void)
{
return runtime.profile_time;
}
SWITCH_DECLARE(uint32_t) switch_core_sessions_per_second(uint32_t new_limit)
{
if (new_limit) {