root/eaccelerator/tags/0.9.3/debug.c

Revision 64, 3.2 kB (checked in by zoeloelip, 3 years ago)

* This commit contains the first part of the code refactoring. In this part

the monolitic eaccelerator.c file has been split up in more logical blocks.

cache.c/cache.h contains the procedure for shm.c/session.c/content.c to add user_cache entries to the ea cache
shm.c/shm.h contains the eaccelerator shared memory functions
session.c/session.h contains the session related stuff
webui.c/webui.h contains all stuff related to the webinterface and disassembler
debug.c/debug.h contains some procedures to print debug information
content.h contains the php content caching prototype instead of eaccelerator.h

* Added --without-eaccelerator-shared-memory and --without-eaccelerator-webui configure switches

Bugfixes included:
* Patch 1188510 eaccelerator_compile_file typos
* Patch 1189792 session life time patch
* Patch 1167069 HAS_ATTRIBUTE fix with FreeBSD 4.x
* Patch 1166707 loader patch for OOP functions in PHP5 (only rapidly tested but also seemed ok to segv)
* string in eaccelerator_put_page (content.c line 162) which wasn't freed (Thanks to The_Surfer)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2    +----------------------------------------------------------------------+
3    | eAccelerator project                                                 |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 2004 - 2005 eAccelerator                               |
6    | http://eaccelerator.net                                                      |
7    +----------------------------------------------------------------------+
8    | This program is free software; you can redistribute it and/or        |
9    | modify it under the terms of the GNU General Public License          |
10    | as published by the Free Software Foundation; either version 2       |
11    | of the License, or (at your option) any later version.               |
12    |                                                                      |
13    | This program is distributed in the hope that it will be useful,      |
14    | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
15    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
16    | GNU General Public License for more details.                         |
17    |                                                                      |
18    | You should have received a copy of the GNU General Public License    |
19    | along with this program; if not, write to the Free Software          |
20    | Foundation, Inc., 59 Temple Place - Suite 330, Boston,               |
21    | MA  02111-1307, USA.                                                 |
22    |                                                                      |
23    | A copy is availble at http://www.gnu.org/copyleft/gpl.txt            |
24    +----------------------------------------------------------------------+
25    | Author(s): Dmitry Stogov <dstogov@users.sourceforge.net>             |
26    +----------------------------------------------------------------------+
27    $Id$
28 */
29
30 #include "eaccelerator.h"
31 #include "debug.h"
32 #include <ctype.h>
33 #include <stdio.h>
34
35 #if defined(DEBUG) || defined(TEST_PERFORMANCE)  || defined(PROFILE_OPCODES)
36
37 extern FILE *F_fp;
38
39 void
40 binary_print (char *p, int len)
41 {
42         while (len--)
43         {
44                 fputc (*p++, F_fp);
45         }
46         fputc ('\n', F_fp);
47 }
48
49 void
50 log_hashkeys (char *p, HashTable * ht)
51 {
52         Bucket *b;
53         int i = 0;
54
55         b = ht->pListHead;
56
57         fputs (p, F_fp);
58         while (b)
59         {
60                 fprintf (F_fp, "[%d] ", i);
61                 binary_print (b->arKey, b->nKeyLength);
62
63                 b = b->pListNext;
64                 i++;
65         }
66 }
67
68 void
69 pad (TSRMLS_D)
70 {
71         int i = MMCG (xpad);
72         while (i-- > 0)
73         {
74                 fputc ('\t', F_fp);
75         }
76 }
77
78 void
79 start_time (struct timeval *tvstart)
80 {
81         gettimeofday (tvstart, NULL);
82 }
83
84 long
85 elapsed_time (struct timeval *tvstart)
86 {
87         struct timeval tvend;
88         int sec, usec;
89         gettimeofday (&tvend, NULL);
90         sec = tvend.tv_sec - tvstart->tv_sec;
91         usec = tvend.tv_usec - tvstart->tv_usec;
92         return sec * 1000000 + usec;
93 }
94 #endif /* #if defined(DEBUG) || defined(TEST_PERFORMANCE)  || defined(PROFILE_OPCODES) */
95
96 void
97 debug_printf (char *format, ...)
98 {
99         char output_buf[512];
100         va_list args;
101
102         va_start (args, format);
103         vsnprintf (output_buf, sizeof (output_buf), format, args);
104         va_end (args);
105
106 #ifdef ZEND_WIN32
107         OutputDebugString (output_buf);
108 /*  zend_printf("EACCELERATOR: %s<br>\n",output_buf);*/
109 #else
110         fputs (output_buf, stderr);
111 #endif
112 }
Note: See TracBrowser for help on using the browser.