Module: sip-router
Branch: master
Commit: 82e742fcdd7c22391cae8e3b36d42f23d684dee8
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=82e742fcdd7c22391cae8e3b36d42f23d684dee8

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date:   Fri Apr 11 16:04:24 2014 +0200

tmx: allow spanning over second for fetching stats

- try to catch the same snapshot for all tm stats
- re-enabled stats for received and relayed replies, computed from what
  is relayed and was was local reply
- todo: check if drops replies are caught later or is ok

---

 modules/tmx/tmx_mod.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/modules/tmx/tmx_mod.c b/modules/tmx/tmx_mod.c
index 89f5e65..d0e2ee2 100644
--- a/modules/tmx/tmx_mod.c
+++ b/modules/tmx/tmx_mod.c
@@ -91,10 +91,8 @@ unsigned long tmx_stats_trans_5xx(void);
 unsigned long tmx_stats_trans_6xx(void);
 unsigned long tmx_stats_trans_inuse(void);
 unsigned long tmx_stats_trans_active(void);
-#if 0
 unsigned long tmx_stats_rcv_rpls(void);
 unsigned long tmx_stats_rld_rpls(void);
-#endif
 unsigned long tmx_stats_loc_rpls(void);
 
 static stat_export_t mod_stats[] = {
@@ -107,10 +105,8 @@ static stat_export_t mod_stats[] = {
        {"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},
-#if 0
        {"received_replies" ,    STAT_IS_FUNC, (stat_var**)tmx_stats_rcv_rpls   
 },
        {"relayed_replies" ,     STAT_IS_FUNC, (stat_var**)tmx_stats_rld_rpls   
 },
-#endif
        {"local_replies" ,       STAT_IS_FUNC, (stat_var**)tmx_stats_loc_rpls   
 },
        {0,0,0}
 };
@@ -612,7 +608,7 @@ void tmx_stats_update(void)
 {
        ticks_t t;
        t = get_ticks();
-       if(t!=_tmx_stats_tm) {
+       if(t>_tmx_stats_tm+1) {
                _tmx_tmb.get_stats(&_tmx_stats_all);
                _tmx_stats_tm = t;
        }
@@ -672,19 +668,26 @@ unsigned long tmx_stats_trans_active(void)
        return (_tmx_stats_all.transactions - _tmx_stats_all.waiting);
 }
 
-#if 0
 unsigned long tmx_stats_rcv_rpls(void)
 {
        tmx_stats_update();
-       return 0;
+       return _tmx_stats_all.completed_6xx
+               + _tmx_stats_all.completed_5xx
+               + _tmx_stats_all.completed_4xx
+               + _tmx_stats_all.completed_3xx
+               + _tmx_stats_all.completed_2xx;
 }
 
 unsigned long tmx_stats_rld_rpls(void)
 {
        tmx_stats_update();
-       return 0;
+       return _tmx_stats_all.completed_6xx
+               + _tmx_stats_all.completed_5xx
+               + _tmx_stats_all.completed_4xx
+               + _tmx_stats_all.completed_3xx
+               + _tmx_stats_all.completed_2xx
+               - _tmx_stats_all.replied_locally;
 }
-#endif
 
 unsigned long tmx_stats_loc_rpls(void)
 {


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to