Changeset 1057 for trunk/mod_cacher/xc_cacher.c
- Timestamp:
- 07/27/2012 09:52:12 AM (10 months ago)
- Files:
-
- 1 modified
-
trunk/mod_cacher/xc_cacher.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/mod_cacher/xc_cacher.c
r1051 r1057 389 389 } 390 390 /* }}} */ 391 static void xc_counters_inc(time_t *curtime, zend_uint *curslot, time_t period, zend_ulong *counters, zend_uint count TSRMLS_DC) /* {{{ */392 { 393 time_t n = XG(request_time) / period;391 static inline void xc_counters_inc(time_t *curtime, zend_uint *curslot, time_t interval, zend_ulong *counters, zend_uint count TSRMLS_DC) /* {{{ */ 392 { 393 time_t n = XG(request_time) / interval; 394 394 if (*curtime != n) { 395 395 zend_uint target_slot = n % count; 396 if (n - *curtime > period) { 397 memset(counters, 0, sizeof(counters[0]) * count); 398 } 399 else { 400 zend_uint slot; 401 for (slot = advance_wrapped(*curslot, count); 402 slot != target_slot; 403 slot = advance_wrapped(slot, count)) { 404 counters[slot] = 0; 405 } 406 counters[target_slot] = 0; 407 } 396 zend_uint slot; 397 for (slot = advance_wrapped(*curslot, count); 398 slot != target_slot; 399 slot = advance_wrapped(slot, count)) { 400 counters[slot] = 0; 401 } 402 counters[target_slot] = 0; 408 403 *curtime = n; 409 404 *curslot = target_slot; … … 412 407 } 413 408 /* }}} */ 414 static void xc_cache_hit_unlocked(xc_cache_t *cache TSRMLS_DC) /* {{{ */409 static inline void xc_cache_hit_unlocked(xc_cache_t *cache TSRMLS_DC) /* {{{ */ 415 410 { 416 411 cache->hits ++; … … 423 418 424 419 xc_counters_inc(&cache->hits_by_second_cur_time 425 , &cache->hits_by_second_cur_slot 426 , 1 420 , &cache->hits_by_second_cur_slot, 1 427 421 , cache->hits_by_second 428 422 , sizeof(cache->hits_by_second) / sizeof(cache->hits_by_second[0])

