Changeset 593 for branches/1.3/xcache.c
- Timestamp:
- 07/05/2009 06:06:15 AM (4 years ago)
- Location:
- branches/1.3
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
-
branches/1.3/xcache.c
r560 r593 30 30 #include "xcache_globals.h" 31 31 #include "processor.h" 32 #include "utils.h"33 32 #include "const_string.h" 34 33 #include "opcode_spec.h" 35 36 #ifdef DEBUG 37 # undef NDEBUG 38 # undef inline 39 # define inline 40 #else 41 # ifndef NDEBUG 42 # define NDEBUG 43 # endif 44 #endif 45 #include <assert.h> 34 #include "utils.h" 46 35 47 36 #define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > pentry->ctime + (pentry)->ttl) … … 245 234 static void xc_entry_hold_php_dmz(xc_entry_t *xce TSRMLS_DC) /* {{{ */ 246 235 { 247 #ifdef DEBUG 248 fprintf(stderr, "hold %s\n", xce->name.str.val); 249 #endif 236 TRACE("hold %s", xce->name.str.val); 250 237 xce->refcount ++; 251 238 xc_stack_push(&XG(php_holds)[xce->cache->cacheid], (void *)xce); … … 292 279 static XC_ENTRY_APPLY_FUNC(xc_gc_expires_php_entry_dmz) /* {{{ */ 293 280 { 294 #ifdef DEBUG 295 fprintf(stderr, "ttl %lu, %lu %lu\n", (zend_ulong) XG(request_time), (zend_ulong) entry->atime, xc_php_ttl); 296 #endif 281 TRACE("ttl %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) entry->atime, xc_php_ttl); 297 282 if (XG(request_time) > entry->atime + xc_php_ttl) { 298 283 return 1; … … 311 296 static void xc_gc_expires_one(xc_cache_t *cache, zend_ulong gc_interval, cache_apply_dmz_func_t apply_func TSRMLS_DC) /* {{{ */ 312 297 { 313 #ifdef DEBUG 314 fprintf(stderr, "interval %lu, %lu %lu\n", (zend_ulong) XG(request_time), (zend_ulong) cache->last_gc_expires, gc_interval); 315 #endif 298 TRACE("interval %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) cache->last_gc_expires, gc_interval); 316 299 if (XG(request_time) - cache->last_gc_expires >= gc_interval) { 317 300 ENTER_LOCK(cache) { … … 630 613 for (i = 0; i < cachecount; i ++) { 631 614 s = &holds[i]; 632 #ifdef DEBUG 633 fprintf(stderr, "holded %d\n", xc_stack_size(s)); 634 #endif 635 if (xc_stack_size(s)) { 615 TRACE("holded %d", xc_stack_count(s)); 616 if (xc_stack_count(s)) { 636 617 cache = ((xc_entry_t *)xc_stack_top(s))->cache; 637 618 ENTER_LOCK(cache) { 638 while (xc_stack_ size(s)) {619 while (xc_stack_count(s)) { 639 620 xce = (xc_entry_t*) xc_stack_pop(s); 640 #ifdef DEBUG 641 fprintf(stderr, "unhold %s\n", xce->name.str.val); 642 #endif 621 TRACE("unhold %s", xce->name.str.val); 643 622 xce->refcount --; 644 623 assert(xce->refcount >= 0); … … 829 808 assert(0); 830 809 } 831 #ifdef DEBUG 832 fprintf(stderr, "got ZEND_DECLARE_INHERITED_CLASS: %s\n", class_name + 1); 833 #endif 810 TRACE("got ZEND_DECLARE_INHERITED_CLASS: %s", class_name + 1); 834 811 /* let's see which class */ 835 812 for (i = 0; i < php->classinfo_cnt; i ++) { … … 915 892 /* found */ 916 893 if (stored_xce) { 917 #ifdef DEBUG 918 fprintf(stderr, "found %s, catch it\n", stored_xce->name.str.val); 919 #endif 894 TRACE("found %s, catch it", stored_xce->name.str.val); 920 895 xc_entry_hold_php_dmz(stored_xce TSRMLS_CC); 921 896 cache->hits ++; … … 944 919 945 920 /* {{{ compile */ 946 #ifdef DEBUG 947 fprintf(stderr, "compiling %s\n", filename); 948 #endif 921 TRACE("compiling %s", filename); 949 922 950 923 /* make compile inside sandbox */ … … 1125 1098 } LEAVE_LOCK_EX(cache); 1126 1099 /* }}} */ 1127 #ifdef DEBUG 1128 fprintf(stderr, "stored\n"); 1129 #endif 1100 TRACE("%s", "stored"); 1130 1101 1131 1102 #define X_FREE(var) \ … … 1186 1157 CG(compiled_filename) = stored_xce->name.str.val; 1187 1158 CG(zend_lineno) = 0; 1188 #ifdef DEBUG 1189 fprintf(stderr, "restoring %s\n", stored_xce->name.str.val); 1190 #endif 1159 TRACE("restoring %s", stored_xce->name.str.val); 1191 1160 xc_processor_restore_xc_entry_t(&xce, stored_xce, xc_readonly_protection TSRMLS_CC); 1192 1161 #ifdef SHOW_DPRINT … … 1221 1190 CG(in_compilation) = 0; 1222 1191 CG(compiled_filename) = NULL; 1223 #ifdef DEBUG 1224 fprintf(stderr, "restored %s\n", stored_xce->name.str.val); 1225 #endif 1192 TRACE("restored %s", stored_xce->name.str.val); 1226 1193 return op_array; 1227 1194 } … … 2006 1973 stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC); 2007 1974 if (stored_xce) { 2008 #ifdef DEBUG 2009 fprintf(stderr, "incdec: gotxce %s\n", xce.name.str.val); 2010 #endif 1975 TRACE("incdec: gotxce %s", xce.name.str.val); 2011 1976 /* timeout */ 2012 1977 if (VAR_ENTRY_EXPIRED(stored_xce)) { 2013 #ifdef DEBUG 2014 fprintf(stderr, "incdec: expired\n"); 2015 #endif 1978 TRACE("%s", "incdec: expired"); 2016 1979 xc_entry_remove_dmz(stored_xce TSRMLS_CC); 2017 1980 stored_xce = NULL; … … 2024 1987 stored_xce->ctime = XG(request_time); 2025 1988 stored_xce->ttl = xce.ttl; 2026 #ifdef DEBUG 2027 fprintf(stderr, "incdec: islong\n"); 2028 #endif 1989 TRACE("%s", "incdec: islong"); 2029 1990 value = Z_LVAL_P(stored_var->value); 2030 1991 value += (inc == 1 ? count : - count); … … 2036 1997 } 2037 1998 else { 2038 #ifdef DEBUG 2039 fprintf(stderr, "incdec: notlong\n"); 2040 #endif 1999 TRACE("%s", "incdec: notlong"); 2041 2000 xc_processor_restore_zval(&oldzval, stored_xce->data.var->value, stored_xce->have_references TSRMLS_CC); 2042 2001 convert_to_long(&oldzval); … … 2046 2005 } 2047 2006 } 2048 #ifdef DEBUG2049 2007 else { 2050 fprintf(stderr, "incdec: %s not found\n", xce.name.str.val); 2051 } 2052 #endif 2008 TRACE("incdec: %s not found", xce.name.str.val); 2009 } 2053 2010 2054 2011 value += (inc == 1 ? count : - count); … … 2495 2452 2496 2453 zend_llist_prepend_element(&zend_extensions, &extension); 2497 #ifdef DEBUG 2498 fprintf(stderr, "registered\n"); 2499 #endif 2454 TRACE("%s", "registered"); 2500 2455 } 2501 2456

