MT#57379 move `ice_slow_timer()` to a separate thread

Move the `ice_slow_timer()` functionality to a separate thread,
so that we do the work more efficiently, and not be dependent
on the call_timer runs by poller.

Furthermore it makes more sense to keep in the `ice.c`,
since it obviously has to do with ice timing.

Additionally:

Update the test-stats due to these changes in the `call_timer()`

We have to call the `ice_slow_timer()` now explicitely from
the test-stats.c, because the `call_timer()` is not anymore
responsible for providing stats counters rate calculations.

Change-Id: I03377dd59ea71c27497e1f4d30164075f05165cd
pull/1675/head
Donat Zenichev 2 years ago
parent 131702c6e4
commit d818b7ab65

@ -525,8 +525,6 @@ void call_timer(void *ptr) {
kill_calls_timer(hlp.del_scheduled, NULL);
kill_calls_timer(hlp.del_timeout, rtpe_config.b2b_url);
ice_slow_timer();
struct timeval tv_stop;
gettimeofday(&tv_stop, NULL);
long long duration = timeval_diff(&tv_stop, &tv_start);

@ -762,7 +762,18 @@ void ice_slow_timer(void) {
fragments_cleanup(false);
}
/**
* Separate thread for for ice slow timer functionality.
*/
void ice_slow_timer_iterator(void * dummy) {
while (!rtpe_shutdown) {
ice_slow_timer();
thread_cancel_enable();
usleep(1000000); /* sleep for 1 second in each iteration */
thread_cancel_disable();
}
}
static void __fail_pair(struct ice_candidate_pair *pair) {
ilogs(ice, LOG_DEBUG, "Setting ICE candidate pair "PAIR_FORMAT" as failed", PAIR_FMT(pair));

@ -1358,6 +1358,10 @@ int main(int argc, char **argv) {
thread_create_detach_prio(kernel_stats_updater_iterator, NULL, rtpe_config.idle_scheduling,
rtpe_config.idle_priority, "kernel stats updater");
/* separate thread for ice slow timer functionality */
thread_create_detach_prio(ice_slow_timer_iterator, NULL, rtpe_config.idle_scheduling,
rtpe_config.idle_priority, "ice slow timer");
if (!is_addr_unspecified(&rtpe_config.redis_ep.address) && initial_rtpe_config.redis_delete_async)
thread_create_detach(redis_delete_async_loop, NULL, "redis async");

@ -176,7 +176,7 @@ bool trickle_ice_update(struct ng_buffer *ngbuf, struct call *call, struct sdp_n
void ice_slow_timer(void);
void ice_slow_timer_iterator(void * dummy);
#include "call.h"

@ -3233,6 +3233,7 @@ int main(void) {
call_timer(NULL);
stats_counters_calc_rate(&rtpe_stats, 150000000, &rtpe_stats_intv, &rtpe_stats_rate);
stats_rate_min_max(&rtpe_rate_graphite_min_max, &rtpe_stats_rate);
ice_slow_timer();
RTPE_STATS_ADD(ng_commands[NGC_OFFER], 100);
rtpe_now.tv_sec += 2;
@ -3241,6 +3242,7 @@ int main(void) {
call_timer(NULL);
stats_counters_calc_rate(&rtpe_stats, 2000000, &rtpe_stats_intv, &rtpe_stats_rate);
stats_rate_min_max(&rtpe_rate_graphite_min_max, &rtpe_stats_rate);
ice_slow_timer();
// timer run time interval increased
rtpe_now.tv_sec += 5;
@ -3249,6 +3251,7 @@ int main(void) {
call_timer(NULL);
stats_counters_calc_rate(&rtpe_stats, 5000000, &rtpe_stats_intv, &rtpe_stats_rate);
stats_rate_min_max(&rtpe_rate_graphite_min_max, &rtpe_stats_rate);
ice_slow_timer();
graph_str = print_graphite_data();
assert_g_string_eq(graph_str,

Loading…
Cancel
Save