Changeset 173

Show
Ignore:
Timestamp:
02/24/06 12:43:53 (3 years ago)
Author:
hrak
Message:

Altered the way debug output is in/excluded by adding a macro that makes
sure calls to functions like ea_debug_printf don't get compiled in a
non-debug build. The macro approach was chosen to prevent swamping the
code with any more ifdef statements. This approach (as opposed to the
previous empty-function-if-no-debug-build) also makes sure debug function
arguments such as the tons of getpid()'s (which don't come cheap) don't
get compiled in and executed in a non-debug build.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ChangeLog

    r172 r173  
     12006-02-24  Hans Rakers <hans at parse dot nl> 
     2 
     3        * Altered the way debug output is in/excluded by adding a macro that makes 
     4          sure calls to functions like ea_debug_printf don't get compiled in a 
     5          non-debug build. The macro approach was chosen to prevent swamping the 
     6          code with any more ifdef statements. This approach (as opposed to the 
     7          previous empty-function-if-no-debug-build) also makes sure debug function 
     8          arguments such as the tons of getpid()'s (which don't come cheap) don't 
     9          get compiled in and executed in a non-debug build. 
     10 
    1112006-02-23  Hans Rakers <hans at parse dot nl> 
    212 
  • eaccelerator/trunk/debug.c

    r162 r173  
    160160 * Print a debug message 
    161161 */ 
    162 #ifdef DEBUG 
    163162void ea_debug_printf (long debug_level, char *format, ...) 
    164163{ 
     
    177176    } 
    178177} 
    179 #else 
    180 void ea_debug_printf (long debug_level, char *format, ...) 
    181 { 
    182 } 
    183 #endif 
    184178 
    185179/** 
    186180 * Put a debug message 
    187181 */ 
    188 #ifdef DEBUG 
    189182void ea_debug_put (long debug_level, char *message) 
    190183{ 
     
    196189    } 
    197190} 
    198 #else 
    199 void ea_debug_put (long debug_level, char *message) 
    200 { 
    201 } 
    202 #endif 
    203191 
    204192/** 
    205193 * Print a binary message 
    206194 */ 
    207 #ifdef DEBUG 
    208195void ea_debug_binary_print (long debug_level, char *p, int len) 
    209196{ 
     
    218205    } 
    219206} 
    220 #else 
    221 void ea_debug_binary_print (long debug_level, char *p, int len) 
    222 { 
    223 } 
    224 #endif 
    225207 
    226208/** 
    227209 * Log a hashkey 
    228210 */ 
    229 #ifdef DEBUG 
    230211void ea_debug_log_hashkeys (char *p, HashTable * ht) 
    231212{ 
     
    249230    } 
    250231} 
    251 #else 
    252 void ea_debug_log_hashkeys (char *p, HashTable * ht) 
    253 { 
    254 } 
    255 #endif 
    256232 
    257233/** 
    258234 * Pad the message with the current pad level. 
    259235 */ 
    260 #ifdef DEBUG 
    261236void ea_debug_pad (long debug_level TSRMLS_DC) 
    262237{ 
     238#ifdef DEBUG /* This ifdef is still req'd because xpad is N/A in a non-debug compile */ 
    263239    if (eaccelerator_debug & debug_level) { 
    264240        ea_debug_lock(); 
     
    269245        ea_debug_unlock(); 
    270246    } 
    271 } 
    272 #else 
    273 void ea_debug_pad (long debug_level TSRMLS_DC) 
    274 { 
    275 } 
    276247#endif 
     248} 
    277249 
    278250void ea_debug_start_time (struct timeval *tvstart) 
  • eaccelerator/trunk/debug.h

    r162 r173  
    3939#endif 
    4040 
     41/* 
     42 * This macro is used to make sure debug code is not included in a non-debug build, 
     43 * without swamping the code with ifdef statements. This approach (as opposed to the 
     44 * previous empty-function-if-no-debug-build) also makes sure debug function arguments 
     45 * such as the tons of getpid()'s don't get compiled in and executed in a non-debug build. 
     46 * 
     47 * It takes the debug function as first arg and the arguments as the second, like this: 
     48 * 
     49 * DBG(ea_debug_printf, ("Hello %s", world)); 
     50 * 
     51 * The reason why the function arguments are passed by one macro variable is to prevent 
     52 * the use of variadic macros, keeping the win32 VC 6.0 folks happy 
     53 */ 
     54#ifdef DEBUG 
     55#define DBG(func, list) func list 
     56#else 
     57#define DBG(func, list) 
     58#endif 
    4159 
    4260/* print information about the file that's loaded or cached */ 
  • eaccelerator/trunk/ea_restore.c

    r172 r173  
    477477#endif 
    478478 
    479         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    480         ea_debug_printf(EA_DEBUG, "[%d] restore_op_array: %s type=%x\n", getpid(), 
    481                                         from->function_name ? from->function_name : "(top)", from->type)
     479        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     480        DBG(ea_debug_printf, (EA_DEBUG, "[%d] restore_op_array: %s type=%x\n", getpid(), 
     481                                        from->function_name ? from->function_name : "(top)", from->type))
    482482 
    483483        if (from->type == ZEND_INTERNAL_FUNCTION) { 
     
    537537                char *from_scope_lc = zend_str_tolower_dup(from->scope_name, from->scope_name_len); 
    538538                if (zend_hash_find (CG(class_table), (void *) from_scope_lc, from->scope_name_len + 1, (void **) &to->scope) != SUCCESS) { 
    539                         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    540                         ea_debug_printf(EA_DEBUG, "[%d]                   can't find '%s' in class_table. use EAG(class_entry).\n", getpid(), from->scope_name); 
     539                        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     540                        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                   can't find '%s' in class_table. use EAG(class_entry).\n", getpid(), from->scope_name)); 
    541541                        to->scope = EAG(class_entry); 
    542542                } else { 
    543                         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    544                         ea_debug_printf(EA_DEBUG, "[%d]                   found '%s' in hash\n", getpid(), from->scope_name); 
     543                        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     544                        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                   found '%s' in hash\n", getpid(), from->scope_name)); 
    545545                        to->scope = *(zend_class_entry **) to->scope; 
    546546                } 
    547547                efree(from_scope_lc); 
    548548        } else {                                        // zoeloelip: is this needed? scope is always stored -> hra: no its not :P only if from->scope!=null in ea_store 
    549                 ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    550                 ea_debug_printf(EA_DEBUG, "[%d]                   from is NULL\n", getpid());  
     549                DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     550                DBG(ea_debug_printf, (EA_DEBUG, "[%d]                   from is NULL\n", getpid())); 
    551551                if (EAG(class_entry)) { 
    552552                        zend_class_entry *p; 
    553553                        for (p = EAG(class_entry)->parent; p; p = p->parent) { 
    554                                 ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    555                                 ea_debug_printf(EA_DEBUG, "[%d]                   checking parent '%s' have '%s'\n", getpid(), p->name, fname_lc); 
     554                                DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     555                                DBG(ea_debug_printf, (EA_DEBUG, "[%d]                   checking parent '%s' have '%s'\n", getpid(), p->name, fname_lc)); 
    556556                                if (zend_hash_find(&p->function_table, fname_lc, fname_len + 1, (void **) &function) == SUCCESS) { 
    557                                         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    558                                         ea_debug_printf(EA_DEBUG, "[%d]                                   '%s' has '%s' of scope '%s'\n",  
    559                             getpid(), p->name, fname_lc, function->common.scope->name)
     557                                        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     558                                        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                                   '%s' has '%s' of scope '%s'\n",  
     559                            getpid(), p->name, fname_lc, function->common.scope->name))
    560560                                        to->scope = function->common.scope; 
    561561                                        break; 
     
    567567        } 
    568568 
    569         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    570         ea_debug_printf(EA_DEBUG, "[%d]                   %s's scope is '%s'\n", getpid(),  
    571             from->function_name ? from->function_name : "(top)", to->scope ? to->scope->name : "NULL")
     569        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     570        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                   %s's scope is '%s'\n", getpid(),  
     571            from->function_name ? from->function_name : "(top)", to->scope ? to->scope->name : "NULL"))
    572572#endif 
    573573        if (from->type == ZEND_INTERNAL_FUNCTION) { 
    574574                zend_class_entry *class_entry = EAG(class_entry); 
    575                 ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    576                 ea_debug_printf(EA_DEBUG, "[%d]                   [internal function from=%08x,to=%08x] class_entry='%s' [%08x]\n",  
    577                 getpid(), from, to, class_entry->name, class_entry)
     575                DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     576                DBG(ea_debug_printf, (EA_DEBUG, "[%d]                   [internal function from=%08x,to=%08x] class_entry='%s' [%08x]\n",  
     577                getpid(), from, to, class_entry->name, class_entry))
    578578                if (class_entry) { 
    579                         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    580                         ea_debug_printf(EA_DEBUG, "[%d]                                       class_entry->parent='%s' [%08x]\n",  
    581                     getpid(), class_entry->parent->name, class_entry->parent)
     579                        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     580                        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                                       class_entry->parent='%s' [%08x]\n",  
     581                    getpid(), class_entry->parent->name, class_entry->parent))
    582582                } 
    583583                if (class_entry != NULL && class_entry->parent != NULL &&  
     
    589589#endif 
    590590                                (void **) &function) == SUCCESS && function->type == ZEND_INTERNAL_FUNCTION) { 
    591                         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    592                         ea_debug_printf(EA_DEBUG, "[%d]                                       found in function table\n", getpid()); 
     591                        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     592                        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                                       found in function table\n", getpid())); 
    593593                        ((zend_internal_function *) (to))->handler = ((zend_internal_function *) function)->handler; 
    594594                } else { 
     
    596596                         * TODO: must solve this somehow, to avoid returning damaged structure... 
    597597                         */ 
    598                         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    599                         ea_debug_printf(EA_DEBUG, "[%d]                                       can't find\n", getpid()); 
     598                        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     599                        DBG(ea_debug_printf, (EA_DEBUG, "[%d]                                       can't find\n", getpid())); 
    600600                }                
    601601#ifdef ZEND_ENGINE_2 
     
    719719                                                  zend_class_entry * to TSRMLS_DC) 
    720720{ 
     721        DBG(ea_debug_printf, (EA_DEBUG, "restore_class_parent: restoring parent class %s of class %s\n", (char *) parent, to->name)); 
    721722#ifdef ZEND_ENGINE_2 
    722723        zend_class_entry** parent_ptr = NULL; 
     
    728729#endif 
    729730        { 
    730                 ea_debug_error("[%d] EACCELERATOR can't restore parent class \"%s\" of class \"%s\"\n",  
    731                 getpid(), (char *) parent, to->name)
     731                DBG(ea_debug_error, ("[%d] EACCELERATOR can't restore parent class \"%s\" of class \"%s\"\n",  
     732                getpid(), (char *) parent, to->name))
    732733                to->parent = NULL; 
    733734        } else { 
     
    739740                to->clone = to->parent->clone; 
    740741#endif 
    741                 ea_debug_printf(EA_DEBUG, "restore_class_parent: found parent %s..\n", to->parent->name); 
    742                 ea_debug_printf(EA_DEBUG, "restore_class_parent: parent type=%d child type=%d\n", to->parent->type, to->type); 
     742                DBG(ea_debug_printf, (EA_DEBUG, "restore_class_parent: found parent %s..\n", to->parent->name)); 
     743                DBG(ea_debug_printf, (EA_DEBUG, "restore_class_parent: parent type=%d child type=%d\n", to->parent->type, to->type)); 
    743744        } 
    744745#ifndef ZEND_ENGINE_2 
     
    821822#endif 
    822823 
    823         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    824         ea_debug_printf(EA_DEBUG, "[%d] restore_class_entry: %s\n", getpid(), from->name ? from->name : "(top)"); 
     824        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     825        DBG(ea_debug_printf, (EA_DEBUG, "[%d] restore_class_entry: %s\n", getpid(), from->name ? from->name : "(top)")); 
    825826#ifdef DEBUG 
    826827        EAG(xpad)++; 
     
    928929                restore_class_parent(from->parent, strlen(from->parent), to TSRMLS_CC); 
    929930        } else { 
    930                 ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    931                 ea_debug_printf(EA_DEBUG, "[%d] parent = NULL\n", getpid()); 
     931                DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     932                DBG(ea_debug_printf, (EA_DEBUG, "[%d] parent = NULL\n", getpid())); 
    932933                to->parent = NULL; 
    933934        } 
  • eaccelerator/trunk/ea_store.c

    r170 r173  
    141141                        zend_class_entry *ce = zv->value.obj.ce; 
    142142                        if (!EAG(compress)) { 
    143                                 ea_debug_error("[%d] EACCELERATOR can't cache objects\n", getpid()); 
     143                                DBG(ea_debug_error, ("[%d] EACCELERATOR can't cache objects\n", getpid())); 
    144144                                zend_bailout(); 
    145145                        } 
    146146                        while (ce != NULL) { 
    147147                                if (ce->type != ZEND_USER_CLASS && strcmp(ce->name, "stdClass") != 0) { 
    148                                         ea_debug_error("[%d] EACCELERATOR can't cache objects\n", getpid()); 
     148                                        DBG(ea_debug_error, ("[%d] EACCELERATOR can't cache objects\n", getpid())); 
    149149                                        zend_bailout(); 
    150150                                } 
     
    161161                return; 
    162162        case IS_RESOURCE: 
    163                 ea_debug_error("[%d] EACCELERATOR can't cache resources\n", getpid()); 
     163                DBG(ea_debug_error, ("[%d] EACCELERATOR can't cache resources\n", getpid())); 
    164164                zend_bailout(); 
    165165        default: 
     
    181181                EAG(mem) += sizeof(eaccelerator_op_array); 
    182182        } else { 
    183                 ea_debug_error("[%d] EACCELERATOR can't cache function \"%s\"\n", getpid(), from->function_name); 
     183                DBG(ea_debug_error, ("[%d] EACCELERATOR can't cache function \"%s\"\n", getpid(), from->function_name)); 
    184184                zend_bailout(); 
    185185        } 
     
    274274{ 
    275275        if (from->type != ZEND_USER_CLASS) { 
    276                 ea_debug_error("[%d] EACCELERATOR can't cache internal class \"%s\"\n", getpid(), from->name); 
     276                DBG(ea_debug_error, ("[%d] EACCELERATOR can't cache internal class \"%s\"\n", getpid(), from->name)); 
    277277                zend_bailout(); 
    278278        } 
     
    537537        zend_op *end; 
    538538 
    539         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    540         ea_debug_printf(EA_DEBUG, "[%d] store_op_array: %s [scope=%s type=%x]\n",  
     539        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     540        DBG(ea_debug_printf, (EA_DEBUG, "[%d] store_op_array: %s [scope=%s type=%x]\n",  
    541541            getpid(), from->function_name ? from->function_name : "(top)", 
    542542#ifdef ZEND_ENGINE_2 
     
    546546#endif 
    547547                        , from->type 
    548                 )
     548                ))
    549549 
    550550        if (from->type == ZEND_INTERNAL_FUNCTION) { 
     
    605605                                to->scope_name_len = q->nKeyLength - 1; 
    606606 
    607                                 ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    608                                 ea_debug_printf(EA_DEBUG,  
     607                                DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     608                                DBG(ea_debug_printf, (EA_DEBUG,  
    609609                        "[%d]                 find scope '%s' in CG(class_table) save hashkey '%s' [%08x] as to->scope_name\n", 
    610                                                 getpid(), from->scope->name ? from->scope->name : "NULL", q->arKey, to->scope_name)
     610                                                getpid(), from->scope->name ? from->scope->name : "NULL", q->arKey, to->scope_name))
    611611                                break; 
    612612                        } 
     
    614614                } 
    615615            if (to->scope_name == NULL) { 
    616                     ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    617                     ea_debug_printf(EA_DEBUG, 
     616                    DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     617                    DBG(ea_debug_printf, (EA_DEBUG, 
    618618                                                "[%d]                 could not find scope '%s' in CG(class_table), saving it to NULL\n", 
    619                                                 getpid(), from->scope->name ? from->scope->name : "NULL")
     619                                                getpid(), from->scope->name ? from->scope->name : "NULL"))
    620620            } 
    621621    } 
     
    853853#endif 
    854854 
    855         ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    856         ea_debug_printf(EA_DEBUG, "[%d] store_class_entry: %s parent was '%s'\n", 
     855        DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     856        DBG(ea_debug_printf, (EA_DEBUG, "[%d] store_class_entry: %s parent was '%s'\n", 
    857857                                        getpid(), from->name ? from->name : "(top)", 
    858                                         from->parent ? from->parent->name : "NULL")
     858                                        from->parent ? from->parent->name : "NULL"))
    859859#ifdef DEBUG 
    860860        EAG(xpad)++; 
  • eaccelerator/trunk/eaccelerator.c

    r171 r173  
    278278  } 
    279279#ifdef ZEND_WIN32 
    280   ea_debug_printf(EA_DEBUG, "init_mm [%d]\n", getpid()); 
    281 #else 
    282   ea_debug_printf(EA_DEBUG, "init_mm [%d,%d]\n", getpid(), getppid()); 
     280  DBG(ea_debug_printf, (EA_DEBUG, "init_mm [%d]\n", getpid())); 
     281#else 
     282  DBG(ea_debug_printf, (EA_DEBUG, "init_mm [%d,%d]\n", getpid(), getppid())); 
    283283#endif 
    284284#ifdef ZTS 
     
    317317      MM *mm = eaccelerator_mm_instance->mm; 
    318318#ifdef ZEND_WIN32 
    319       ea_debug_printf(EA_DEBUG, "shutdown_mm [%d]\n", getpid()); 
    320 #else 
    321       ea_debug_printf(EA_DEBUG, "shutdown_mm [%d,%d]\n", getpid(), getppid()); 
     319      DBG(ea_debug_printf, (EA_DEBUG, "shutdown_mm [%d]\n", getpid())); 
     320#else 
     321      DBG(ea_debug_printf, (EA_DEBUG, "shutdown_mm [%d,%d]\n", getpid(), getppid())); 
    322322#endif 
    323323#ifdef ZTS 
     
    744744  char *x; 
    745745 
    746   ea_debug_pad (EA_DEBUG TSRMLS_CC); 
    747   ea_debug_printf (EA_DEBUG, "[%d] eaccelerator_store_int: key='%s'\n",  
    748           getpid (), key)
     746  DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     747  DBG(ea_debug_printf, (EA_DEBUG, "[%d] eaccelerator_store_int: key='%s'\n",  
     748          getpid (), key))
    749749 
    750750  EAG (compress) = 1; 
     
    764764  q = NULL; 
    765765  while (c != NULL) { 
    766     ea_debug_pad (EA_DEBUG TSRMLS_CC); 
    767     ea_debug_printf (EA_DEBUG,  
    768             "[%d] eaccelerator_store_int:     class hashkey=", getpid ())
    769     ea_debug_binary_print (EA_DEBUG, c->arKey, c->nKeyLength); 
     766    DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     767    DBG(ea_debug_printf, (EA_DEBUG,  
     768            "[%d] eaccelerator_store_int:     class hashkey=", getpid ()))
     769    DBG(ea_debug_binary_print, (EA_DEBUG, c->arKey, c->nKeyLength)); 
    770770 
    771771    EACCELERATOR_ALIGN (EAG (mem)); 
     
    794794  q = NULL; 
    795795  while (f != NULL) { 
    796       ea_debug_pad (EA_DEBUG TSRMLS_CC); 
    797       ea_debug_printf (EA_DEBUG,  
    798               "[%d] eaccelerator_store_int:     function hashkey='%s'\n", getpid (), f->arKey)
     796      DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     797      DBG(ea_debug_printf, (EA_DEBUG,  
     798              "[%d] eaccelerator_store_int:     function hashkey='%s'\n", getpid (), f->arKey))
    799799 
    800800      EACCELERATOR_ALIGN (EAG (mem)); 
     
    857857    return 0; 
    858858  } 
    859   ea_debug_printf (EA_DEBUG, "[%d] eaccelerator_store: calc_size returned %d, mm=%x", getpid(), size, eaccelerator_mm_instance->mm); 
     859  DBG(ea_debug_printf, (EA_DEBUG, "[%d] eaccelerator_store: calc_size returned %d, mm=%x", getpid(), size, eaccelerator_mm_instance->mm)); 
    860860  EACCELERATOR_UNPROTECT(); 
    861861  EAG(mem) = eaccelerator_malloc(size); 
     
    12371237#endif 
    12381238 
    1239   ea_debug_printf(EA_TEST_PERFORMANCE, "[%d] Enter COMPILE\n",getpid()); 
    1240   ea_debug_start_time(&tv_start); 
    1241   ea_debug_printf(EA_DEBUG, "[%d] Enter COMPILE\n",getpid()); 
    1242   ea_debug_printf(EA_DEBUG, "[%d] compile_file: \"%s\"\n",getpid(), file_handle->filename); 
     1239  DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "[%d] Enter COMPILE\n",getpid())); 
     1240  DBG(ea_debug_start_time, (&tv_start)); 
     1241  DBG(ea_debug_printf, (EA_DEBUG, "[%d] Enter COMPILE\n",getpid())); 
     1242  DBG(ea_debug_printf, (EA_DEBUG, "[%d] compile_file: \"%s\"\n",getpid(), file_handle->filename)); 
    12431243#ifdef DEBUG 
    12441244  EAG(xpad)+=2; 
     
    12471247  stat_result = eaccelerator_stat(file_handle, realname, &buf TSRMLS_CC); 
    12481248  if (buf.st_mtime >= compile_time && eaccelerator_debug > 0) { 
    1249         ea_debug_log("[%d] EACCELERATOR: Warning: \"%s\" is cached but it's mtime is in the future.\n",  
    1250                 getpid(), file_handle->filename); 
     1249        ea_debug_log("EACCELERATOR: Warning: \"%s\" is cached but it's mtime is in the future.\n", file_handle->filename); 
    12511250  } 
    12521251   
     
    12591258      !eaccelerator_ok_to_cache(realname TSRMLS_CC)) { 
    12601259#endif 
    1261     ea_debug_printf(EA_DEBUG, "\t[%d] compile_file: compiling\n", getpid()); 
     1260    DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: compiling\n", getpid())); 
    12621261    t = mm_saved_zend_compile_file(file_handle, type TSRMLS_CC); 
    1263     ea_debug_printf(EA_TEST_PERFORMANCE, "\t[%d] compile_file: end (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start)); 
    1264     ea_debug_printf(EA_DEBUG, "\t[%d] compile_file: end\n", getpid()); 
     1262    DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: end (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start))); 
     1263    DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: end\n", getpid())); 
    12651264#ifdef DEBUG 
    12661265    EAG(xpad)-=2; 
    12671266#endif 
    1268     ea_debug_printf(EA_DEBUG, "[%d] Leave COMPILE\n", getpid()); 
     1267    DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave COMPILE\n", getpid())); 
    12691268    return t; 
    12701269  } 
     
    12891288#endif 
    12901289  if (t != NULL) { 
     1290#ifdef DEBUG 
    12911291    ea_debug_log("[%d] EACCELERATOR hit: \"%s\"\n", getpid(), t->filename); 
     1292#else 
     1293    ea_debug_log("EACCELERATOR hit: \"%s\"\n", t->filename); 
     1294#endif 
    12921295    /* restored from cache */ 
    12931296 
     
    13081311*/ 
    13091312    } 
    1310     ea_debug_printf(EA_TEST_PERFORMANCE, "\t[%d] compile_file: restored (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start)); 
    1311     ea_debug_printf(EA_DEBUG, "\t[%d] compile_file: restored\n", getpid()); 
     1313    DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: restored (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start))); 
     1314    DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: restored\n", getpid())); 
    13121315#ifdef DEBUG 
    13131316    EAG(xpad)-=2; 
    13141317#endif 
    1315     ea_debug_printf(EA_DEBUG, "[%d] Leave COMPILE\n", getpid()); 
     1318    DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave COMPILE\n", getpid())); 
    13161319    return t; 
    13171320  } else { 
     
    13281331    int bailout; 
    13291332 
    1330     ea_debug_printf(EA_DEBUG, "\t[%d] compile_file: marking\n", getpid()); 
     1333    DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: marking\n", getpid())); 
    13311334    if (CG(class_table) != EG(class_table)) 
    13321335    { 
    1333       ea_debug_printf(EA_DEBUG, "\t[%d] oops, CG(class_table)[%08x] != EG(class_table)[%08x]\n", getpid(), CG(class_table), EG(class_table)); 
    1334       ea_debug_log_hashkeys("CG(class_table)\n", CG(class_table)); 
    1335       ea_debug_log_hashkeys("EG(class_table)\n", EG(class_table)); 
     1336      DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] oops, CG(class_table)[%08x] != EG(class_table)[%08x]\n", getpid(), CG(class_table), EG(class_table))); 
     1337      DBG(ea_debug_log_hashkeys, ("CG(class_table)\n", CG(class_table))); 
     1338      DBG(ea_debug_log_hashkeys, ("EG(class_table)\n", EG(class_table))); 
    13361339    } 
    13371340    else { 
    1338       ea_debug_printf(EA_DEBUG, "\t[%d] OKAY. That what I thought, CG(class_table)[%08x] == EG(class_table)[%08x]\n", getpid(), CG(class_table), EG(class_table)); 
    1339       ea_debug_log_hashkeys("CG(class_table)\n", CG(class_table)); 
     1341      DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] OKAY. That what I thought, CG(class_table)[%08x] == EG(class_table)[%08x]\n", getpid(), CG(class_table), EG(class_table))); 
     1342      DBG(ea_debug_log_hashkeys, ("CG(class_table)\n", CG(class_table))); 
    13401343    } 
    13411344 
     
    13591362    class_table_tail = CG(class_table)->pListTail; 
    13601363 
    1361     ea_debug_printf(EA_TEST_PERFORMANCE, "\t[%d] compile_file: compiling (%ld)\n",getpid(),ea_debug_elapsed_time(&tv_start)); 
    1362     ea_debug_printf(EA_DEBUG, "\t[%d] compile_file: compiling tmp_class_table=%d class_table=%d\n",  
    1363         getpid(), tmp_class_table.nNumOfElements, orig_class_table->nNumOfElements)
     1364    DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: compiling (%ld)\n",getpid(),ea_debug_elapsed_time(&tv_start))); 
     1365    DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: compiling tmp_class_table=%d class_table=%d\n",  
     1366        getpid(), tmp_class_table.nNumOfElements, orig_class_table->nNumOfElements))
    13641367    if (EAG(optimizer_enabled) && eaccelerator_mm_instance->optimizer_enabled) { 
    13651368      EAG(compiler) = 1; 
     
    13801383      zend_bailout(); 
    13811384    } 
    1382     ea_debug_log_hashkeys("class_table\n", CG(class_table)); 
     1385    DBG(ea_debug_log_hashkeys, ("class_table\n", CG(class_table))); 
    13831386 
    13841387/*??? 
     
    13961399         ((stat(file_handle->opened_path, &buf) == 0) && S_ISREG(buf.st_mode)))) { 
    13971400#endif 
    1398       ea_debug_printf(EA_TEST_PERFORMANCE, "\t[%d] compile_file: storing in cache (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start)); 
    1399       ea_debug_printf(EA_DEBUG, "\t[%d] compile_file: storing in cache\n", getpid()); 
     1401      DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: storing in cache (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start))); 
     1402      DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: storing in cache\n", getpid())); 
    14001403#ifdef WITH_EACCELERATOR_LOADER 
    14011404      if (t->last >= 3 && 
     
    14501453      if (eaccelerator_store(file_handle->opened_path, &buf, nreloads, t, 
    14511454                        function_table_tail, class_table_tail TSRMLS_CC)) { 
     1455#ifdef DEBUG 
    14521456        ea_debug_log("[%d] EACCELERATOR %s: \"%s\"\n", getpid(), 
    14531457              (nreloads == 1) ? "cached" : "re-cached", file_handle->opened_path); 
     1458#else 
     1459        ea_debug_log("EACCELERATOR %s: \"%s\"\n", 
     1460          (nreloads == 1) ? "cached" : "re-cached", file_handle->opened_path); 
     1461#endif 
    14541462      } else { 
     1463#ifdef DEBUG 
    14551464        ea_debug_log("[%d] EACCELERATOR can't cache: \"%s\"\n", getpid(), file_handle->opened_path); 
     1465#else 
     1466        ea_debug_log("EACCELERATOR can't cache: \"%s\"\n", file_handle->opened_path); 
     1467#endif 
    14561468      } 
    14571469    } else { 
     
    14651477#ifdef ZEND_ENGINE_2 
    14661478    EG(class_table) = orig_eg_class_table; 
    1467     ea_debug_printf(EA_DEBUG, "\t[%d] restoring CG(class_table)[%08x] != EG(class_table)[%08x]\n", getpid(), CG(class_table), EG(class_table)); 
     1479    DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] restoring CG(class_table)[%08x] != EG(class_table)[%08x]\n", getpid(), CG(class_table), EG(class_table))); 
    14681480#endif 
    14691481    while (function_table_tail != NULL) { 
     
    15271539    zend_hash_destroy(&tmp_class_table); 
    15281540  } 
    1529   ea_debug_printf(EA_TEST_PERFORMANCE, "\t[%d] compile_file: end (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start)); 
    1530   ea_debug_printf(EA_DEBUG, "\t[%d] compile_file: end\n", getpid()); 
     1541  DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: end (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start))); 
     1542  DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: end\n", getpid())); 
    15311543#ifdef DEBUG 
    15321544  EAG(xpad)-=2; 
    15331545#endif 
    1534   ea_debug_printf(EA_DEBUG, "[%d] Leave COMPILE\n", getpid()); 
     1546  DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave COMPILE\n", getpid())); 
    15351547  return t; 
    15361548} 
     
    15441556 
    15451557  for (i=0;i<EAG(profile_level);i++) 
    1546     ea_debug_put(EA_PROFILE_OPCODES, "  "); 
     1558    DBG(ea_debug_put, (EA_PROFILE_OPCODES, "  ")); 
    15471559  ea_debug_printf(EA_PROFILE_OPCODES, "enter profile_execute: %s:%s\n", op_array->filename, op_array->function_name); 
    15481560  ea_debug_start_time(&tv_start); 
     
    15571569    EAG(self_time)[EAG(profile_level)-1] += usec; 
    15581570  for (i=0;i<EAG(profile_level);i++) 
    1559     ea_debug_put(EA_PROFILE_OPCODES, "  "); 
     1571    DBG(ea_debug_put, (EA_PROFILE_OPCODES, "  ")); 
    15601572  ea_debug_printf(EA_PROFILE_OPCODES, "leave profile_execute: %s:%s (%ld,%ld)\n", op_array->filename, op_array->function_name, usec, usec-EAG(self_time)[EAG(profile_level)]); 
    15611573} 
     
    15741586    EAG(self_time)[EAG(profile_level)-1] += usec; 
    15751587  for (i=0;i<EAG(profile_level);i++) 
    1576     ea_debug_put(EA_PROFILE_OPCODES, "  "); 
     1588    DBG(ea_debug_put, (EA_PROFILE_OPCODES, "  ")); 
    15771589  ea_debug_printf(EA_DEBUG, "zend_op_array compile: %s (%ld)\n", file_handle->filename, usec); 
    15781590  return t; 
     
    18281840      eaccelerator_clean_request(TSRMLS_C); 
    18291841      if (EG(active_op_array)) { 
    1830         ea_debug_error("[%d] EACCELERATOR: PHP unclean shutdown on opline %ld of %s() at %s:%u\n\n", 
     1842        DBG(ea_debug_error, ("[%d] EACCELERATOR: PHP unclean shutdown on opline %ld of %s() at %s:%u\n\n", 
    18311843          getpid(), 
    18321844          (long)(active_opline-EG(active_op_array)->opcodes), 
    18331845          get_active_function_name(TSRMLS_C), 
    18341846          zend_get_executed_filename(TSRMLS_C), 
    1835           zend_get_executed_lineno(TSRMLS_C))
     1847          zend_get_executed_lineno(TSRMLS_C)))
    18361848      } else { 
    1837         ea_debug_error("[%d] EACCELERATOR: PHP unclean shutdown\n\n",getpid()); 
     1849        DBG(ea_debug_error, ("[%d] EACCELERATOR: PHP unclean shutdown\n\n",getpid())); 
    18381850      } 
    18391851    } 
     
    19992011      strcmp(sapi_module.name, "cgi") != 0 && 
    20002012      strcmp(sapi_module.name, "cli") != 0) { 
    2001     ea_debug_put(EA_DEBUG, "\n=======================================\n"); 
    2002     ea_debug_printf(EA_DEBUG, "[%d] EACCELERATOR STARTED\n", getpid()); 
    2003     ea_debug_put(EA_DEBUG, "=======================================\n"); 
     2013    DBG(ea_debug_put, (EA_DEBUG, "\n=======================================\n")); 
     2014    DBG(ea_debug_printf, (EA_DEBUG, "[%d] EACCELERATOR STARTED\n", getpid())); 
     2015    DBG(ea_debug_put, (EA_DEBUG, "=======================================\n")); 
    20042016 
    20052017    if (init_mm(TSRMLS_C) == FAILURE) { 
     
    20442056#endif 
    20452057  shutdown_mm(TSRMLS_C); 
    2046   ea_debug_put(EA_DEBUG, "========================================\n"); 
    2047   ea_debug_printf(EA_DEBUG, "[%d] EACCELERATOR STOPPED\n", getpid()); 
    2048   ea_debug_put(EA_DEBUG, "========================================\n\n"); 
     2058  DBG(ea_debug_put, (EA_DEBUG, "========================================\n")); 
     2059  DBG(ea_debug_printf, (EA_DEBUG, "[%d] EACCELERATOR STOPPED\n", getpid())); 
     2060  DBG(ea_debug_put, (EA_DEBUG, "========================================\n\n")); 
    20492061  ea_debug_shutdown(); 
    20502062  UNREGISTER_INI_ENTRIES(); 
     
    20812093                zend_hash_copy(&eaccelerator_global_class_table, CG(class_table), NULL, &tmp_class, sizeof(zend_class_entry)); 
    20822094        } 
    2083         ea_debug_printf(EA_DEBUG, "[%d] Enter RINIT\n",getpid()); 
    2084         ea_debug_put(EA_PROFILE_OPCODES, "\n========================================\n"); 
     2095        DBG(ea_debug_printf, (EA_DEBUG, "[%d] Enter RINIT\n",getpid())); 
     2096        DBG(ea_debug_put, (EA_PROFILE_OPCODES, "\n========================================\n")); 
    20852097 
    20862098        EAG(in_request) = 1; 
     
    21132125                } 
    21142126        } 
    2115         ea_debug_printf(EA_DEBUG, "[%d] Leave RINIT\n",getpid()); 
     2127        DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave RINIT\n",getpid())); 
    21162128#ifdef DEBUG 
    21172129        EAG(xpad) = 0; 
     
    21962208#endif 
    21972209#endif 
    2198         ea_debug_printf(EA_DEBUG, "[%d] Enter RSHUTDOWN\n",getpid()); 
     2210        DBG(ea_debug_printf, (EA_DEBUG, "[%d] Enter RSHUTDOWN\n",getpid())); 
    21992211        eaccelerator_clean_request(TSRMLS_C); 
    2200         ea_debug_printf(EA_DEBUG, "[%d] Leave RSHUTDOWN\n",getpid()); 
     2212        DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave RSHUTDOWN\n",getpid())); 
    22012213        return SUCCESS; 
    22022214}