Changeset 337
- Timestamp:
- 08/20/07 22:57:00 (9 months ago)
- Files:
-
- eaccelerator/trunk/ChangeLog (modified) (1 diff)
- eaccelerator/trunk/control.php (modified) (2 diffs)
- eaccelerator/trunk/ea_info.c (modified) (1 diff)
- eaccelerator/trunk/eaccelerator.c (modified) (13 diffs)
- eaccelerator/trunk/eaccelerator.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/ChangeLog
r333 r337 14 14 session, shm or user cache functionality (which are all off by 15 15 default) 16 * Added a creation timestamp to each cache object (shm and disk) 17 * Added ttl and creation timestamp display to 18 eaccelerator_cached_scripts() / control.php 19 * Changed some counters in ea_cache_entry from signed to unsigned 20 int 21 * Renamed some mmCache remnants && fixed typos/language 16 22 17 23 2007-08-20 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> eaccelerator/trunk/control.php
r330 r337 474 474 <td class="h"><?php echo colheadstr('File', 0)?></td> 475 475 <td class="h"><?php echo colheadstr('Last Modified', 1)?></td> 476 <td class="h"><?php echo colheadstr('Size', 2)?></td> 477 <td class="h"><?php echo colheadstr('Reloads', 3)?></td> 478 <td class="h"><?php echo colheadstr('Hits', 4)?></td> 476 <td class="h"><?php echo colheadstr('Added', 2)?></td> 477 <td class="h"><?php echo colheadstr('TTL', 3)?></td> 478 <td class="h"><?php echo colheadstr('Size', 4)?></td> 479 <td class="h"><?php echo colheadstr('Reloads', 5)?></td> 480 <td class="h"><?php echo colheadstr('Hits', 6)?></td> 479 481 </tr> 480 482 <?php … … 489 491 $file_col = $scripts[$i]['file']; 490 492 } 493 494 if ($scripts[$i]['ttl'] != 0) { 495 $ttl_col = $scripts[$i]['ttl'] - time(); 496 if ($ttl_col <= 0) { 497 $ttl_col = "expired"; 498 } 499 } else { 500 $ttl_col = "∞"; 501 } 491 502 ?> 492 503 <tr> 493 504 <td class="el"><small><?php echo $file_col ?></small></td> 494 505 <td class="fl"><small><?php echo date('Y-m-d H:i:s', $scripts[$i]['mtime'])?></small></td> 506 <td class="fl"><small><?php echo date('Y-m-d H:i:s', $scripts[$i]['ts'])?></small></td> 507 <td class="fr"><small><?php echo $ttl_col ?></small></td> 495 508 <td class="fr"><small><?php echo format_size($scripts[$i]['size'])?></small></td> 496 509 <td class="fr"><small><?php echo $scripts[$i]['reloads']?> (<?php echo $scripts[$i]['usecount']?>)</small></td> eaccelerator/trunk/ea_info.c
r330 r337 456 456 add_assoc_string(script, "file", p->realfilename, 1); 457 457 add_assoc_long(script, "mtime", p->mtime); 458 add_assoc_long(script, "ts", p->ts); 459 add_assoc_long(script, "ttl", p->ttl); 458 460 add_assoc_long(script, "size", p->size); 459 461 add_assoc_long(script, "reloads", p->nreloads); eaccelerator/trunk/eaccelerator.c
r336 r337 108 108 109 109 /* saved original functions */ 110 static zend_op_array *(* mm_saved_zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);110 static zend_op_array *(*ea_saved_zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); 111 111 112 112 #ifdef DEBUG 113 static void (* mm_saved_zend_execute)(zend_op_array *op_array TSRMLS_DC);113 static void (*ea_saved_zend_execute)(zend_op_array *op_array TSRMLS_DC); 114 114 #endif 115 115 … … 165 165 eaccelerator_mm_instance->hash_cnt--; 166 166 if (p->use_cnt > 0) { 167 /* key is used by other process/thre d. Shedule it to remove*/167 /* key is used by other process/thread. Shedule it for removal */ 168 168 p->removed = 1; 169 169 p->next = eaccelerator_mm_instance->removed; … … 222 222 eaccelerator_mm_instance->hash[slot]->nreloads += p->nreloads; 223 223 if (p->use_cnt > 0) { 224 /* key is used by other process/thre d. Shedule it to remove */224 /* key is used by other process/thread. Shedule it to remove */ 225 225 p->removed = 1; 226 226 p->next = eaccelerator_mm_instance->removed; … … 746 746 p->ttl = 0; 747 747 } 748 p->ts = hdr.ts; /* get cached item creation timestamp from cache file */ 748 749 hash_add_mm(p); 749 750 } else { … … 781 782 hdr.size = p->size; 782 783 hdr.mtime = p->mtime; 784 hdr.ts = p->ts; 783 785 p->next = p; 784 786 hdr.crc32 = eaccelerator_crc32((const char*)p,p->size); … … 833 835 eaccelerator_store_int(p, key, len, op_array, f, c TSRMLS_CC); 834 836 p->mtime = buf->st_mtime; 837 p->ts = EAG(req_start); 835 838 p->filesize = buf->st_size; 836 839 p->size = size; … … 1114 1117 char realname[MAXPATHLEN]; 1115 1118 int nreloads; 1116 time_t compile_time;1117 1119 int stat_result = 0; 1118 1120 #ifdef DEBUG … … 1141 1143 file_handle->filename == NULL || stat_result != 0 || !ok_to_cache) { 1142 1144 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: compiling\n", getpid())); 1143 t = mm_saved_zend_compile_file(file_handle, type TSRMLS_CC);1145 t = ea_saved_zend_compile_file(file_handle, type TSRMLS_CC); 1144 1146 DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: end (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start))); 1145 1147 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: end\n", getpid())); … … 1156 1158 } 1157 1159 1158 compile_time = EAG(req_start); 1159 if (buf.st_mtime >= compile_time && eaccelerator_debug > 0) { 1160 if (buf.st_mtime >= EAG(req_start) && eaccelerator_debug > 0) { 1160 1161 ea_debug_log("EACCELERATOR: Warning: \"%s\" is cached but it's mtime is in the future.\n", file_handle->filename); 1161 1162 } 1162 1163 1163 t = eaccelerator_restore(realname, &buf, &nreloads, compile_timeTSRMLS_CC);1164 t = eaccelerator_restore(realname, &buf, &nreloads, EAG(req_start) TSRMLS_CC); 1164 1165 1165 1166 // segv74: really cheap work around to auto_global problem. … … 1262 1263 ea_bailout = 0; 1263 1264 zend_try { 1264 t = mm_saved_zend_compile_file(file_handle, type TSRMLS_CC);1265 t = ea_saved_zend_compile_file(file_handle, type TSRMLS_CC); 1265 1266 } zend_catch { 1266 1267 CG(function_table) = orig_function_table; … … 1382 1383 EAG(profile_level)++; 1383 1384 ea_debug_printf(EA_PROFILE_OPCODES, "About to enter zend_execute...\n"); 1384 mm_saved_zend_execute(op_array TSRMLS_CC);1385 ea_saved_zend_execute(op_array TSRMLS_CC); 1385 1386 ea_debug_printf(EA_PROFILE_OPCODES, "Finished zend_execute...\n"); 1386 1387 usec = ea_debug_elapsed_time(&tv_start); … … 1853 1854 return FAILURE; 1854 1855 } 1855 mm_saved_zend_compile_file = zend_compile_file;1856 ea_saved_zend_compile_file = zend_compile_file; 1856 1857 1857 1858 #ifdef DEBUG 1858 1859 zend_compile_file = profile_compile_file; 1859 mm_saved_zend_execute = zend_execute;1860 ea_saved_zend_execute = zend_execute; 1860 1861 zend_execute = profile_execute; 1861 1862 #else … … 1885 1886 return SUCCESS; 1886 1887 } 1887 zend_compile_file = mm_saved_zend_compile_file;1888 zend_compile_file = ea_saved_zend_compile_file; 1888 1889 #ifdef WITH_EACCELERATOR_CONTENT_CACHING 1889 1890 eaccelerator_content_cache_shutdown(); eaccelerator/trunk/eaccelerator.h
r330 r337 278 278 279 279 /* 280 * A mm_cache_entry is a bucket for one PHP script file.281 * Nested functions and classes which defined in the file goes282 * into the list of mm_fc_entry.280 * A ea_cache_entry is a bucket for one PHP script file. 281 * User functions and classes defined in the file go into 282 * the list of ea_fc_entry. 283 283 */ 284 284 typedef struct _ea_cache_entry { 285 285 struct _ea_cache_entry *next; 286 286 #ifdef EACCELERATOR_USE_INODE 287 dev_t st_dev; /* file's device */288 ino_t st_ino; /* file's inode */289 #else 290 unsigned int hv; /* hash value */287 dev_t st_dev; /* file's device */ 288 ino_t st_ino; /* file's inode */ 289 #else 290 unsigned int hv; /* hash value */ 291 291 #endif 292 292 off_t filesize; /* file size */ 293 time_t mtime; /* file last modification time */ 294 time_t ttl; /* expiration time */ 295 int size; /* entry size (bytes) */ 296 int nhits; /* hits count */ 297 int nreloads; /* count of reloads */ 298 int use_cnt; /* how many processes uses the entry */ 293 time_t mtime; /* file last modification time */ 294 time_t ttl; /* expiration time (updated on each hit) */ 295 time_t ts; /* timestamp of cache entry */ 296 unsigned int size; /* entry size (bytes) */ 297 unsigned int nhits; /* hits count */ 298 unsigned int nreloads; /* count of reloads */ 299 int use_cnt; /* how many processes uses the entry */ 299 300 ea_op_array *op_array; /* script's global scope code */ 300 301 ea_fc_entry *f_head; /* list of nested functions */ … … 318 319 319 320 /* 320 * Linked list of mm_cache_entry which are used by process/thread321 * Linked list of ea_cache_entry which are used by process/thread 321 322 */ 322 323 typedef struct _ea_used_entry { … … 344 345 int size; 345 346 time_t mtime; 347 time_t ts; 346 348 unsigned int crc32; 347 349 } ea_file_header;