mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
few new command line opts -vm for conditonal timer, -nocal to skip timer calibration and -nort to turn off clock_realtime fam of functions
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16324 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -198,7 +198,7 @@ SWITCH_DECLARE(void) switch_time_calibrate_clock(void)
|
||||
|
||||
OFFSET = 0;
|
||||
|
||||
for (x = 0; x < 500; x++) {
|
||||
for (x = 0; x < 100; x++) {
|
||||
avg = average_time(val, 50);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Test: %ld Average: %ld Step: %d\n", (long)val, (long)avg, step);
|
||||
|
||||
@@ -231,8 +231,12 @@ SWITCH_DECLARE(void) switch_time_calibrate_clock(void)
|
||||
}
|
||||
}
|
||||
|
||||
OFFSET = (int)(want - val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer offset of %d calculated\n", OFFSET);
|
||||
if (good >= 10) {
|
||||
OFFSET = (int)(want - val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer offset of %d calculated\n", OFFSET);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer offset of NOT calculated\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -943,8 +947,20 @@ SWITCH_MODULE_LOAD_FUNCTION(softtimer_load)
|
||||
timer_interface->timer_check = timer_check;
|
||||
timer_interface->timer_destroy = timer_destroy;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Calibrating timer, please wait...\n");
|
||||
switch_time_calibrate_clock();
|
||||
if (!switch_test_flag((&runtime), SCF_USE_CLOCK_RT)) {
|
||||
switch_time_set_nanosleep(SWITCH_FALSE);
|
||||
}
|
||||
|
||||
if (!switch_test_flag((&runtime), SCF_USE_COND_TIMING)) {
|
||||
switch_time_set_cond_yield(SWITCH_TRUE);
|
||||
}
|
||||
|
||||
if (switch_test_flag((&runtime), SCF_CALIBRATE_CLOCK)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Calibrating timer, please wait...\n");
|
||||
switch_time_calibrate_clock();
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clock calibration disabled.\n");
|
||||
}
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
Reference in New Issue
Block a user