TT#101150 add test script for stats output

Change-Id: I13cc172b082e78c3d52032bd72e0a2f5158c71ed
pull/1373/head
Richard Fuchs 4 years ago
parent fd064304bb
commit 30d91ecc63

@ -528,7 +528,7 @@ static void update_requests_per_second_stats(struct requests_ps *request, uint64
mutex_unlock(&request->lock);
}
static void call_timer(void *ptr) {
void call_timer(void *ptr) {
struct iterator_helper hlp;
GList *i, *l;
struct rtpengine_list_entry *ke;

@ -50,7 +50,7 @@ const char *ng_command_strings_short[NGC_COUNT] = {
"Pub", "SubReq", "SubAns", "Unsub",
};
static void timeval_update_request_time(struct request_time *request, const struct timeval *offer_diff) {
void timeval_update_request_time(struct request_time *request, const struct timeval *offer_diff) {
// lock offers
mutex_lock(&request->lock);

@ -101,13 +101,7 @@ static int connect_to_graphite_server(const endpoint_t *graphite_ep) {
return 0;
}
static int send_graphite_data(struct totalstats *sent_data) {
if (graphite_sock.fd < 0) {
ilog(LOG_ERROR,"Graphite socket is not connected.");
return -1;
}
GString *print_graphite_data(struct totalstats *sent_data) {
struct totalstats *ts = sent_data;
/* atomically copy values to stack and reset to zero */
@ -280,6 +274,18 @@ static int send_graphite_data(struct totalstats *sent_data) {
(unsigned long long)ts->delete.time_max.tv_sec,(unsigned long long)ts->delete.time_max.tv_usec,
(unsigned long long)ts->delete.time_avg.tv_sec,(unsigned long long)ts->delete.time_avg.tv_usec);
return graph_str;
}
static int send_graphite_data(struct totalstats *sent_data) {
if (graphite_sock.fd < 0) {
ilog(LOG_ERROR,"Graphite socket is not connected.");
return -1;
}
GString *graph_str = print_graphite_data(sent_data);
size_t sent = 0;
int blockings = 10; // let it block that many times
while (sent < graph_str->len) {

@ -595,6 +595,7 @@ int call_stream_address46(char *o, struct packet_stream *ps, enum stream_address
int *len, const struct local_intf *ifa, int keep_unspec);
void add_total_calls_duration_in_interval(struct timeval *interval_tv);
void call_timer(void *ptr);
void __rtp_stats_update(GHashTable *dst, struct codec_store *);
int __init_stream(struct packet_stream *ps);

@ -75,6 +75,7 @@ void control_ng_init(void);
void control_ng_cleanup(void);
int control_ng_process(str *buf, const endpoint_t *sin, char *addr,
void (*cb)(str *, str *, const endpoint_t *, void *), void *p1, struct obj *);
void timeval_update_request_time(struct request_time *request, const struct timeval *offer_diff);
INLINE void ng_buffer_release(struct ng_buffer *ngbuf) {
mutex_unlock(&ngbuf->lock);

@ -23,4 +23,7 @@ void free_prefix(void);
void graphite_loop(void *d);
void set_latest_graphite_interval_start(struct timeval *tv);
void set_graphite_interval_tv(struct timeval *tv);
GString *print_graphite_data(struct totalstats *sent_data);
#endif /* GRAPHITE_H_ */

2
t/.gitignore vendored

@ -71,3 +71,5 @@ mqtt.c
cli.c
janus.c
websocket.c
test-stats
ssllib.c

@ -61,12 +61,12 @@ LDLIBS+= $(shell mysql_config --libs)
endif
SRCS= test-bitstr.c aes-crypt.c aead-aes-crypt.c test-const_str_hash.strhash.c
LIBSRCS= loglib.c auxlib.c str.c rtplib.c
LIBSRCS= loglib.c auxlib.c str.c rtplib.c ssllib.c
DAEMONSRCS= crypto.c ssrc.c aux.c rtp.c
HASHSRCS=
ifeq ($(with_transcoding),yes)
SRCS+= test-transcode.c test-dtmf-detect.c test-payload-tracker.c test-resample.c
SRCS+= test-transcode.c test-dtmf-detect.c test-payload-tracker.c test-resample.c test-stats.c
SRCS+= spandsp_recv_fax_pcm.c spandsp_recv_fax_t38.c spandsp_send_fax_pcm.c \
spandsp_send_fax_t38.c
ifeq ($(with_amr_tests),yes)
@ -82,7 +82,7 @@ endif
OBJS= $(SRCS:.c=.o) $(LIBSRCS:.c=.o) $(DAEMONSRCS:.c=.o) $(HASHSRCS:.c=.strhash.o)
COMMONOBJS= str.o auxlib.o rtplib.o loglib.o
COMMONOBJS= str.o auxlib.o rtplib.o loglib.o ssllib.o
include ../lib/common.Makefile
@ -91,7 +91,7 @@ include ../lib/common.Makefile
TESTS= test-bitstr aes-crypt aead-aes-crypt test-const_str_hash.strhash
ifeq ($(with_transcoding),yes)
TESTS+= test-transcode test-dtmf-detect test-payload-tracker test-resample
TESTS+= test-transcode test-dtmf-detect test-payload-tracker test-resample test-stats
ifeq ($(with_amr_tests),yes)
TESTS+= test-amr-decode test-amr-encode
endif
@ -185,6 +185,14 @@ aes-crypt: aes-crypt.o $(COMMONOBJS) crypto.o
aead-aes-crypt: aead-aes-crypt.o $(COMMONOBJS) crypto.o
test-stats: test-stats.o $(COMMONOBJS) codeclib.o resample.o codec.o ssrc.o call.o ice.o aux.o \
kernel.o media_socket.o stun.o bencode.o socket.o poller.o dtls.o recording.o statistics.o \
rtcp.o redis.o iptables.o graphite.o call_interfaces.strhash.o sdp.strhash.o rtp.o crypto.o \
control_ng.strhash.o graphite.o \
streambuf.o cookie_cache.o udp_listener.o homer.o load.o cdr.o dtmf.o timerthread.o \
media_player.o jitter_buffer.o dtmflib.o t38.o tcp_listener.o mqtt.o janus.strhash.o \
websocket.o cli.o
test-transcode: test-transcode.o $(COMMONOBJS) codeclib.o resample.o codec.o ssrc.o call.o ice.o aux.o \
kernel.o media_socket.o stun.o bencode.o socket.o poller.o dtls.o recording.o statistics.o \
rtcp.o redis.o iptables.o graphite.o call_interfaces.strhash.o sdp.strhash.o rtp.o crypto.o \

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save