add softtimer to the core, begin framework for static modules and reduces calls to gettimeofday for timestamps

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5784 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-10-03 16:44:11 +00:00
parent 23758b1965
commit bd6bd9ad57
21 changed files with 163 additions and 303 deletions
+10 -3
View File
@@ -79,6 +79,10 @@ SWITCH_STANDARD_SCHED_FUNC(heartbeat_callback)
task->runtime = time(NULL) + 20;
}
SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void)
{
return runtime.timestamp ? runtime.timestamp : switch_time_now();
}
SWITCH_DECLARE(switch_status_t) switch_core_set_console(const char *console)
{
@@ -413,12 +417,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(const char *console, switch_cor
return SWITCH_STATUS_MEMERR;
}
assert(runtime.memory_pool != NULL);
switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
switch_core_set_globals();
switch_core_session_init(runtime.memory_pool);
switch_core_hash_init(&runtime.global_vars, runtime.memory_pool);
runtime.flags = flags;
runtime.sps_total = 30;
if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) {
apr_terminate();
@@ -438,6 +442,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(const char *console, switch_cor
if (switch_true(val)) {
switch_set_flag((&runtime), SCF_CRASH_PROT);
}
} else if (!strcasecmp(var, "sessions-per-second")) {
switch_core_sessions_per_second(atoi(val));
} else if (!strcasecmp(var, "max-sessions")) {
switch_core_session_limit(atoi(val));
}
@@ -582,9 +588,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(const char *console
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
"\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\nSQL [%s]\n", SWITCH_VERSION_FULL,
"\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n", SWITCH_VERSION_FULL,
switch_test_flag((&runtime), SCF_CRASH_PROT) ? "Enabled" : "Disabled",
switch_core_session_limit(0),
switch_core_sessions_per_second(0),
switch_test_flag((&runtime), SCF_USE_SQL) ? "Enabled" : "Disabled"
);