TT#101150 separate out `struct stream_stats`

Change-Id: I709060d9e805175bd99173df03e581b593506e15
pull/1373/head
Richard Fuchs 4 years ago
parent 9c3e5e1fd7
commit a1f3530292

@ -64,9 +64,9 @@ struct xmlrpc_helper {
/* 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;
GHashTable *rtpe_callhash;
@ -533,7 +533,7 @@ void call_timer(void *ptr) {
GList *i, *l;
struct rtpengine_list_entry *ke;
struct packet_stream *ps;
struct stats tmpstats;
struct global_stats tmpstats;
int j, update;
struct stream_fd *sfd;
struct rtp_stats *rs;

@ -1612,7 +1612,7 @@ const char *call_delete_ng(bencode_item_t *input, bencode_item_t *output) {
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, "bytes", atomic64_get(&s->bytes));
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)
{
bencode_item_t *dict = NULL, *flags;
struct stats *s;
struct stream_stats *s;
if (!list)
goto stats;

@ -158,7 +158,7 @@ void cdr_update_entry(struct call* c) {
cdrlinecnt, md->index, protocol, addr,
cdrlinecnt, md->index, protocol, ps->endpoint.port,
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,
atomic64_get(&ps->stats.packets),
cdrlinecnt, md->index, protocol,

@ -1129,7 +1129,7 @@ static int redis_hash_get_endpoint(struct endpoint *out, const struct redis_hash
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))
return -1;
if (redis_hash_get_a64_f(&out->bytes, h, "%s-bytes", k))

@ -312,8 +312,8 @@ struct packet_stream {
struct send_timer *send_timer; /* 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;
atomic64 last_packet;
GHashTable *rtp_stats; /* LOCK: call->master_lock */
@ -541,9 +541,9 @@ extern rwlock_t rtpe_callhash_lock;
extern GHashTable *rtpe_callhash;
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) \
do { \

@ -3,17 +3,26 @@
#include "aux.h"
#include "bencode.h"
#include "rtpengine_config.h"
struct call;
struct packet_stream;
struct stats {
struct stream_stats {
atomic64 packets;
atomic64 bytes;
atomic64 errors;
#if RE_HAS_MEASUREDELAY
uint64_t delay_min;
uint64_t delay_avg;
uint64_t delay_max;
#endif
};
struct global_stats {
atomic64 packets;
atomic64 bytes;
atomic64 errors;
atomic64 foreign_sessions; // unresponsible via redis notification
atomic64 offers;
atomic64 answers;
@ -114,7 +123,7 @@ struct stats_metric {
struct call_stats {
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;

Loading…
Cancel
Save