[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c xdebug/xdebug_code_coverage.c - Added a cache that prevents the code coverage functionality from running a

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Mon, 15 May 2006 23:34:06 +0200

Date: Mon May 15 23:34:05 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.75]
- Added a cache that prevents the code coverage functionality from running a
  "which code is executable check" on every function call, even if they were
  executed multiple times. This should speed up code coverage a lot.

Modified files:
           xdebug/php_xdebug.h (version: 1.105)
           xdebug/xdebug.c (version: 1.316)
           xdebug/xdebug_code_coverage.c (version: 1.17)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- xdebug/php_xdebug.h:1.104 Tue Apr 04 15:01:10 2006 GMT
+++ xdebug/php_xdebug.h Mon May 15 19:34:05 2006 GMT
@@ -134,6 +134,7 @@
         zend_bool do_code_coverage;
         xdebug_hash *code_coverage;
         zend_bool code_coverage_unused;
+ xdebug_hash *code_coverage_op_array_cache;
         unsigned int function_count;
 
         /* superglobals */

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.315
retrieving revision 1.316
diff -u -r1.315 -r1.316
--- xdebug/xdebug.c:1.315 Sat May 13 15:44:46 2006 GMT
+++ xdebug/xdebug.c Mon May 15 19:34:05 2006 GMT
@@ -670,6 +670,7 @@
         XG(do_trace) = 0;
         XG(do_code_coverage) = 0;
         XG(code_coverage) = xdebug_hash_alloc(32, xdebug_coverage_file_dtor);
+ XG(code_coverage_op_array_cache) = xdebug_hash_alloc(1024, NULL);
         XG(stack) = xdebug_llist_alloc(stack_element_dtor);
         XG(trace_file) = NULL;
         XG(tracefile_name) = NULL;
@@ -773,6 +774,7 @@
         XG(do_code_coverage) = 0;
 
         xdebug_hash_destroy(XG(code_coverage));
+ xdebug_hash_destroy(XG(code_coverage_op_array_cache));
 
         if (XG(remote_enabled)) {
                 XG(context).handler->remote_deinit(&(XG(context)));

[FILE: /xdebug/xdebug_code_coverage.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- xdebug/xdebug_code_coverage.c:1.16 Mon Feb 27 20:00:55 2006 GMT
+++ xdebug/xdebug_code_coverage.c Mon May 15 19:34:05 2006 GMT
@@ -128,7 +128,16 @@
 void xdebug_prefil_code_coverage(function_stack_entry *fse, zend_op_array *op_array TSRMLS_DC)
 {
         unsigned int i;
+ char cache_key[64];
+ int cache_key_len;
+ void *dummy;
 
+ cache_key_len = snprintf(&cache_key, 63, "%X", op_array);
+ if (xdebug_hash_find(XG(code_coverage_op_array_cache), cache_key, cache_key_len, (void*) &dummy)) {
+ return;
+ }
+ xdebug_hash_add(XG(code_coverage_op_array_cache), cache_key, cache_key_len, NULL);
+
         for (i = 0; i < op_array->size; i++) {
                 prefil_from_opcode(fse, op_array->filename, op_array->opcodes[i] TSRMLS_CC);
         }
Received on Mon May 15 2006 - 23:34:12 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST