提交 42766801 authored 作者: Jeff Lenk's avatar Jeff Lenk

FS-3782 --resolve soft timer

上级 8c794acb
...@@ -260,6 +260,7 @@ struct switch_runtime { ...@@ -260,6 +260,7 @@ struct switch_runtime {
uint32_t max_db_handles; uint32_t max_db_handles;
uint32_t db_handle_timeout; uint32_t db_handle_timeout;
int cpu_count; int cpu_count;
uint32_t time_sync;
}; };
extern struct switch_runtime runtime; extern struct switch_runtime runtime;
......
...@@ -546,24 +546,19 @@ SWITCH_STANDARD_API(timer_test_function) ...@@ -546,24 +546,19 @@ SWITCH_STANDARD_API(timer_test_function)
goto end; goto end;
} }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer Test: samplecount after init: %d\n", timer.samplecount); switch_core_timer_next(&timer); /* Step timer once before testing results below, to get first timestamp as accurate as possible */
/* Step timer once before testing results below, to get first timestamp as accurate as possible */ start = then = switch_time_ref();
switch_core_timer_next(&timer);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer Test: samplecount after first step: %d\n", timer.samplecount);
start = switch_time_ref();
for (x = 1; x <= max; x++) { for (x = 1; x <= max; x++) {
then = switch_time_ref();
switch_core_timer_next(&timer); switch_core_timer_next(&timer);
now = switch_time_ref(); now = switch_time_ref();
diff = (int) (now - then); diff = (int) (now - then);
//stream->write_function(stream, "test %d sleep %ld %d\n", x, mss, diff);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer Test: %d sleep %d %d\n", x, mss, diff);
total += diff; total += diff;
then = now;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer Test: %d sleep %d %d\n", x, mss, diff);
} }
end = switch_time_ref(); end = then;
switch_yield(250000); switch_yield(250000);
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论