Changeset 173
- Timestamp:
- 02/24/06 12:43:53 (3 years ago)
- Files:
-
- eaccelerator/trunk/ChangeLog (modified) (1 diff)
- eaccelerator/trunk/debug.c (modified) (6 diffs)
- eaccelerator/trunk/debug.h (modified) (1 diff)
- eaccelerator/trunk/ea_restore.c (modified) (10 diffs)
- eaccelerator/trunk/ea_store.c (modified) (9 diffs)
- eaccelerator/trunk/eaccelerator.c (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/ChangeLog
r172 r173 1 2006-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 1 11 2006-02-23 Hans Rakers <hans at parse dot nl> 2 12 eaccelerator/trunk/debug.c
r162 r173 160 160 * Print a debug message 161 161 */ 162 #ifdef DEBUG163 162 void ea_debug_printf (long debug_level, char *format, ...) 164 163 { … … 177 176 } 178 177 } 179 #else180 void ea_debug_printf (long debug_level, char *format, ...)181 {182 }183 #endif184 178 185 179 /** 186 180 * Put a debug message 187 181 */ 188 #ifdef DEBUG189 182 void ea_debug_put (long debug_level, char *message) 190 183 { … … 196 189 } 197 190 } 198 #else199 void ea_debug_put (long debug_level, char *message)200 {201 }202 #endif203 191 204 192 /** 205 193 * Print a binary message 206 194 */ 207 #ifdef DEBUG208 195 void ea_debug_binary_print (long debug_level, char *p, int len) 209 196 { … … 218 205 } 219 206 } 220 #else221 void ea_debug_binary_print (long debug_level, char *p, int len)222 {223 }224 #endif225 207 226 208 /** 227 209 * Log a hashkey 228 210 */ 229 #ifdef DEBUG230 211 void ea_debug_log_hashkeys (char *p, HashTable * ht) 231 212 { … … 249 230 } 250 231 } 251 #else252 void ea_debug_log_hashkeys (char *p, HashTable * ht)253 {254 }255 #endif256 232 257 233 /** 258 234 * Pad the message with the current pad level. 259 235 */ 260 #ifdef DEBUG261 236 void ea_debug_pad (long debug_level TSRMLS_DC) 262 237 { 238 #ifdef DEBUG /* This ifdef is still req'd because xpad is N/A in a non-debug compile */ 263 239 if (eaccelerator_debug & debug_level) { 264 240 ea_debug_lock(); … … 269 245 ea_debug_unlock(); 270 246 } 271 }272 #else273 void ea_debug_pad (long debug_level TSRMLS_DC)274 {275 }276 247 #endif 248 } 277 249 278 250 void ea_debug_start_time (struct timeval *tvstart) eaccelerator/trunk/debug.h
r162 r173 39 39 #endif 40 40 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 41 59 42 60 /* print information about the file that's loaded or cached */ eaccelerator/trunk/ea_restore.c
r172 r173 477 477 #endif 478 478 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)); 482 482 483 483 if (from->type == ZEND_INTERNAL_FUNCTION) { … … 537 537 char *from_scope_lc = zend_str_tolower_dup(from->scope_name, from->scope_name_len); 538 538 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)); 541 541 to->scope = EAG(class_entry); 542 542 } 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)); 545 545 to->scope = *(zend_class_entry **) to->scope; 546 546 } 547 547 efree(from_scope_lc); 548 548 } 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())); 551 551 if (EAG(class_entry)) { 552 552 zend_class_entry *p; 553 553 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)); 556 556 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)); 560 560 to->scope = function->common.scope; 561 561 break; … … 567 567 } 568 568 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")); 572 572 #endif 573 573 if (from->type == ZEND_INTERNAL_FUNCTION) { 574 574 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)); 578 578 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)); 582 582 } 583 583 if (class_entry != NULL && class_entry->parent != NULL && … … 589 589 #endif 590 590 (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())); 593 593 ((zend_internal_function *) (to))->handler = ((zend_internal_function *) function)->handler; 594 594 } else { … … 596 596 * TODO: must solve this somehow, to avoid returning damaged structure... 597 597 */ 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())); 600 600 } 601 601 #ifdef ZEND_ENGINE_2 … … 719 719 zend_class_entry * to TSRMLS_DC) 720 720 { 721 DBG(ea_debug_printf, (EA_DEBUG, "restore_class_parent: restoring parent class %s of class %s\n", (char *) parent, to->name)); 721 722 #ifdef ZEND_ENGINE_2 722 723 zend_class_entry** parent_ptr = NULL; … … 728 729 #endif 729 730 { 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)); 732 733 to->parent = NULL; 733 734 } else { … … 739 740 to->clone = to->parent->clone; 740 741 #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)); 743 744 } 744 745 #ifndef ZEND_ENGINE_2 … … 821 822 #endif 822 823 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)")); 825 826 #ifdef DEBUG 826 827 EAG(xpad)++; … … 928 929 restore_class_parent(from->parent, strlen(from->parent), to TSRMLS_CC); 929 930 } 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())); 932 933 to->parent = NULL; 933 934 } eaccelerator/trunk/ea_store.c
r170 r173 141 141 zend_class_entry *ce = zv->value.obj.ce; 142 142 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())); 144 144 zend_bailout(); 145 145 } 146 146 while (ce != NULL) { 147 147 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())); 149 149 zend_bailout(); 150 150 } … … 161 161 return; 162 162 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())); 164 164 zend_bailout(); 165 165 default: … … 181 181 EAG(mem) += sizeof(eaccelerator_op_array); 182 182 } 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)); 184 184 zend_bailout(); 185 185 } … … 274 274 { 275 275 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)); 277 277 zend_bailout(); 278 278 } … … 537 537 zend_op *end; 538 538 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", 541 541 getpid(), from->function_name ? from->function_name : "(top)", 542 542 #ifdef ZEND_ENGINE_2 … … 546 546 #endif 547 547 , from->type 548 ) ;548 )); 549 549 550 550 if (from->type == ZEND_INTERNAL_FUNCTION) { … … 605 605 to->scope_name_len = q->nKeyLength - 1; 606 606 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, 609 609 "[%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)); 611 611 break; 612 612 } … … 614 614 } 615 615 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, 618 618 "[%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")); 620 620 } 621 621 } … … 853 853 #endif 854 854 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", 857 857 getpid(), from->name ? from->name : "(top)", 858 from->parent ? from->parent->name : "NULL") ;858 from->parent ? from->parent->name : "NULL")); 859 859 #ifdef DEBUG 860 860 EAG(xpad)++; eaccelerator/trunk/eaccelerator.c
r171 r173 278 278 } 279 279 #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())); 283 283 #endif 284 284 #ifdef ZTS … … 317 317 MM *mm = eaccelerator_mm_instance->mm; 318 318 #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())); 322 322 #endif 323 323 #ifdef ZTS … … 744 744 char *x; 745 745 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)); 749 749 750 750 EAG (compress) = 1; … … 764 764 q = NULL; 765 765 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)); 770 770 771 771 EACCELERATOR_ALIGN (EAG (mem)); … … 794 794 q = NULL; 795 795 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)); 799 799 800 800 EACCELERATOR_ALIGN (EAG (mem)); … … 857 857 return 0; 858 858 } 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)); 860 860 EACCELERATOR_UNPROTECT(); 861 861 EAG(mem) = eaccelerator_malloc(size); … … 1237 1237 #endif 1238 1238 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)); 1243 1243 #ifdef DEBUG 1244 1244 EAG(xpad)+=2; … … 1247 1247 stat_result = eaccelerator_stat(file_handle, realname, &buf TSRMLS_CC); 1248 1248 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); 1251 1250 } 1252 1251 … … 1259 1258 !eaccelerator_ok_to_cache(realname TSRMLS_CC)) { 1260 1259 #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())); 1262 1261 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())); 1265 1264 #ifdef DEBUG 1266 1265 EAG(xpad)-=2; 1267 1266 #endif 1268 ea_debug_printf(EA_DEBUG, "[%d] Leave COMPILE\n", getpid());1267 DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave COMPILE\n", getpid())); 1269 1268 return t; 1270 1269 } … … 1289 1288 #endif 1290 1289 if (t != NULL) { 1290 #ifdef DEBUG 1291 1291 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 1292 1295 /* restored from cache */ 1293 1296 … … 1308 1311 */ 1309 1312 } 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())); 1312 1315 #ifdef DEBUG 1313 1316 EAG(xpad)-=2; 1314 1317 #endif 1315 ea_debug_printf(EA_DEBUG, "[%d] Leave COMPILE\n", getpid());1318 DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave COMPILE\n", getpid())); 1316 1319 return t; 1317 1320 } else { … … 1328 1331 int bailout; 1329 1332 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())); 1331 1334 if (CG(class_table) != EG(class_table)) 1332 1335 { 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))); 1336 1339 } 1337 1340 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))); 1340 1343 } 1341 1344 … … 1359 1362 class_table_tail = CG(class_table)->pListTail; 1360 1363 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)); 1364 1367 if (EAG(optimizer_enabled) && eaccelerator_mm_instance->optimizer_enabled) { 1365 1368 EAG(compiler) = 1; … … 1380 1383 zend_bailout(); 1381 1384 } 1382 ea_debug_log_hashkeys("class_table\n", CG(class_table));1385 DBG(ea_debug_log_hashkeys, ("class_table\n", CG(class_table))); 1383 1386 1384 1387 /*??? … … 1396 1399 ((stat(file_handle->opened_path, &buf) == 0) && S_ISREG(buf.st_mode)))) { 1397 1400 #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())); 1400 1403 #ifdef WITH_EACCELERATOR_LOADER 1401 1404 if (t->last >= 3 && … … 1450 1453 if (eaccelerator_store(file_handle->opened_path, &buf, nreloads, t, 1451 1454 function_table_tail, class_table_tail TSRMLS_CC)) { 1455 #ifdef DEBUG 1452 1456 ea_debug_log("[%d] EACCELERATOR %s: \"%s\"\n", getpid(), 1453 1457 (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 1454 1462 } else { 1463 #ifdef DEBUG 1455 1464 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 1456 1468 } 1457 1469 } else { … … 1465 1477 #ifdef ZEND_ENGINE_2 1466 1478 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))); 1468 1480 #endif 1469 1481 while (function_table_tail != NULL) { … … 1527 1539 zend_hash_destroy(&tmp_class_table); 1528 1540 } 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())); 1531 1543 #ifdef DEBUG 1532 1544 EAG(xpad)-=2; 1533 1545 #endif 1534 ea_debug_printf(EA_DEBUG, "[%d] Leave COMPILE\n", getpid());1546 DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave COMPILE\n", getpid())); 1535 1547 return t; 1536 1548 } … … 1544 1556 1545 1557 for (i=0;i<EAG(profile_level);i++) 1546 ea_debug_put(EA_PROFILE_OPCODES, " ");1558 DBG(ea_debug_put, (EA_PROFILE_OPCODES, " ")); 1547 1559 ea_debug_printf(EA_PROFILE_OPCODES, "enter profile_execute: %s:%s\n", op_array->filename, op_array->function_name); 1548 1560 ea_debug_start_time(&tv_start); … … 1557 1569 EAG(self_time)[EAG(profile_level)-1] += usec; 1558 1570 for (i=0;i<EAG(profile_level);i++) 1559 ea_debug_put(EA_PROFILE_OPCODES, " ");1571 DBG(ea_debug_put, (EA_PROFILE_OPCODES, " ")); 1560 1572 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)]); 1561 1573 } … … 1574 1586 EAG(self_time)[EAG(profile_level)-1] += usec; 1575 1587 for (i=0;i<EAG(profile_level);i++) 1576 ea_debug_put(EA_PROFILE_OPCODES, " ");1588 DBG(ea_debug_put, (EA_PROFILE_OPCODES, " ")); 1577 1589 ea_debug_printf(EA_DEBUG, "zend_op_array compile: %s (%ld)\n", file_handle->filename, usec); 1578 1590 return t; … … 1828 1840 eaccelerator_clean_request(TSRMLS_C); 1829 1841 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", 1831 1843 getpid(), 1832 1844 (long)(active_opline-EG(active_op_array)->opcodes), 1833 1845 get_active_function_name(TSRMLS_C), 1834 1846 zend_get_executed_filename(TSRMLS_C), 1835 zend_get_executed_lineno(TSRMLS_C)) ;1847 zend_get_executed_lineno(TSRMLS_C))); 1836 1848 } 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())); 1838 1850 } 1839 1851 } … … 1999 2011 strcmp(sapi_module.name, "cgi") != 0 && 2000 2012 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")); 2004 2016 2005 2017 if (init_mm(TSRMLS_C) == FAILURE) { … … 2044 2056 #endif 2045 2057 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")); 2049 2061 ea_debug_shutdown(); 2050 2062 UNREGISTER_INI_ENTRIES(); … … 2081 2093 zend_hash_copy(&eaccelerator_global_class_table, CG(class_table), NULL, &tmp_class, sizeof(zend_class_entry)); 2082 2094 } 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")); 2085 2097 2086 2098 EAG(in_request) = 1; … … 2113 2125 } 2114 2126 } 2115 ea_debug_printf(EA_DEBUG, "[%d] Leave RINIT\n",getpid());2127 DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave RINIT\n",getpid())); 2116 2128 #ifdef DEBUG 2117 2129 EAG(xpad) = 0; … … 2196 2208 #endif 2197 2209 #endif 2198 ea_debug_printf(EA_DEBUG, "[%d] Enter RSHUTDOWN\n",getpid());2210 DBG(ea_debug_printf, (EA_DEBUG, "[%d] Enter RSHUTDOWN\n",getpid())); 2199 2211 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())); 2201 2213 return SUCCESS; 2202 2214 }