diff --git a/modules/tm/t_funcs.c b/modules/tm/t_funcs.c index e6788ef..385f184 100644 --- a/modules/tm/t_funcs.c +++ b/modules/tm/t_funcs.c @@ -53,6 +53,7 @@ #include "t_msgbuilder.h" #include "t_lookup.h" #include "config.h" +#include "t_stats.h" #include "../../context.h" @@ -144,7 +145,8 @@ void put_on_wait( struct cell *Trans ) 4. WAIT timer executed, transaction deleted */ - set_1timer( &Trans->wait_tl, WT_TIMER_LIST, 0 ); + if (set_1timer( &Trans->wait_tl, WT_TIMER_LIST, 0 )==0) + stats_trans_code(Trans->uas.status); } diff --git a/modules/tm/t_stats.h b/modules/tm/t_stats.h index 37b9e2b..dfc3c12 100644 --- a/modules/tm/t_stats.h +++ b/modules/tm/t_stats.h @@ -48,10 +48,12 @@ extern stat_var *tm_trans_inuse; #ifdef STATISTICS -inline static void stats_trans_rpl( int code, int local ) { - - stat_var *numerical_stat; - +/* update the statistics regading the final codes of the transactions + * A single transaction will generate a single update on one of + * these statistics + */ +inline static void stats_trans_code( int code) +{ if (tm_enable_stats) { if (code>=700) { return; @@ -66,6 +68,19 @@ inline static void stats_trans_rpl( int code, int local ) { } else if (code>=200) { update_stat( tm_trans_2xx, 1); } + } +} + +/* update the statistics regading the final replies sent to UAC side + * A single transaction may generate multiple updates on different + * statistics if (1) there is a retransmission of the final reply or + * (2) there are multiple final replies (like multi 200 OK) + */ +inline static void stats_trans_rpl( int code, int local ) +{ + stat_var *numerical_stat; + + if (tm_enable_stats) { if (local) update_stat( tm_loc_rpls, 1); else @@ -91,6 +106,7 @@ inline static void stats_trans_new( int local ) { } } #else + #define stats_trans_code( _code ) #define stats_trans_rpl( _code , _local ) #define stats_trans_new( _local ) #endif diff --git a/modules/tm/timer.c b/modules/tm/timer.c index bf531be..c703197 100644 --- a/modules/tm/timer.c +++ b/modules/tm/timer.c @@ -939,11 +939,12 @@ end: /* similar to set_timer, except it allows only one-time timer setting and all later attempts are ignored */ -void set_1timer( struct timer_link *new_tl, enum lists list_id, +int set_1timer( struct timer_link *new_tl, enum lists list_id, utime_t* ext_timeout ) { utime_t timeout; struct timer* list; + int ret = -1; if (list_id>=NR_OF_TIMER_LISTS) { @@ -951,7 +952,7 @@ void set_1timer( struct timer_link *new_tl, enum lists list_id, #ifdef EXTRA_DEBUG abort(); #endif - return; + return ret; } if (!ext_timeout) { @@ -966,8 +967,11 @@ void set_1timer( struct timer_link *new_tl, enum lists list_id, if (!new_tl->time_out) { insert_timer_unsafe( list, new_tl, timeout + ((timer_id2type[list_id]==UTIME_TYPE)?get_uticks():get_ticks())); + ret = 0; } unlock(list->mutex); + + return ret; } diff --git a/modules/tm/timer.h b/modules/tm/timer.h index a3c80cd..e41a7ac 100644 --- a/modules/tm/timer.h +++ b/modules/tm/timer.h @@ -107,7 +107,7 @@ void set_timer( struct timer_link *new_tl, enum lists list_id, /* similar to set_timer, except it allows only one-time timer setting and all later attempts are ignored */ -void set_1timer( struct timer_link *new_tl, enum lists list_id, +int set_1timer( struct timer_link *new_tl, enum lists list_id, utime_t* ext_timeout ); void timer_routine( unsigned int, void*);