[Kamailio-Devel] calculating average statistics
Klaus Darilion
klaus.mailinglists at pernau.at
Tue Aug 26 13:55:39 CEST 2008
Henning Westerholt schrieb:
> On Monday 25 August 2008, Juha Heinanen wrote:
>> i'm not sure if current statistics.h interface allows keeping track of
>> average of something. if i use get_stat to get the current average and
>> current count value, do my calculation of new average and then update
>> average and count values, some other process may have in the meanwhile
>> done its update and thus messed up my calculation.
>>
>> in order to solve this, should there be a new update_average_stat macro
>> that does the above under a lock?
>
> Hi Juha,
>
> at the moment there are two ways of updating statistic values atomically. If
> NO_ATOMIC_OPS is defined, then one big lock is used. In this way i think it
> should not that difficult to implement a function like you described. But
> from a performance POV its better to use the atomic functions defined in
> atomic.h, which are the default i think. This functions are defined as some
> assembler instructions, and its probably a little harder to define here
> something like this.
>
> But i think it would be a good to have such a function.
Actually I have no clue about locks, I only know that in the past there
were heave atomic locks update in ser 2.0
regards
klaus
More information about the Devel
mailing list