Changeset 305 for trunk/xcache.c


Ignore:
Timestamp:
2006-12-08T17:11:19+01:00 (7 years ago)
Author:
moo
Message:

TRACE() instead of ifdef/fprintf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.c

    r299 r305  
    3030#include "xcache_globals.h" 
    3131#include "processor.h" 
    32 #include "utils.h" 
    3332#include "const_string.h" 
    3433#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" 
    4635 
    4736#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > pentry->ctime + (pentry)->ttl) 
     
    243232static void xc_entry_hold_php_dmz(xc_entry_t *xce TSRMLS_DC) /* {{{ */ 
    244233{ 
    245 #ifdef DEBUG 
    246     fprintf(stderr, "hold %s\n", xce->name.str.val); 
    247 #endif 
     234    TRACE("hold %s", xce->name.str.val); 
    248235    xce->refcount ++; 
    249236    xc_stack_push(&XG(php_holds)[xce->cache->cacheid], (void *)xce); 
     
    290277static XC_ENTRY_APPLY_FUNC(xc_gc_expires_php_entry_dmz) /* {{{ */ 
    291278{ 
    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); 
    295280    if (XG(request_time) > entry->atime + xc_php_ttl) { 
    296281        return 1; 
     
    309294static void xc_gc_expires_one(xc_cache_t *cache, zend_ulong gc_interval, cache_apply_dmz_func_t apply_func TSRMLS_DC) /* {{{ */ 
    310295{ 
    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); 
    314297    if (XG(request_time) - cache->last_gc_expires >= gc_interval) { 
    315298        ENTER_LOCK(cache) { 
     
    623606    for (i = 0; i < cachecount; i ++) { 
    624607        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)); 
    628609        if (xc_stack_size(s)) { 
    629610            cache = ((xc_entry_t *)xc_stack_top(s))->cache; 
     
    631612                while (xc_stack_size(s)) { 
    632613                    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); 
    636615                    xce->refcount --; 
    637616                    assert(xce->refcount >= 0); 
     
    811790        assert(0); 
    812791    } 
    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); 
    816793    /* let's see which class */ 
    817794    for (i = 0; i < php->classinfo_cnt; i ++) { 
     
    891868        /* found */ 
    892869        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); 
    896871            xc_entry_hold_php_dmz(stored_xce TSRMLS_CC); 
    897872            cache->hits ++; 
     
    920895 
    921896    /* {{{ compile */ 
    922 #ifdef DEBUG 
    923     fprintf(stderr, "compiling %s\n", filename); 
    924 #endif 
     897    TRACE("compiling %s", filename); 
    925898 
    926899    /* make compile inside sandbox */ 
     
    10881061    } LEAVE_LOCK_EX(cache); 
    10891062    /* }}} */ 
    1090 #ifdef DEBUG 
    1091     fprintf(stderr, "stored\n"); 
    1092 #endif 
     1063    TRACE("%s", "stored"); 
    10931064 
    10941065#define X_FREE(var) \ 
     
    11461117    CG(compiled_filename) = stored_xce->name.str.val; 
    11471118    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); 
    11511120    xc_processor_restore_xc_entry_t(&xce, stored_xce, xc_readonly_protection TSRMLS_CC); 
    11521121#ifdef SHOW_DPRINT 
     
    11811150    CG(in_compilation)    = 0; 
    11821151    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); 
    11861153    return op_array; 
    11871154} 
     
    18751842        stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC); 
    18761843        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); 
    18801845            /* timeout */ 
    18811846            if (VAR_ENTRY_EXPIRED(stored_xce)) { 
    1882 #ifdef DEBUG 
    1883                 fprintf(stderr, "incdec: expired\n"); 
    1884 #endif 
     1847                TRACE("%s", "incdec: expired"); 
    18851848                xc_entry_remove_dmz(stored_xce TSRMLS_CC); 
    18861849                stored_xce = NULL; 
     
    18921855                    stored_xce->ctime = XG(request_time); 
    18931856                    stored_xce->ttl   = xce.ttl; 
    1894 #ifdef DEBUG 
    1895                     fprintf(stderr, "incdec: islong\n"); 
    1896 #endif 
     1857                    TRACE("%s", "incdec: islong"); 
    18971858                    value = Z_LVAL_P(stored_var->value); 
    18981859                    value += (inc == 1 ? count : - count); 
     
    19021863                } 
    19031864                else { 
    1904 #ifdef DEBUG 
    1905                     fprintf(stderr, "incdec: notlong\n"); 
    1906 #endif 
     1865                    TRACE("%s", "incdec: notlong"); 
    19071866                    xc_processor_restore_zval(&oldzval, stored_xce->data.var->value, stored_xce->have_references TSRMLS_CC); 
    19081867                    convert_to_long(&oldzval); 
     
    19121871            } 
    19131872        } 
    1914 #ifdef DEBUG 
    19151873        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        } 
    19191876 
    19201877        value += (inc == 1 ? count : - count); 
     
    23602317 
    23612318    zend_llist_prepend_element(&zend_extensions, &extension); 
    2362 #ifdef DEBUG 
    2363     fprintf(stderr, "registered\n"); 
    2364 #endif 
     2319    TRACE("%s", "registered"); 
    23652320} 
    23662321 
Note: See TracChangeset for help on using the changeset viewer.