Skip to content

Commit

Permalink
tmx: Consistent naming of counters
Browse files Browse the repository at this point in the history
Simplify the names of the tmx counters to "rpl_*".
  • Loading branch information
Stefan Mititelu committed Dec 14, 2015
1 parent 09be0ae commit 6e9f017
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 50 deletions.
16 changes: 8 additions & 8 deletions modules/tm/t_reply.c
Expand Up @@ -554,8 +554,8 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
/* t_update_timers_after_sending_reply( rb ); */
update_reply_stats( code );
trans->relayed_reply_branch=-2;
t_stats_relayed_locally();
t_stats_relayed_total();
t_stats_rpl_generated();
t_stats_rpl_sent();
if (lock) UNLOCK_REPLIES( trans );

/* do UAC cleanup procedures in case we generated
Expand Down Expand Up @@ -1867,7 +1867,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
}
}
update_reply_stats( relayed_code );
t_stats_relayed_total();
t_stats_rpl_sent();
if (!buf) {
LOG(L_ERR, "ERROR: relay_reply: "
"no mem for outbound reply buffer\n");
Expand All @@ -1890,7 +1890,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
memcpy( uas_rb->buffer, buf, res_len );
if (relayed_msg==FAKED_REPLY) { /* to-tags for local replies */
update_local_tags(t, &bm, uas_rb->buffer, buf);
t_stats_relayed_locally();
t_stats_rpl_generated();
}

/* update the status ... */
Expand Down Expand Up @@ -2041,15 +2041,15 @@ enum rps local_reply( struct cell *t, struct sip_msg *p_msg, int branch,
winning_msg= branch==local_winner
? p_msg : t->uac[local_winner].reply;
if (winning_msg==FAKED_REPLY) {
t_stats_relayed_locally();
t_stats_rpl_generated();
winning_code = branch==local_winner
? msg_status : t->uac[local_winner].last_received;
} else {
winning_code=winning_msg->REPLY_STATUS;
}
t->uas.status = winning_code;
update_reply_stats( winning_code );
t_stats_relayed_total();
t_stats_rpl_sent();
if (unlikely(is_invite(t) && winning_msg!=FAKED_REPLY &&
winning_code>=200 && winning_code <300 &&
has_tran_tmcbs(t, TMCB_LOCAL_COMPLETED) )) {
Expand Down Expand Up @@ -2143,8 +2143,8 @@ int reply_received( struct sip_msg *p_msg )
if ( (t==0)||(t==T_UNDEFINED))
goto trans_not_found;

/* if transaction found, increment the received_replies counter */
t_stats_received_replies();
/* if transaction found, increment the rpl_received counter */
t_stats_rpl_received();

if (unlikely(branch==T_BR_UNDEFINED))
BUG("invalid branch, please report to sr-dev@sip-router.org\n");
Expand Down
12 changes: 6 additions & 6 deletions modules/tm/t_stats.c
Expand Up @@ -93,9 +93,9 @@ void free_tm_stats()
(res)->completed_5xx=(s1)->completed_5xx+(s2)->completed_5xx; \
(res)->completed_6xx=(s1)->completed_6xx+(s2)->completed_6xx; \
(res)->completed_2xx=(s1)->completed_2xx+(s2)->completed_2xx; \
(res)->received_replies=(s1)->received_replies+(s2)->received_replies; \
(res)->relayed_locally=(s1)->relayed_locally+(s2)->relayed_locally; \
(res)->relayed_total=(s1)->relayed_total+(s2)->relayed_total; \
(res)->rpl_received=(s1)->rpl_received+(s2)->rpl_received; \
(res)->rpl_generated=(s1)->rpl_generated+(s2)->rpl_generated; \
(res)->rpl_sent=(s1)->rpl_sent+(s2)->rpl_sent; \
(res)->deleted=(s1)->deleted+(s2)->deleted; \
}while(0)

Expand Down Expand Up @@ -138,9 +138,9 @@ void tm_rpc_stats(rpc_t* rpc, void* c)
(unsigned) waiting);
rpc->struct_add(st, "d", "total", (unsigned) all.transactions);
rpc->struct_add(st, "d", "total_local", (unsigned)all.client_transactions);
rpc->struct_add(st, "d", "received_replies", (unsigned)all.received_replies);
rpc->struct_add(st, "d", "relayed_locally", (unsigned)all.relayed_locally);
rpc->struct_add(st, "d", "relayed_total", (unsigned)all.relayed_total);
rpc->struct_add(st, "d", "rpl_received", (unsigned)all.rpl_received);
rpc->struct_add(st, "d", "rpl_generated", (unsigned)all.rpl_generated);
rpc->struct_add(st, "d", "rpl_sent", (unsigned)all.rpl_sent);
rpc->struct_add(st, "ddddd",
"6xx", (unsigned int)all.completed_6xx,
"5xx", (unsigned int)all.completed_5xx,
Expand Down
18 changes: 9 additions & 9 deletions modules/tm/t_stats.h
Expand Up @@ -43,9 +43,9 @@ struct t_proc_stats {
/* number of transactions which completed with this status */
stat_counter completed_3xx, completed_4xx, completed_5xx,
completed_6xx, completed_2xx;
stat_counter received_replies;
stat_counter relayed_locally;
stat_counter relayed_total;
stat_counter rpl_received;
stat_counter rpl_generated;
stat_counter rpl_sent;
stat_counter deleted;
#ifdef TM_MORE_STATS
/* number of created transactions */
Expand Down Expand Up @@ -122,19 +122,19 @@ inline static void update_reply_stats( int code ) {
}
}

inline void static t_stats_received_replies(void)
inline void static t_stats_rpl_received(void)
{
tm_stats[process_no].s.received_replies++;
tm_stats[process_no].s.rpl_received++;
}

inline void static t_stats_relayed_locally(void)
inline void static t_stats_rpl_generated(void)
{
tm_stats[process_no].s.relayed_locally++;
tm_stats[process_no].s.rpl_generated++;
}

inline void static t_stats_relayed_total(void)
inline void static t_stats_rpl_sent(void)
{
tm_stats[process_no].s.relayed_total++;
tm_stats[process_no].s.rpl_sent++;
}


Expand Down
14 changes: 7 additions & 7 deletions modules/tmx/doc/tmx_admin.xml
Expand Up @@ -691,35 +691,35 @@ event_route [tm:branch-failure:contact] {
</section>

<section>
<title>received_replies</title>
<title>rpl_received</title>
<para>
Total number of replies received by TM module.
</para>
</section>

<section>
<title>received_replies_absorbed</title>
<title>rpl_absorbed</title>
<para>
Total number of replies received and not relayed by TM module.
</para>
</section>

<section>
<title>tmx:relayed_locally</title>
<title>rpl_relayed</title>
<para>
Total number of replies locally generated and relayed by TM module.
Total number of replies received and relayed by TM module.
</para>
</section>

<section>
<title>relayed_received </title>
<title>rpl_generated</title>
<para>
Total number of replies received and relayed by TM module.
Total number of replies locally generated and relayed by TM module.
</para>
</section>

<section>
<title>relayed_total</title>
<title>rpl_sent</title>
<para>
Total number of replies relayed by TM module.
</para>
Expand Down
40 changes: 20 additions & 20 deletions modules/tmx/tmx_mod.c
Expand Up @@ -114,21 +114,21 @@ unsigned long tmx_stats_rld_loc_rpls(void);
unsigned long tmx_stats_rld_tot_rpls(void);

static stat_export_t mod_stats[] = {
{"UAS_transactions" , STAT_IS_FUNC, (stat_var**)tmx_stats_uas_trans },
{"UAC_transactions" , STAT_IS_FUNC, (stat_var**)tmx_stats_uac_trans },
{"2xx_transactions" , STAT_IS_FUNC, (stat_var**)tmx_stats_trans_2xx },
{"3xx_transactions" , STAT_IS_FUNC, (stat_var**)tmx_stats_trans_3xx },
{"4xx_transactions" , STAT_IS_FUNC, (stat_var**)tmx_stats_trans_4xx },
{"5xx_transactions" , STAT_IS_FUNC, (stat_var**)tmx_stats_trans_5xx },
{"6xx_transactions" , STAT_IS_FUNC, (stat_var**)tmx_stats_trans_6xx },
{"inuse_transactions" , STAT_IS_FUNC, (stat_var**)tmx_stats_trans_inuse },
{"active_transactions" , STAT_IS_FUNC, (stat_var**)tmx_stats_trans_active},
{"received_replies" , STAT_IS_FUNC, (stat_var**)tmx_stats_rcv_rpls },
{"received_replies_absorbed", STAT_IS_FUNC, (stat_var**)tmx_stats_abs_rpls },
{"relayed_locally" , STAT_IS_FUNC, (stat_var**)tmx_stats_rld_loc_rpls},
{"relayed_received" , STAT_IS_FUNC, (stat_var**)tmx_stats_rld_rcv_rpls},
{"relayed_total" , STAT_IS_FUNC, (stat_var**)tmx_stats_rld_tot_rpls},
{0,0,0}
{"UAS_transactions", STAT_IS_FUNC, (stat_var**)tmx_stats_uas_trans },
{"UAC_transactions", STAT_IS_FUNC, (stat_var**)tmx_stats_uac_trans },
{"2xx_transactions", STAT_IS_FUNC, (stat_var**)tmx_stats_trans_2xx },
{"3xx_transactions", STAT_IS_FUNC, (stat_var**)tmx_stats_trans_3xx },
{"4xx_transactions", STAT_IS_FUNC, (stat_var**)tmx_stats_trans_4xx },
{"5xx_transactions", STAT_IS_FUNC, (stat_var**)tmx_stats_trans_5xx },
{"6xx_transactions", STAT_IS_FUNC, (stat_var**)tmx_stats_trans_6xx },
{"inuse_transactions", STAT_IS_FUNC, (stat_var**)tmx_stats_trans_inuse },
{"active_transactions", STAT_IS_FUNC, (stat_var**)tmx_stats_trans_active},
{"rpl_received", STAT_IS_FUNC, (stat_var**)tmx_stats_rcv_rpls },
{"rpl_absorbed", STAT_IS_FUNC, (stat_var**)tmx_stats_abs_rpls },
{"rpl_generated", STAT_IS_FUNC, (stat_var**)tmx_stats_rld_loc_rpls},
{"rpl_relayed", STAT_IS_FUNC, (stat_var**)tmx_stats_rld_rcv_rpls},
{"rpl_sent", STAT_IS_FUNC, (stat_var**)tmx_stats_rld_tot_rpls},
{0, 0, 0}
};
#endif

Expand Down Expand Up @@ -814,31 +814,31 @@ unsigned long tmx_stats_trans_active(void)
unsigned long tmx_stats_rcv_rpls(void)
{
tmx_stats_update();
return _tmx_stats_all.received_replies;
return _tmx_stats_all.rpl_received;
}

unsigned long tmx_stats_abs_rpls(void)
{
tmx_stats_update();
return _tmx_stats_all.received_replies - tmx_stats_rld_rcv_rpls();
return _tmx_stats_all.rpl_received - tmx_stats_rld_rcv_rpls();
}

unsigned long tmx_stats_rld_loc_rpls(void)
{
tmx_stats_update();
return _tmx_stats_all.relayed_locally;
return _tmx_stats_all.rpl_generated;
}

unsigned long tmx_stats_rld_tot_rpls(void)
{
tmx_stats_update();
return _tmx_stats_all.relayed_total;
return _tmx_stats_all.rpl_sent;
}

unsigned long tmx_stats_rld_rcv_rpls(void)
{
tmx_stats_update();
return _tmx_stats_all.relayed_total - _tmx_stats_all.relayed_locally;
return _tmx_stats_all.rpl_sent - _tmx_stats_all.rpl_generated;
}

#endif

0 comments on commit 6e9f017

Please sign in to comment.