Browse Source

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
Daniel-Constantin Mierla 11 years ago
parent
commit
82e742fcdd
1 changed files with 12 additions and 9 deletions
  1. 12 9
      modules/tmx/tmx_mod.c

+ 12 - 9
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)
 {