cvs: pear /PECL/apd php_apd.c pprofp
| From: | George Schlossnagle | Date: | Mon, 25 Nov 2002 16:32:26 +0000 |
| Subject: | cvs: pear /PECL/apd php_apd.c pprofp | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7581@lists.php.net to get a copy of this message | ||
gschlossnagle Mon Nov 25 11:32:26 2002 EDT
Modified files:
/pear/PECL/apd php_apd.c pprofp
Log:
added support (buggy??) for tracking memory usage when php is compiled
with --enable-memory-limit
Index: pear/PECL/apd/php_apd.c
diff -u pear/PECL/apd/php_apd.c:1.46 pear/PECL/apd/php_apd.c:1.47
--- pear/PECL/apd/php_apd.c:1.46 Thu Nov 21 15:38:56 2002
+++ pear/PECL/apd/php_apd.c Mon Nov 25 11:32:26 2002
@@ -1239,7 +1239,7 @@
convert_to_string_ex(z_dumpdir);
dumpdir = Z_STRVAL_PP(z_dumpdir);
}
- path_len = strlen(dumpdir) + 1 + strlen("apd_dump_") + 5;
+ 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());
if((APD_GLOBALS(pprof_file) = fopen(path, "a")) == NULL) {
Index: pear/PECL/apd/pprofp
diff -u pear/PECL/apd/pprofp:1.7 pear/PECL/apd/pprofp:1.8
--- pear/PECL/apd/pprofp:1.7 Thu Nov 21 15:35:49 2002
+++ pear/PECL/apd/pprofp Mon Nov 25 11:32:26 2002
@@ -4,7 +4,7 @@
$con = new Console_Getopt;
$args = $con->readPHPArgv();
array_shift($args);
-$shortoptions = 'acg:hiIlMrRsStTuUO:vzZ';
+$shortoptions = 'acg:hiIlmMrRsStTuUO:vzZ';
$retval = $con->getopt( $args, $shortoptions);
if(is_object($retval)) {
usage();
@@ -31,6 +31,11 @@
break;
}
list($token, $data) = preg_split("/ /",$line, 2);
+ if($token == '!') {
+ list ($index, $file) = preg_split("/ /", $data, 2);
+ $file_hash[$index] = $file;
+ continue;
+ }
if( $token == '&') {
list ($index, $name, $type) = preg_split("/ /", $data, 3);
$symbol_hash[$index] = $name;
@@ -38,7 +43,7 @@
continue;
}
if( $token == '+') {
- list($index, $notes) = preg_split("/ /",$data, 2);
+ list($index, $file, $line) = preg_split("/ /",$data, 3);
if(array_key_exists('i',$opt) && $symbol_type[$index] == 1) {
continue;
}
@@ -50,7 +55,10 @@
printf("%2.02f ", $rtotal/$cfg['hz']);
}
print str_repeat(" ", $indent_cur).$symbol_hash[$index_cur]."\n";
- }
+ if(array_key_exists('m', $opt)) {
+ print str_repeat(" ", $indent_cur)."C: $file_hash[$file]:$line M:
$memory\n";
+ }
+ }
elseif(array_key_exists('t', $opt)) {
if ( $indent_last == $indent_cur && $index_last == $index_cur ) {
$repcnt++;
@@ -63,10 +71,15 @@
printf("%2.02f ", $rtotal/$cfg['hz']);
}
print str_repeat(" ",
$indent_last).$symbol_hash[$index_last].$repstr."\n";
+ if(array_key_exists('m', $opt)) {
+ print str_repeat(" ", $indent_cur)."C: $file_hash[$file_last]:$line_last M:
$memory\n";
+ }
$repstr = '';
$repcnt = 0;
$index_last = $index_cur;
$indent_last = $indent_cur;
+ $file_last = $file;
+ $line_last = $line;
}
}
$indent_cur++;
@@ -77,7 +90,7 @@
continue;
}
if ($token == '-') {
- list ($index, $notes, $memory) = preg_split("/ /", $data, 3);
+ list ($index, $memory) = preg_split("/ /", $data, 2);
if(array_key_exists('i',$opt) && $symbol_type[$index] == 1)
{
continue;