Browse Source

TT#101150 separate out `struct stream_stats`

Change-Id: I709060d9e805175bd99173df03e581b593506e15
pull/1373/head
Richard Fuchs 4 years ago
parent
commit
a1f3530292
6 changed files with 24 additions and 15 deletions
  1. +4
    -4
      daemon/call.c
  2. +2
    -2
      daemon/call_interfaces.c
  3. +1
    -1
      daemon/cdr.c
  4. +1
    -1
      daemon/redis.c
  5. +5
    -5
      include/call.h
  6. +11
    -2
      include/statistics.h

+ 4
- 4
daemon/call.c View File

@ -64,9 +64,9 @@ struct xmlrpc_helper {
/* XXX rework these */ /* XXX rework these */
struct stats rtpe_statsps;
struct stats rtpe_stats;
struct stats rtpe_stats_cumulative;
struct global_stats rtpe_statsps;
struct global_stats rtpe_stats;
struct global_stats rtpe_stats_cumulative;
rwlock_t rtpe_callhash_lock; rwlock_t rtpe_callhash_lock;
GHashTable *rtpe_callhash; GHashTable *rtpe_callhash;
@ -533,7 +533,7 @@ void call_timer(void *ptr) {
GList *i, *l; GList *i, *l;
struct rtpengine_list_entry *ke; struct rtpengine_list_entry *ke;
struct packet_stream *ps; struct packet_stream *ps;
struct stats tmpstats;
struct global_stats tmpstats;
int j, update; int j, update;
struct stream_fd *sfd; struct stream_fd *sfd;
struct rtp_stats *rs; struct rtp_stats *rs;


+ 2
- 2
daemon/call_interfaces.c View File

@ -1612,7 +1612,7 @@ const char *call_delete_ng(bencode_item_t *input, bencode_item_t *output) {
return NULL; return NULL;
} }
static void ng_stats(bencode_item_t *d, const struct stats *s, struct stats *totals) {
static void ng_stats(bencode_item_t *d, const struct stream_stats *s, struct stream_stats *totals) {
bencode_dictionary_add_integer(d, "packets", atomic64_get(&s->packets)); bencode_dictionary_add_integer(d, "packets", atomic64_get(&s->packets));
bencode_dictionary_add_integer(d, "bytes", atomic64_get(&s->bytes)); bencode_dictionary_add_integer(d, "bytes", atomic64_get(&s->bytes));
bencode_dictionary_add_integer(d, "errors", atomic64_get(&s->errors)); bencode_dictionary_add_integer(d, "errors", atomic64_get(&s->errors));
@ -1637,7 +1637,7 @@ static void ng_stats_stream(bencode_item_t *list, const struct packet_stream *ps
struct call_stats *totals) struct call_stats *totals)
{ {
bencode_item_t *dict = NULL, *flags; bencode_item_t *dict = NULL, *flags;
struct stats *s;
struct stream_stats *s;
if (!list) if (!list)
goto stats; goto stats;


+ 1
- 1
daemon/cdr.c View File

@ -158,7 +158,7 @@ void cdr_update_entry(struct call* c) {
cdrlinecnt, md->index, protocol, addr, cdrlinecnt, md->index, protocol, addr,
cdrlinecnt, md->index, protocol, ps->endpoint.port, cdrlinecnt, md->index, protocol, ps->endpoint.port,
cdrlinecnt, md->index, protocol, local_addr, cdrlinecnt, md->index, protocol, local_addr,
cdrlinecnt, md->index, protocol, (unsigned int) (ps->sfd ? ps->sfd->fd.localport : 0),
cdrlinecnt, md->index, protocol, (unsigned int) (ps->selected_sfd ? ps->selected_sfd->socket.local.port : 0),
cdrlinecnt, md->index, protocol, cdrlinecnt, md->index, protocol,
atomic64_get(&ps->stats.packets), atomic64_get(&ps->stats.packets),
cdrlinecnt, md->index, protocol, cdrlinecnt, md->index, protocol,


+ 1
- 1
daemon/redis.c View File

@ -1129,7 +1129,7 @@ static int redis_hash_get_endpoint(struct endpoint *out, const struct redis_hash
return 0; return 0;
} }
static int redis_hash_get_stats(struct stats *out, const struct redis_hash *h, const char *k) {
static int redis_hash_get_stats(struct stream_stats *out, const struct redis_hash *h, const char *k) {
if (redis_hash_get_a64_f(&out->packets, h, "%s-packets", k)) if (redis_hash_get_a64_f(&out->packets, h, "%s-packets", k))
return -1; return -1;
if (redis_hash_get_a64_f(&out->bytes, h, "%s-bytes", k)) if (redis_hash_get_a64_f(&out->bytes, h, "%s-bytes", k))


+ 5
- 5
include/call.h View File

@ -312,8 +312,8 @@ struct packet_stream {
struct send_timer *send_timer; /* RO */ struct send_timer *send_timer; /* RO */
struct jitter_buffer *jb; /* RO */ struct jitter_buffer *jb; /* RO */
struct stats stats;
struct stats kernel_stats;
struct stream_stats stats;
struct stream_stats kernel_stats;
unsigned char in_tos_tclass; unsigned char in_tos_tclass;
atomic64 last_packet; atomic64 last_packet;
GHashTable *rtp_stats; /* LOCK: call->master_lock */ GHashTable *rtp_stats; /* LOCK: call->master_lock */
@ -541,9 +541,9 @@ extern rwlock_t rtpe_callhash_lock;
extern GHashTable *rtpe_callhash; 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_stats_cumulative; // total, cumulative
extern struct stats rtpe_stats; /* copied from statsps once a second */
extern struct global_stats rtpe_statsps; /* per second stats, running timer */
extern struct global_stats rtpe_stats_cumulative; // total, cumulative
extern struct global_stats rtpe_stats; /* copied from statsps once a second */
#define RTPE_STATS_ADD(field, num) \ #define RTPE_STATS_ADD(field, num) \
do { \ do { \


+ 11
- 2
include/statistics.h View File

@ -3,17 +3,26 @@
#include "aux.h" #include "aux.h"
#include "bencode.h" #include "bencode.h"
#include "rtpengine_config.h"
struct call; struct call;
struct packet_stream; struct packet_stream;
struct stats {
struct stream_stats {
atomic64 packets; atomic64 packets;
atomic64 bytes; atomic64 bytes;
atomic64 errors; atomic64 errors;
#if RE_HAS_MEASUREDELAY
uint64_t delay_min; uint64_t delay_min;
uint64_t delay_avg; uint64_t delay_avg;
uint64_t delay_max; uint64_t delay_max;
#endif
};
struct global_stats {
atomic64 packets;
atomic64 bytes;
atomic64 errors;
atomic64 foreign_sessions; // unresponsible via redis notification atomic64 foreign_sessions; // unresponsible via redis notification
atomic64 offers; atomic64 offers;
atomic64 answers; atomic64 answers;
@ -114,7 +123,7 @@ struct stats_metric {
struct call_stats { struct call_stats {
time_t last_packet; time_t last_packet;
struct stats totals[4]; /* rtp in, rtcp in, rtp out, rtcp out */
struct stream_stats totals[4]; /* rtp in, rtcp in, rtp out, rtcp out */
}; };
extern struct totalstats rtpe_totalstats; extern struct totalstats rtpe_totalstats;


Loading…
Cancel
Save