diff --git a/daemon/cli.c b/daemon/cli.c index 73fec4b65..3f06ff7ba 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -1836,8 +1836,8 @@ static void cli_incoming_list_transcoders(str *instr, struct cli_writer *cw, con char *chain; struct codec_stats *stats_entry; while (t_hash_table_iter_next(&iter, &chain, &stats_entry)) { - cw->cw_printf(cw, "%s: %i transcoders\n", chain, g_atomic_int_get(&stats_entry->num_transcoders)); - if (g_atomic_int_get(&stats_entry->last_tv_sec[idx]) != last_tv_sec) + cw->cw_printf(cw, "%s: %i transcoders\n", chain, atomic_get_na(&stats_entry->num_transcoders)); + if (atomic_get(&stats_entry->last_tv_sec[idx]) != last_tv_sec) continue; cw->cw_printf(cw, " %" PRIu64 " packets/s\n", atomic64_get(&stats_entry->packets_input[idx])); cw->cw_printf(cw, " %" PRIu64 " bytes/s\n", atomic64_get(&stats_entry->bytes_input[idx])); diff --git a/daemon/codec.c b/daemon/codec.c index 72673d5b0..e78c43f0b 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -464,7 +464,7 @@ static void __handler_shutdown(struct codec_handler *handler) { codec_handler_free(&handler->dtmf_injector); if (handler->stats_entry) { - __atomic_fetch_add(&handler->stats_entry->num_transcoders, -1, __ATOMIC_RELAXED); + atomic_add_na(&handler->stats_entry->num_transcoders, -1); handler->stats_entry = NULL; g_free(handler->stats_chain); handler->stats_chain = NULL; @@ -556,7 +556,7 @@ static void __handler_stats_entry(struct codec_handler *handler) { __auto_type stats_entry = handler->stats_entry; if (stats_entry) - __atomic_fetch_add(&stats_entry->num_transcoders, -1, __ATOMIC_RELAXED); + atomic_add_na(&stats_entry->num_transcoders, -1); { LOCK(&rtpe_codec_stats_lock); @@ -573,7 +573,7 @@ static void __handler_stats_entry(struct codec_handler *handler) { handler->stats_entry = stats_entry; } - __atomic_fetch_add(&stats_entry->num_transcoders, 1, __ATOMIC_RELAXED); + atomic_inc_na(&stats_entry->num_transcoders); } static int handler_func_blackhole(struct codec_handler *h, struct media_packet *mp) { @@ -5072,8 +5072,8 @@ static int handler_func_transcode(struct codec_handler *h, struct media_packet * unsigned int idx = now_sec & 1; int last_tv_sec = atomic_get_na(&h->stats_entry->last_tv_sec[idx]); if (last_tv_sec != now_sec) { - if (g_atomic_int_compare_and_exchange(&h->stats_entry->last_tv_sec[idx], - last_tv_sec, now_sec)) + if (atomic_compare_exchange(&h->stats_entry->last_tv_sec[idx], + &last_tv_sec, now_sec)) { // new second - zero out stats. slight race condition here atomic64_set(&h->stats_entry->packets_input[idx], 0); diff --git a/daemon/graphite.c b/daemon/graphite.c index 940c3330f..5817e0cde 100644 --- a/daemon/graphite.c +++ b/daemon/graphite.c @@ -197,8 +197,8 @@ GString *print_graphite_data(void) { struct codec_stats *stats_entry; while (t_hash_table_iter_next(&iter, &chain, &stats_entry)) { GPF("transcoder_%s %i", stats_entry->chain_brief, - g_atomic_int_get(&stats_entry->num_transcoders)); - if (g_atomic_int_get(&stats_entry->last_tv_sec[idx]) != last_tv_sec) + atomic_get_na(&stats_entry->num_transcoders)); + if (atomic_get(&stats_entry->last_tv_sec[idx]) != last_tv_sec) continue; GPF("transcoder_%s_packets %llu", stats_entry->chain_brief, (unsigned long long) atomic64_get(&stats_entry->packets_input[idx])); diff --git a/daemon/statistics.c b/daemon/statistics.c index 7c759b2f4..e542516af 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -889,10 +889,10 @@ stats_metric_q *statistics_gather_metrics(struct interface_sampled_rate_stats *i while (t_hash_table_iter_next(&iter, &chain, &stats_entry)) { HEADER("{", ""); METRICsva("chain", "\"%s\"", chain); - METRICs("num", "%i", g_atomic_int_get(&stats_entry->num_transcoders)); + METRICs("num", "%i", atomic_get_na(&stats_entry->num_transcoders)); PROM("transcoders", "gauge"); PROMLAB("chain=\"%s\"", chain); - if (g_atomic_int_get(&stats_entry->last_tv_sec[idx]) == last_tv_sec) { + if (atomic_get(&stats_entry->last_tv_sec[idx]) == last_tv_sec) { METRICs("packetrate", "%" PRIu64, atomic64_get(&stats_entry->packets_input[idx])); METRICs("byterate", "%" PRIu64, atomic64_get(&stats_entry->bytes_input[idx])); METRICs("samplerate", "%" PRIu64, atomic64_get(&stats_entry->pcm_samples[idx]));