Ignore:
Timestamp:
Dec 7, 2009, 2:05:31 AM (11 years ago)
Author:
Sam Hocevar
Message:

Increase profiling timers' sliding mean accuracy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/caca_prof.h

    r4094 r4095  
    2222#   define PROFILING_VARS
    2323
    24 #   define STAT_IADD(s, n) \
     24#   define STAT_IADD(_s, _n) \
    2525      do \
    2626      { \
    27         struct caca_stat *ss = s; \
    28         int ii, nn = n; \
    29         for (ii = STAT_VALUES - 1; ii > 0; ii--) \
    30             ss->itable[ii] = ss->itable[ii - 1]; \
    31         ss->itable[0] = nn; \
    32         ss->imean = ((int64_t)ss->imean * 15 + nn) / 16; \
     27        struct caca_stat *s = _s; \
     28        int i, n = _n; \
     29        for (i = STAT_VALUES - 1; i > 0; i--) \
     30            s->itable[i] = s->itable[i - 1]; \
     31        s->itable[0] = n; \
     32        s->imean = (s->imean * 63 + (int64_t)n * 64 + 32) / 64; \
    3333      } \
    3434      while(0)
     
    3939#else
    4040#   define PROFILING_VARS
    41 #   define STAT_IADD(s) do { } while(0)
     41#   define STAT_IADD(_s, _n) do { } while(0)
    4242#   define START_PROF(obj, fn) do { } while(0)
    4343#   define STOP_PROF(obj, fn) do { } while(0)
Note: See TracChangeset for help on using the changeset viewer.