TT#101150 obsolete offers/answers/deletes_ps

Change-Id: I92e1a3617e2c47deeacc0186a930da0f6247f273
pull/1373/head
Richard Fuchs 4 years ago
parent 899d95791f
commit 7337f4a231

@ -68,6 +68,8 @@ struct global_stats_ax rtpe_stats;
struct global_stats_counter rtpe_stats_cumulative;
struct global_stats_ax rtpe_stats_graphite;
struct global_stats_counter rtpe_stats_graphite_interval;
struct global_stats_min_max rtpe_stats_graphite_min_max;
struct global_stats_min_max rtpe_stats_graphite_min_max_interval;
rwlock_t rtpe_callhash_lock;
GHashTable *rtpe_callhash;
@ -512,23 +514,6 @@ destroy:
RTPE_STATS_ADD(x, diff_ ## x); \
} while (0)
static void update_requests_per_second_stats(struct requests_ps *request, uint64_t new_val) {
mutex_lock(&request->lock);
request->count++;
request->ps_avg += new_val;
if ((request->ps_min == 0) || (request->ps_min > new_val)) {
request->ps_min = new_val;
}
if ((request->ps_max == 0) || (request->ps_max < new_val)) {
request->ps_max = new_val;
}
mutex_unlock(&request->lock);
}
void call_timer(void *ptr) {
struct iterator_helper hlp;
GList *i, *l;
@ -564,10 +549,7 @@ void call_timer(void *ptr) {
stats_counters_ax_calc_avg(&rtpe_stats, run_diff_us, NULL);
/* update statistics regarding requests per second */
update_requests_per_second_stats(&rtpe_totalstats_interval.offers_ps, atomic64_get(&rtpe_stats.intv.offers));
update_requests_per_second_stats(&rtpe_totalstats_interval.answers_ps, atomic64_get(&rtpe_stats.intv.answers));
update_requests_per_second_stats(&rtpe_totalstats_interval.deletes_ps, atomic64_get(&rtpe_stats.intv.deletes));
stats_counters_min_max(&rtpe_stats_graphite_min_max, &rtpe_stats.intv);
// stats derived while iterating calls
atomic64_set(&rtpe_stats_gauge.transcoded_media, hlp.transcoded_media);

@ -46,18 +46,6 @@ void free_prefix(void) {
g_free(graphite_prefix);
}
static struct requests_ps clear_requests_per_second(struct requests_ps *requests) {
struct requests_ps ret;
mutex_lock(&requests->lock);
ret = *requests;
requests->count=0;
requests->ps_max = 0;
requests->ps_min = 0;
requests->ps_avg = 0;
mutex_unlock(&requests->lock);
return ret;
}
static struct request_time timeval_clear_request_time(struct request_time *request) {
struct request_time ret;
@ -105,6 +93,7 @@ GString *print_graphite_data(struct totalstats *sent_data) {
long long time_diff_us = timeval_diff(&rtpe_now, &rtpe_latest_graphite_interval_start);
stats_counters_ax_calc_avg(&rtpe_stats_graphite, time_diff_us, &rtpe_stats_graphite_interval);
stats_counters_min_max_reset(&rtpe_stats_graphite_min_max, &rtpe_stats_graphite_min_max_interval);
struct totalstats *ts = sent_data;
@ -128,10 +117,6 @@ GString *print_graphite_data(struct totalstats *sent_data) {
ts->answer = timeval_clear_request_time(&rtpe_totalstats_interval.answer);
ts->delete = timeval_clear_request_time(&rtpe_totalstats_interval.delete);
ts->offers_ps = clear_requests_per_second(&rtpe_totalstats_interval.offers_ps);
ts->answers_ps = clear_requests_per_second(&rtpe_totalstats_interval.answers_ps);
ts->deletes_ps = clear_requests_per_second(&rtpe_totalstats_interval.deletes_ps);
rwlock_lock_r(&rtpe_callhash_lock);
mutex_lock(&rtpe_totalstats_interval.managed_sess_lock);
ts->managed_sess_max = rtpe_totalstats_interval.managed_sess_max;
@ -148,10 +133,6 @@ GString *print_graphite_data(struct totalstats *sent_data) {
timeval_divide(&ts->offer.time_avg, &ts->offer.time_avg, ts->offer.count);
timeval_divide(&ts->answer.time_avg, &ts->answer.time_avg, ts->answer.count);
timeval_divide(&ts->delete.time_avg, &ts->delete.time_avg, ts->delete.count);
//compute average offers/answers/deletes per second
ts->offers_ps.ps_avg = (ts->offers_ps.count?(ts->offers_ps.ps_avg/ts->offers_ps.count):0);
ts->answers_ps.ps_avg = (ts->answers_ps.count?(ts->answers_ps.ps_avg/ts->answers_ps.count):0);
ts->deletes_ps.ps_avg = (ts->deletes_ps.count?(ts->deletes_ps.ps_avg/ts->deletes_ps.count):0);
GString *graph_str = g_string_new("");
@ -196,17 +177,17 @@ GString *print_graphite_data(struct totalstats *sent_data) {
GPF("timeout_sess "UINT64F, atomic64_get_na(&rtpe_stats_graphite_interval.timeout_sess));
GPF("reject_sess "UINT64F, atomic64_get_na(&rtpe_stats_graphite_interval.rejected_sess));
GPF("offers_ps_min %llu",(unsigned long long)ts->offers_ps.ps_min);
GPF("offers_ps_max %llu",(unsigned long long)ts->offers_ps.ps_max);
GPF("offers_ps_avg %llu",(unsigned long long)ts->offers_ps.ps_avg);
GPF("offers_ps_min " UINT64F, atomic64_get_na(&rtpe_stats_graphite_min_max_interval.min.offers));
GPF("offers_ps_max " UINT64F, atomic64_get_na(&rtpe_stats_graphite_min_max_interval.max.offers));
GPF("offers_ps_avg " UINT64F, atomic64_get_na(&rtpe_stats_graphite_min_max_interval.avg.offers));
GPF("answers_ps_min %llu",(unsigned long long)ts->answers_ps.ps_min);
GPF("answers_ps_max %llu",(unsigned long long)ts->answers_ps.ps_max);
GPF("answers_ps_avg %llu",(unsigned long long)ts->answers_ps.ps_avg);
GPF("answers_ps_min " UINT64F, atomic64_get_na(&rtpe_stats_graphite_min_max_interval.min.answers));
GPF("answers_ps_max " UINT64F, atomic64_get_na(&rtpe_stats_graphite_min_max_interval.max.answers));
GPF("answers_ps_avg " UINT64F, atomic64_get_na(&rtpe_stats_graphite_min_max_interval.avg.answers));
GPF("deletes_ps_min %llu",(unsigned long long)ts->deletes_ps.ps_min);
GPF("deletes_ps_max %llu",(unsigned long long)ts->deletes_ps.ps_max);
GPF("deletes_ps_avg %llu",(unsigned long long)ts->deletes_ps.ps_avg);
GPF("deletes_ps_min " UINT64F, atomic64_get_na(&rtpe_stats_graphite_min_max_interval.min.deletes));
GPF("deletes_ps_max " UINT64F, atomic64_get_na(&rtpe_stats_graphite_min_max_interval.max.deletes));
GPF("deletes_ps_avg " UINT64F, atomic64_get_na(&rtpe_stats_graphite_min_max_interval.avg.deletes));
for (GList *l = all_local_interfaces.head; l; l = l->next) {
struct local_intf *lif = l->data;

@ -422,7 +422,6 @@ GQueue *statistics_gather_metrics(void) {
struct timeval avg, calls_dur_iv;
uint64_t cur_sessions, num_sessions, min_sess_iv, max_sess_iv;
struct request_time offer_iv, answer_iv, delete_iv;
struct requests_ps offers_ps, answers_ps, deletes_ps;
mutex_lock(&rtpe_totalstats.total_average_lock);
avg = rtpe_totalstats.total_average_call_dur;
@ -508,9 +507,6 @@ GQueue *statistics_gather_metrics(void) {
offer_iv = rtpe_totalstats_lastinterval.offer;
answer_iv = rtpe_totalstats_lastinterval.answer;
delete_iv = rtpe_totalstats_lastinterval.delete;
offers_ps = rtpe_totalstats_lastinterval.offers_ps;
answers_ps = rtpe_totalstats_lastinterval.answers_ps;
deletes_ps = rtpe_totalstats_lastinterval.deletes_ps;
mutex_unlock(&rtpe_totalstats_lastinterval_lock);
HEADER(NULL, "");
@ -547,26 +543,26 @@ GQueue *statistics_gather_metrics(void) {
METRICsva("avgdeletedelay", "%llu.%06llu", (unsigned long long)delete_iv.time_avg.tv_sec,(unsigned long long)delete_iv.time_avg.tv_usec);
METRICl("Min/Max/Avg offer requests per second", "%llu/%llu/%llu per sec",
(unsigned long long)offers_ps.ps_min,
(unsigned long long)offers_ps.ps_max,
(unsigned long long)offers_ps.ps_avg);
METRICs("minofferrequestrate", "%llu", (unsigned long long)offers_ps.ps_min);
METRICs("maxofferrequestrate", "%llu", (unsigned long long)offers_ps.ps_max);
METRICs("avgofferrequestrate", "%llu", (unsigned long long)offers_ps.ps_avg);
(unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.min.offers),
(unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.max.offers),
(unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.avg.offers));
METRICs("minofferrequestrate", "%llu", (unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.min.offers));
METRICs("maxofferrequestrate", "%llu", (unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.max.offers));
METRICs("avgofferrequestrate", "%llu", (unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.avg.offers));
METRICl("Min/Max/Avg answer requests per second", "%llu/%llu/%llu per sec",
(unsigned long long)answers_ps.ps_min,
(unsigned long long)answers_ps.ps_max,
(unsigned long long)answers_ps.ps_avg);
METRICs("minanswerrequestrate", "%llu", (unsigned long long)answers_ps.ps_min);
METRICs("maxanswerrequestrate", "%llu", (unsigned long long)answers_ps.ps_max);
METRICs("avganswerrequestrate", "%llu", (unsigned long long)answers_ps.ps_avg);
(unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.min.answers),
(unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.max.answers),
(unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.avg.answers));
METRICs("minanswerrequestrate", "%llu", (unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.min.answers));
METRICs("maxanswerrequestrate", "%llu", (unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.max.answers));
METRICs("avganswerrequestrate", "%llu", (unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.avg.answers));
METRICl("Min/Max/Avg delete requests per second", "%llu/%llu/%llu per sec",
(unsigned long long)deletes_ps.ps_min,
(unsigned long long)deletes_ps.ps_max,
(unsigned long long)deletes_ps.ps_avg);
METRICs("mindeleterequestrate", "%llu", (unsigned long long)deletes_ps.ps_min);
METRICs("maxdeleterequestrate", "%llu", (unsigned long long)deletes_ps.ps_max);
METRICs("avgdeleterequestrate", "%llu", (unsigned long long)deletes_ps.ps_avg);
(unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.min.deletes),
(unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.max.deletes),
(unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.avg.deletes));
METRICs("mindeleterequestrate", "%llu", (unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.min.deletes));
METRICs("maxdeleterequestrate", "%llu", (unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.max.deletes));
METRICs("avgdeleterequestrate", "%llu", (unsigned long long) atomic64_get(&rtpe_stats_graphite_min_max_interval.avg.deletes));
HEADER(NULL, "");
HEADER("}", "");
@ -761,10 +757,6 @@ void statistics_free() {
mutex_destroy(&rtpe_totalstats_interval.answer.lock);
mutex_destroy(&rtpe_totalstats_interval.delete.lock);
mutex_destroy(&rtpe_totalstats_interval.offers_ps.lock);
mutex_destroy(&rtpe_totalstats_interval.answers_ps.lock);
mutex_destroy(&rtpe_totalstats_interval.deletes_ps.lock);
mutex_destroy(&rtpe_codec_stats_lock);
g_hash_table_destroy(rtpe_codec_stats);
}
@ -792,10 +784,6 @@ void statistics_init() {
mutex_init(&rtpe_totalstats_interval.answer.lock);
mutex_init(&rtpe_totalstats_interval.delete.lock);
mutex_init(&rtpe_totalstats_interval.offers_ps.lock);
mutex_init(&rtpe_totalstats_interval.answers_ps.lock);
mutex_init(&rtpe_totalstats_interval.deletes_ps.lock);
mutex_init(&rtpe_codec_stats_lock);
rtpe_codec_stats = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, codec_stats_free);
}

@ -546,6 +546,8 @@ extern struct global_stats_ax rtpe_stats;
extern struct global_stats_counter rtpe_stats_cumulative; // total, cumulative
extern struct global_stats_ax rtpe_stats_graphite;
extern struct global_stats_counter rtpe_stats_graphite_interval; // copied out when graphite stats run
extern struct global_stats_min_max rtpe_stats_graphite_min_max; // running min/max
extern struct global_stats_min_max rtpe_stats_graphite_min_max_interval; // updated once per graphite run
#define RTPE_STATS_ADD(field, num) \
do { \

@ -53,14 +53,6 @@ struct request_time {
struct timeval time_min, time_max, time_avg;
};
struct requests_ps {
mutex_t lock;
uint64_t count;
uint64_t ps_min;
uint64_t ps_max;
uint64_t ps_avg;
};
struct totalstats {
time_t started;
@ -77,7 +69,6 @@ struct totalstats {
struct timeval total_calls_duration_interval;
struct request_time offer, answer, delete;
struct requests_ps offers_ps, answers_ps, deletes_ps;
};
struct rtp_stats {

Loading…
Cancel
Save