Browse Source

TT#14008 add cumulative global stats counters

Change-Id: I884a47c6d3e52fcb5572187fbd71fd11ec08cb8e
pull/1287/head
Richard Fuchs 5 years ago
parent
commit
e32d128bd8
3 changed files with 14 additions and 7 deletions
  1. +2
    -2
      daemon/call.c
  2. +5
    -5
      daemon/media_socket.c
  3. +7
    -0
      include/call.h

+ 2
- 2
daemon/call.c View File

@ -64,6 +64,7 @@ struct xmlrpc_helper {
/* XXX rework these */ /* XXX rework these */
struct stats rtpe_statsps; struct stats rtpe_statsps;
struct stats rtpe_stats; struct stats rtpe_stats;
struct stats rtpe_stats_cumulative;
rwlock_t rtpe_callhash_lock; rwlock_t rtpe_callhash_lock;
GHashTable *rtpe_callhash; GHashTable *rtpe_callhash;
@ -494,8 +495,7 @@ destroy:
diff_ ## x = 0; \ diff_ ## x = 0; \
else \ else \
diff_ ## x = ke->stats.x - ks_val; \ diff_ ## x = ke->stats.x - ks_val; \
atomic64_add(&ps->stats.x, diff_ ## x); \
atomic64_add(&rtpe_statsps.x, diff_ ## x); \
RTPE_STATS_INC(x, diff_ ## x); \
} while (0) } while (0)
static void update_requests_per_second_stats(struct requests_ps *request, uint64_t new_val) { static void update_requests_per_second_stats(struct requests_ps *request, uint64_t new_val) {


+ 5
- 5
daemon/media_socket.c View File

@ -1636,7 +1636,7 @@ static void media_packet_rtp(struct packet_handler_ctx *phc)
phc->payload_type, phc->payload_type,
FMT_M(endpoint_print_buf(&phc->mp.fsin))); FMT_M(endpoint_print_buf(&phc->mp.fsin)));
atomic64_inc(&phc->mp.stream->stats.errors); atomic64_inc(&phc->mp.stream->stats.errors);
atomic64_inc(&rtpe_statsps.errors);
RTPE_STATS_INC(errors, 1);
} }
else { else {
atomic64_inc(&rtp_s->packets); atomic64_inc(&rtp_s->packets);
@ -2071,7 +2071,7 @@ static int stream_packet(struct packet_handler_ctx *phc) {
ilog(LOG_WARNING | LOG_FLAG_LIMIT, "Media packet from %s%s%s discarded due to lack of sink", ilog(LOG_WARNING | LOG_FLAG_LIMIT, "Media packet from %s%s%s discarded due to lack of sink",
FMT_M(endpoint_print_buf(&phc->mp.fsin))); FMT_M(endpoint_print_buf(&phc->mp.fsin)));
atomic64_inc(&phc->mp.stream->stats.errors); atomic64_inc(&phc->mp.stream->stats.errors);
atomic64_inc(&rtpe_statsps.errors);
RTPE_STATS_INC(errors, 1);
goto out; goto out;
} }
@ -2132,7 +2132,7 @@ static int stream_packet(struct packet_handler_ctx *phc) {
ret = -errno; ret = -errno;
ilog(LOG_DEBUG,"Error when sending message. Error: %s",strerror(errno)); ilog(LOG_DEBUG,"Error when sending message. Error: %s",strerror(errno));
atomic64_inc(&phc->mp.stream->stats.errors); atomic64_inc(&phc->mp.stream->stats.errors);
atomic64_inc(&rtpe_statsps.errors);
RTPE_STATS_INC(errors, 1);
goto out; goto out;
} }
@ -2142,8 +2142,8 @@ drop:
atomic64_inc(&phc->mp.stream->stats.packets); atomic64_inc(&phc->mp.stream->stats.packets);
atomic64_add(&phc->mp.stream->stats.bytes, phc->s.len); atomic64_add(&phc->mp.stream->stats.bytes, phc->s.len);
atomic64_set(&phc->mp.stream->last_packet, rtpe_now.tv_sec); atomic64_set(&phc->mp.stream->last_packet, rtpe_now.tv_sec);
atomic64_inc(&rtpe_statsps.packets);
atomic64_add(&rtpe_statsps.bytes, phc->s.len);
RTPE_STATS_INC(packets, 1);
RTPE_STATS_INC(bytes, phc->s.len);
out: out:
if (phc->unkernelize) { if (phc->unkernelize) {


+ 7
- 0
include/call.h View File

@ -493,8 +493,15 @@ extern GHashTable *rtpe_callhash;
extern struct call_iterator_list rtpe_call_iterators[NUM_CALL_ITERATORS]; extern struct call_iterator_list rtpe_call_iterators[NUM_CALL_ITERATORS];
extern struct stats rtpe_statsps; /* per second stats, running timer */ extern struct stats rtpe_statsps; /* per second stats, running timer */
extern struct stats rtpe_stats_cumulative; // total, cumulative
extern struct stats rtpe_stats; /* copied from statsps once a second */ extern struct stats rtpe_stats; /* copied from statsps once a second */
#define RTPE_STATS_INC(field, num) \
do { \
atomic64_add(&rtpe_statsps.field, num); \
atomic64_add(&rtpe_stats_cumulative.field, num); \
} while (0)
int call_init(void); int call_init(void);
void call_free(void); void call_free(void);


Loading…
Cancel
Save