[Kamailio-Devel] calculating average statistics

Juha Heinanen jh at tutpro.com
Wed Aug 27 15:18:59 CEST 2008


it turned out that average stat cannot be easily calculated, because
simple moving average favors old values and is therefore not very
useful.  a weighted or exponential average implementation, on the other
hand, would require storing also values of older values, which would be
too costly.

after average dead end, i tried to add min_update and max_update stats
macros.  they work fine, but if i try to initialize min stats variable
in mod_init, kamailio does not start at all:

update_min(peering_min_verify_dst_delay, MAX_UINT);

if i comment the above line, kamalio starts fine.  could it be that
module's statistics variables are not processed yet, when mod_init is
executed?

what comes to kamailio statistics in general,  it is like i mentioned in
my previous message: current statistics implementation does not support
anything else but counter statistics, which i consider a big
limitation.  

other statistics (like min/max) could be supported, but it requires that
atomic and non-atomic stuff is activated at the same time.
unfortunately also value field in struct stat_var is atomic/non-atomic
dependent:

#ifdef NO_ATOMIC_OPS
typedef unsigned int stat_val;
#else
typedef atomic_t stat_val;
#endif

this means that even if you have a non-atomic implementation of some
stats, it has to use on i386 architecture atomic value representation.
in theory, one could add both in the union, but that would mean even
bigger changes in statistics implementation.

in summary, current statistics implementation becomes a mess if one
tries to implement other stats than counters and i, as a simple module
programmer, may not be the right person to clean the mess up.

-- juha



More information about the Devel mailing list