Changeset 305 for trunk/xcache.c
- Timestamp:
- 2006-12-08T17:11:19+01:00 (6 years ago)
- File:
-
- 1 edited
-
trunk/xcache.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xcache.c
r299 r305 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) … … 243 232 static void xc_entry_hold_php_dmz(xc_entry_t *xce TSRMLS_DC) /* {{{ */ 244 233 { 245 #ifdef DEBUG 246 fprintf(stderr, "hold %s\n", xce->name.str.val); 247 #endif 234 TRACE("hold %s", xce->name.str.val); 248 235 xce->refcount ++; 249 236 xc_stack_push(&XG(php_holds)[xce->cache->cacheid], (void *)xce); … … 290 277 static XC_ENTRY_APPLY_FUNC(xc_gc_expires_php_entry_dmz) /* {{{ */ 291 278 { 292 #ifdef DEBUG 293 fprintf(stderr, "ttl %lu, %lu %lu\n", (zend_ulong) XG(request_time), (zend_ulong) entry->atime, xc_php_ttl); 294 #endif 279 TRACE("ttl %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) entry->atime, xc_php_ttl); 295 280 if (XG(request_time) > entry->atime + xc_php_ttl) { 296 281 return 1; … … 309 294 static void xc_gc_expires_one(xc_cache_t *cache, zend_ulong gc_interval, cache_apply_dmz_func_t apply_func TSRMLS_DC) /* {{{ */ 310 295 { 311 #ifdef DEBUG 312 fprintf(stderr, "interval %lu, %lu %lu\n", (zend_ulong) XG(request_time), (zend_ulong) cache->last_gc_expires, gc_interval); 313 #endif 296 TRACE("interval %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) cache->last_gc_expires, gc_interval); 314 297 if (XG(request_time) - cache->last_gc_expires >= gc_interval) { 315 298 ENTER_LOCK(cache) { … … 623 606 for (i = 0; i < cachecount; i ++) { 624 607 s = &holds[i]; 625 #ifdef DEBUG 626 fprintf(stderr, "holded %d\n", xc_stack_size(s)); 627 #endif 608 TRACE("holded %d", xc_stack_size(s)); 628 609 if (xc_stack_size(s)) { 629 610 cache = ((xc_entry_t *)xc_stack_top(s))->cache; … … 631 612 while (xc_stack_size(s)) { 632 613 xce = (xc_entry_t*) xc_stack_pop(s); 633 #ifdef DEBUG 634 fprintf(stderr, "unhold %s\n", xce->name.str.val); 635 #endif 614 TRACE("unhold %s", xce->name.str.val); 636 615 xce->refcount --; 637 616 assert(xce->refcount >= 0); … … 811 790 assert(0); 812 791 } 813 #ifdef DEBUG 814 fprintf(stderr, "got ZEND_DECLARE_INHERITED_CLASS: %s\n", class_name + 1); 815 #endif 792 TRACE("got ZEND_DECLARE_INHERITED_CLASS: %s", class_name + 1); 816 793 /* let's see which class */ 817 794 for (i = 0; i < php->classinfo_cnt; i ++) { … … 891 868 /* found */ 892 869 if (stored_xce) { 893 #ifdef DEBUG 894 fprintf(stderr, "found %s, catch it\n", stored_xce->name.str.val); 895 #endif 870 TRACE("found %s, catch it", stored_xce->name.str.val); 896 871 xc_entry_hold_php_dmz(stored_xce TSRMLS_CC); 897 872 cache->hits ++; … … 920 895 921 896 /* {{{ compile */ 922 #ifdef DEBUG 923 fprintf(stderr, "compiling %s\n", filename); 924 #endif 897 TRACE("compiling %s", filename); 925 898 926 899 /* make compile inside sandbox */ … … 1088 1061 } LEAVE_LOCK_EX(cache); 1089 1062 /* }}} */ 1090 #ifdef DEBUG 1091 fprintf(stderr, "stored\n"); 1092 #endif 1063 TRACE("%s", "stored"); 1093 1064 1094 1065 #define X_FREE(var) \ … … 1146 1117 CG(compiled_filename) = stored_xce->name.str.val; 1147 1118 CG(zend_lineno) = 0; 1148 #ifdef DEBUG 1149 fprintf(stderr, "restoring %s\n", stored_xce->name.str.val); 1150 #endif 1119 TRACE("restoring %s", stored_xce->name.str.val); 1151 1120 xc_processor_restore_xc_entry_t(&xce, stored_xce, xc_readonly_protection TSRMLS_CC); 1152 1121 #ifdef SHOW_DPRINT … … 1181 1150 CG(in_compilation) = 0; 1182 1151 CG(compiled_filename) = NULL; 1183 #ifdef DEBUG 1184 fprintf(stderr, "restored %s\n", stored_xce->name.str.val); 1185 #endif 1152 TRACE("restored %s", stored_xce->name.str.val); 1186 1153 return op_array; 1187 1154 } … … 1875 1842 stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC); 1876 1843 if (stored_xce) { 1877 #ifdef DEBUG 1878 fprintf(stderr, "incdec: gotxce %s\n", xce.name.str.val); 1879 #endif 1844 TRACE("incdec: gotxce %s", xce.name.str.val); 1880 1845 /* timeout */ 1881 1846 if (VAR_ENTRY_EXPIRED(stored_xce)) { 1882 #ifdef DEBUG 1883 fprintf(stderr, "incdec: expired\n"); 1884 #endif 1847 TRACE("%s", "incdec: expired"); 1885 1848 xc_entry_remove_dmz(stored_xce TSRMLS_CC); 1886 1849 stored_xce = NULL; … … 1892 1855 stored_xce->ctime = XG(request_time); 1893 1856 stored_xce->ttl = xce.ttl; 1894 #ifdef DEBUG 1895 fprintf(stderr, "incdec: islong\n"); 1896 #endif 1857 TRACE("%s", "incdec: islong"); 1897 1858 value = Z_LVAL_P(stored_var->value); 1898 1859 value += (inc == 1 ? count : - count); … … 1902 1863 } 1903 1864 else { 1904 #ifdef DEBUG 1905 fprintf(stderr, "incdec: notlong\n"); 1906 #endif 1865 TRACE("%s", "incdec: notlong"); 1907 1866 xc_processor_restore_zval(&oldzval, stored_xce->data.var->value, stored_xce->have_references TSRMLS_CC); 1908 1867 convert_to_long(&oldzval); … … 1912 1871 } 1913 1872 } 1914 #ifdef DEBUG1915 1873 else { 1916 fprintf(stderr, "incdec: %s not found\n", xce.name.str.val); 1917 } 1918 #endif 1874 TRACE("incdec: %s not found", xce.name.str.val); 1875 } 1919 1876 1920 1877 value += (inc == 1 ? count : - count); … … 2360 2317 2361 2318 zend_llist_prepend_element(&zend_extensions, &extension); 2362 #ifdef DEBUG 2363 fprintf(stderr, "registered\n"); 2364 #endif 2319 TRACE("%s", "registered"); 2365 2320 } 2366 2321
Note: See TracChangeset
for help on using the changeset viewer.

