cvs: pecl(PECL_4_3) /apd php_apd.c pprofp
| From: | George Schlossnagle | Date: | Thu, 11 Mar 2004 21:27:01 +0000 |
| Subject: | cvs: pecl(PECL_4_3) /apd php_apd.c pprofp | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-1070@lists.php.net to get a copy of this message | ||
gschlossnagle Thu Mar 11 16:27:01 2004 EDT
Modified files: (Branch: PECL_4_3)
/pecl/apd php_apd.c pprofp
Log:
reapply rasmus' patches
http://cvs.php.net/diff.php/pecl/apd/php_apd.c?r1=1.54.2.5&r2=1.54.2.6&ty=u
Index: pecl/apd/php_apd.c
diff -u pecl/apd/php_apd.c:1.54.2.5 pecl/apd/php_apd.c:1.54.2.6
--- pecl/apd/php_apd.c:1.54.2.5 Thu Mar 11 16:14:15 2004
+++ pecl/apd/php_apd.c Thu Mar 11 16:27:01 2004
@@ -574,11 +574,11 @@
PHP_RSHUTDOWN_FUNCTION(apd)
{
-// APD_GLOBALS(output).footer();
- if (APD_GLOBALS(pprof_file)) {
+ APD_GLOBALS(output).footer();
+ if (APD_GLOBALS(pprof_file && APD_GLOBALS(pprof_file) != stderr)) {
fclose(APD_GLOBALS(pprof_file));
+ APD_GLOBALS(pprof_file) = NULL;
}
-
if (APD_GLOBALS(dump_sock_id)) {
close(APD_GLOBALS(dump_sock_id));
/* bit academic - but may as well */
http://cvs.php.net/diff.php/pecl/apd/pprofp?r1=1.11.4.4&r2=1.11.4.5&ty=u
Index: pecl/apd/pprofp
diff -u pecl/apd/pprofp:1.11.4.4 pecl/apd/pprofp:1.11.4.5
--- pecl/apd/pprofp:1.11.4.4 Thu Mar 11 16:14:15 2004
+++ pecl/apd/pprofp Thu Mar 11 16:27:01 2004
@@ -1,4 +1,4 @@
-#!/usr/bin/env php
+#!/usr/bin/env php -dvariables_order="GPS" -dauto_prepend_file= -dauto_append_file=
<?php
require "Console/Getopt.php";
error_reporting(0);
@@ -20,7 +20,17 @@
exit(1);
}
-parse_info('HEADER', $DATA, $cfg);
+while(!feof($DATA)) {
+ $count++;
+ $cfg = array();
+ parse_info('HEADER', $DATA, $cfg);
+ if(array_key_exists('hz', $cfg)) {
+ if($count == 1) {
+ print "File does not appear to be a pprof trace file\n";
+ exit;
+ }
+ }
+}
$callstack = array();
$calls = array();
@@ -36,9 +46,14 @@
$rtimes = array();
$stimes = array();
$utimes = array();
+$rtotal = 0;
$stotal = 0;
+$utotal = 0;
$last_memory = 0;
+$symbol_hash = array();
+$symbol_type = array();
+
while($line = fgets($DATA)) {
$line = rtrim($line);
if(preg_match("/^END_TRACE/", $line)){
@@ -142,6 +157,9 @@
if(array_key_exists('u', $opt)) { $sort = 'by_utime'; }
if(array_key_exists('U', $opt)) { $sort = 'by_c_utime'; }
if(array_key_exists('Z', $opt)) { $sort = 'by_c_time'; }
+if( !count($symbol_hash)) {
+ continue;
+}
printf("
Trace for %s