Enable LIBPRI_COUNTERS code by default.

Removed the conditional LIBPRI_COUNTERS to include the code
unconditionally.

Patches:
      enable_LIBPRI_COUNTERS_LIBPRI-61.diff uploaded by jbigelow

JIRA LIBPRI-61


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2183 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Richard Mudgett 2011-02-01 00:37:49 +00:00
parent 261ab22dda
commit 82a0a8e2ab
5 changed files with 2 additions and 20 deletions

View File

@ -24,9 +24,6 @@
# Uncomment if you want libpri not send PROGRESS_INDICATOR w/ALERTING # Uncomment if you want libpri not send PROGRESS_INDICATOR w/ALERTING
#ALERTING=-DALERTING_NO_PROGRESS #ALERTING=-DALERTING_NO_PROGRESS
# Uncomment if you want libpri to count number of Q921/Q931 sent/received
#LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
CC=gcc CC=gcc
GREP=grep GREP=grep
AWK=awk AWK=awk
@ -93,7 +90,7 @@ DYNAMIC_OBJS= \
rose_qsig_mwi.lo \ rose_qsig_mwi.lo \
rose_qsig_name.lo \ rose_qsig_name.lo \
version.lo version.lo
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS) $(LIBPRI_OPT) $(COVERAGE_CFLAGS) CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_OPT) $(COVERAGE_CFLAGS)
INSTALL_PREFIX=$(DESTDIR) INSTALL_PREFIX=$(DESTDIR)
INSTALL_BASE=/usr INSTALL_BASE=/usr
libdir?=$(INSTALL_BASE)/lib libdir?=$(INSTALL_BASE)/lib

7
pri.c
View File

@ -476,12 +476,11 @@ static struct pri *pri_ctrl_new(int fd, int node, int switchtype, pri_io_cb rd,
ctrl->nsf = PRI_NSF_NONE; ctrl->nsf = PRI_NSF_NONE;
ctrl->callpool = &ctrl->localpool; ctrl->callpool = &ctrl->localpool;
pri_default_timers(ctrl, switchtype); pri_default_timers(ctrl, switchtype);
#ifdef LIBPRI_COUNTERS
ctrl->q921_rxcount = 0; ctrl->q921_rxcount = 0;
ctrl->q921_txcount = 0; ctrl->q921_txcount = 0;
ctrl->q931_rxcount = 0; ctrl->q931_rxcount = 0;
ctrl->q931_txcount = 0; ctrl->q931_txcount = 0;
#endif
switch (switchtype) { switch (switchtype) {
case PRI_SWITCH_GR303_EOC: case PRI_SWITCH_GR303_EOC:
ctrl->protodisc = GR303_PROTOCOL_DISCRIMINATOR; ctrl->protodisc = GR303_PROTOCOL_DISCRIMINATOR;
@ -1653,11 +1652,9 @@ char *pri_dump_info_str(struct pri *ctrl)
char *buf; char *buf;
size_t buf_size; size_t buf_size;
size_t used; size_t used;
#ifdef LIBPRI_COUNTERS
struct q921_frame *f; struct q921_frame *f;
struct q921_link *link; struct q921_link *link;
unsigned q921outstanding; unsigned q921outstanding;
#endif
unsigned idx; unsigned idx;
unsigned long switch_bit; unsigned long switch_bit;
@ -1676,7 +1673,6 @@ char *pri_dump_info_str(struct pri *ctrl)
used = pri_snprintf(buf, used, buf_size, "Switchtype: %s\n", used = pri_snprintf(buf, used, buf_size, "Switchtype: %s\n",
pri_switch2str(ctrl->switchtype)); pri_switch2str(ctrl->switchtype));
used = pri_snprintf(buf, used, buf_size, "Type: %s\n", pri_node2str(ctrl->localtype)); used = pri_snprintf(buf, used, buf_size, "Type: %s\n", pri_node2str(ctrl->localtype));
#ifdef LIBPRI_COUNTERS
/* Remember that Q921 Counters include Q931 packets (and any retransmissions) */ /* Remember that Q921 Counters include Q931 packets (and any retransmissions) */
used = pri_snprintf(buf, used, buf_size, "Q931 RX: %d\n", ctrl->q931_rxcount); used = pri_snprintf(buf, used, buf_size, "Q931 RX: %d\n", ctrl->q931_rxcount);
used = pri_snprintf(buf, used, buf_size, "Q931 TX: %d\n", ctrl->q931_txcount); used = pri_snprintf(buf, used, buf_size, "Q931 TX: %d\n", ctrl->q931_txcount);
@ -1690,7 +1686,6 @@ char *pri_dump_info_str(struct pri *ctrl)
used = pri_snprintf(buf, used, buf_size, "Q921 Outstanding: %u (TEI=%d)\n", used = pri_snprintf(buf, used, buf_size, "Q921 Outstanding: %u (TEI=%d)\n",
q921outstanding, link->tei); q921outstanding, link->tei);
} }
#endif
#if 0 #if 0
used = pri_snprintf(buf, used, buf_size, "Window Length: %d/%d\n", used = pri_snprintf(buf, used, buf_size, "Window Length: %d/%d\n",
ctrl->timers[PRI_TIMER_K], ctrl->window); ctrl->timers[PRI_TIMER_K], ctrl->window);

View File

@ -135,13 +135,11 @@ struct pri {
struct q931_call **callpool; struct q931_call **callpool;
struct q931_call *localpool; struct q931_call *localpool;
#ifdef LIBPRI_COUNTERS
/* q921/q931 packet counters */ /* q921/q931 packet counters */
unsigned int q921_txcount; unsigned int q921_txcount;
unsigned int q921_rxcount; unsigned int q921_rxcount;
unsigned int q931_txcount; unsigned int q931_txcount;
unsigned int q931_rxcount; unsigned int q931_rxcount;
#endif
short last_invoke; /* Last ROSE invoke ID (Valid in master record only) */ short last_invoke; /* Last ROSE invoke ID (Valid in master record only) */

4
q921.c
View File

@ -183,9 +183,7 @@ static int q921_transmit(struct pri *ctrl, q921_h *h, int len)
return 0; return 0;
} }
#endif #endif
#ifdef LIBPRI_COUNTERS
ctrl->q921_txcount++; ctrl->q921_txcount++;
#endif
/* Just send it raw */ /* Just send it raw */
if (ctrl->debug & (PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW)) if (ctrl->debug & (PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW))
q921_dump(ctrl, h, len, ctrl->debug & PRI_DEBUG_Q921_RAW, 1); q921_dump(ctrl, h, len, ctrl->debug & PRI_DEBUG_Q921_RAW, 1);
@ -2959,9 +2957,7 @@ pri_event *q921_receive(struct pri *ctrl, q921_h *h, int len)
{ {
pri_event *e; pri_event *e;
e = __q921_receive(ctrl, h, len); e = __q921_receive(ctrl, h, len);
#ifdef LIBPRI_COUNTERS
ctrl->q921_rxcount++; ctrl->q921_rxcount++;
#endif
return e; return e;
} }

4
q931.c
View File

@ -4536,9 +4536,7 @@ static void q931_xmit(struct q921_link *link, q931_h *h, int len, int cr, int ui
struct pri *ctrl; struct pri *ctrl;
ctrl = link->ctrl; ctrl = link->ctrl;
#ifdef LIBPRI_COUNTERS
ctrl->q931_txcount++; ctrl->q931_txcount++;
#endif
if (uiframe) { if (uiframe) {
if (link->tei != Q921_TEI_GROUP) { if (link->tei != Q921_TEI_GROUP) {
pri_error(ctrl, "Huh?! Attempting to send UI-frame on TEI %d\n", link->tei); pri_error(ctrl, "Huh?! Attempting to send UI-frame on TEI %d\n", link->tei);
@ -6692,9 +6690,7 @@ int q931_receive(struct q921_link *link, q931_h *h, int len)
ctrl = link->ctrl; ctrl = link->ctrl;
memset(last_ie, 0, sizeof(last_ie)); memset(last_ie, 0, sizeof(last_ie));
#ifdef LIBPRI_COUNTERS
ctrl->q931_rxcount++; ctrl->q931_rxcount++;
#endif
if (len < 3 || len < 3 + h->crlen) { if (len < 3 || len < 3 + h->crlen) {
/* Message too short for supported protocols. */ /* Message too short for supported protocols. */
return -1; return -1;