cvs: pecl(PECL_4_3) /apd README php_apd.c php_apd.h
| From: | George Schlossnagle | Date: | Wed, 10 Mar 2004 22:01:26 +0000 |
| Subject: | cvs: pecl(PECL_4_3) /apd README php_apd.c php_apd.h | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-1049@lists.php.net to get a copy of this message | ||
gschlossnagle Wed Mar 10 17:01:26 2004 EDT
Modified files: (Branch: PECL_4_3)
/pecl/apd README php_apd.c php_apd.h
Log:
apply trace file name change semantics from HEAD
http://cvs.php.net/diff.php/pecl/apd/README?r1=1.15&r2=1.15.4.1&ty=u
Index: pecl/apd/README
diff -u pecl/apd/README:1.15 pecl/apd/README:1.15.4.1
--- pecl/apd/README:1.15 Wed Apr 2 09:39:54 2003
+++ pecl/apd/README Wed Mar 10 17:01:25 2004
@@ -89,7 +89,7 @@
apd_set_pprof_trace();
- This will generate a pprof.<pid> file in your apd.dumpdir. The format
+ This will generate a pprof.<pid>.<id> file in your apd.dumpdir. The format
of this file is as follows:
! 1 simple.php
@@ -141,11 +141,11 @@
Thus, to get basic output on the trace, we would do
-pprofp -u /tmp/pprof.<pid>
+pprofp -u /tmp/pprof.<pid>.<id>
and we get something like:
-10:33:29(george@ballista)[~/pear/PECL/apd]> pprofp -u /tmp/pprof.23424
+10:33:29(george@ballista)[~/pear/PECL/apd]> pprofp -u /tmp/pprof.23424.0
Trace for /data/storage/mirrors/www.php.net/index.php
Total Elapsed Time = 0.09
@@ -181,7 +181,7 @@
This sorts output based on the usertime spent in subroutines, and ommits a call tree. If
we added a -t
-10:38:30(george@ballista)[~/pear/PECL/apd]> pprofp -u -t /tmp/pprof.23424
+10:38:30(george@ballista)[~/pear/PECL/apd]> pprofp -u -t /tmp/pprof.23424.0
...
http://cvs.php.net/diff.php/pecl/apd/php_apd.c?r1=1.54.2.2&r2=1.54.2.3&ty=u
Index: pecl/apd/php_apd.c
diff -u pecl/apd/php_apd.c:1.54.2.2 pecl/apd/php_apd.c:1.54.2.3
--- pecl/apd/php_apd.c:1.54.2.2 Wed Mar 10 16:55:36 2004
+++ pecl/apd/php_apd.c Wed Mar 10 17:01:25 2004
@@ -770,9 +770,6 @@
PHP_RINIT_FUNCTION(apd)
{
gettimeofday(&APD_GLOBALS(req_begin), NULL);
-// gettimeofday(&APD_GLOBALS(last_call), NULL);
-// APD_GLOBALS(last_mem_header) = AG(head)->pLast;
-// APD_GLOBALS(last_pmem_header) = AG(phead)->pLast;
APD_GLOBALS(dump_file) = stderr;
APD_GLOBALS(dump_sock_id) = 0;
APD_GLOBALS(bitmask) = 0;
@@ -815,27 +812,28 @@
if (APD_GLOBALS(dump_file)) {
fclose(APD_GLOBALS(dump_file));
}
- if(APD_GLOBALS(pprof_file)) {
- struct tms endtp;
- clock_t endclock;
- endclock = times(&endtp);
- apd_pprof_fprintf("END_TRACE\n");
- apd_pprof_fprintf("total_user=%d\ntotal_sys=%d\ntotal_wall=%d\n",
- endtp.tms_utime - APD_GLOBALS(firsttms).tms_utime,
- endtp.tms_stime - APD_GLOBALS(firsttms).tms_stime,
- endclock - APD_GLOBALS(firstclock));
- apd_pprof_fprintf("END_FOOTER\n");
- fclose(APD_GLOBALS(pprof_file));
- }
- if (APD_GLOBALS(dump_sock_id)) {
- close(APD_GLOBALS(dump_sock_id));
- /* bit academic - but may as well */
- APD_GLOBALS(dump_sock_id)=0;
- }
+ if(APD_GLOBALS(pprof_file)) {
+ struct tms endtp;
+ clock_t endclock;
+ endclock = times(&endtp);
+ apd_pprof_fprintf("END_TRACE\n");
+ apd_pprof_fprintf("total_user=%d\ntotal_sys=%d\ntotal_wall=%d\n",
+ endtp.tms_utime - APD_GLOBALS(firsttms).tms_utime,
+ endtp.tms_stime - APD_GLOBALS(firsttms).tms_stime,
+ endclock - APD_GLOBALS(firstclock));
+ apd_pprof_fprintf("END_FOOTER\n");
+ fclose(APD_GLOBALS(pprof_file));
+ }
+ if (APD_GLOBALS(dump_sock_id)) {
+ close(APD_GLOBALS(dump_sock_id));
+ /* bit academic - but may as well */
+ APD_GLOBALS(dump_sock_id)=0;
+ }
zend_hash_destroy(APD_GLOBALS(summary));
zend_hash_destroy(APD_GLOBALS(file_summary));
efree(APD_GLOBALS(summary));
efree(APD_GLOBALS(file_summary));
+ APD_GLOBALS(counter)++;
return SUCCESS;
}
@@ -1248,7 +1246,7 @@
int socketd = 0;
int path_len;
char *dumpdir;
- char *path;
+ char path[MAXPATHLEN];
zval **z_dumpdir;
if(ZEND_NUM_ARGS() > 1 )
@@ -1277,13 +1275,10 @@
convert_to_string_ex(z_dumpdir);
dumpdir = Z_STRVAL_PP(z_dumpdir);
}
- path_len = strlen(dumpdir) + 1 + strlen("pprof.") + 5;
- path = (char *) emalloc((path_len + 1)* sizeof(char) );
- snprintf(path, path_len + 1, "%s/pprof.%05d", dumpdir, getpid());
+ snprintf(path, MAXPATHLEN, "%s/pprof.%05d.%d", dumpdir, getpid(),
APD_GLOBALS(counter));
if((APD_GLOBALS(pprof_file) = fopen(path, "a")) == NULL) {
zend_error(E_ERROR, "%s() failed to open %s for tracing",
get_active_function_name(TSRMLS_C), path);
}
- efree(path);
apd_pprof_header(TSRMLS_C);
}
http://cvs.php.net/diff.php/pecl/apd/php_apd.h?r1=1.19.4.2&r2=1.19.4.3&ty=u
Index: pecl/apd/php_apd.h
diff -u pecl/apd/php_apd.h:1.19.4.2 pecl/apd/php_apd.h:1.19.4.3
--- pecl/apd/php_apd.h:1.19.4.2 Wed Mar 10 16:55:36 2004
+++ pecl/apd/php_apd.h Wed Mar 10 17:01:25 2004
@@ -128,6 +128,7 @@
int interactive_mode; /* is interactive mode on */
int ignore_interactive; /* ignore interactive mode flag for executing php from the debugger*/
int allocated_memory;
+ int counter;
ZEND_END_MODULE_GLOBALS(apd)
#ifdef ZTS