cvs: pecl(PECL_4_3) /apd php_apd.c pprofp
| From: | George Schlossnagle | Date: | Wed, 10 Mar 2004 22:31:47 +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-1052@lists.php.net to get a copy of this message | ||
gschlossnagle Wed Mar 10 17:31:47 2004 EDT
Modified files: (Branch: PECL_4_3)
/pecl/apd php_apd.c pprofp
Log:
patches from rasmus
http://cvs.php.net/diff.php/pecl/apd/php_apd.c?r1=1.54.2.3&r2=1.54.2.4&ty=u
Index: pecl/apd/php_apd.c
diff -u pecl/apd/php_apd.c:1.54.2.3 pecl/apd/php_apd.c:1.54.2.4
--- pecl/apd/php_apd.c:1.54.2.3 Wed Mar 10 17:01:25 2004
+++ pecl/apd/php_apd.c Wed Mar 10 17:31:47 2004
@@ -809,7 +809,7 @@
apd_dump_fprintf("---------------------------------------------------------------------------\n");
}
shutdownTracer();
- if (APD_GLOBALS(dump_file)) {
+ if (APD_GLOBALS(dump_file) && APD_GLOBALS(dump_file) != stderr ) {
fclose(APD_GLOBALS(dump_file));
}
if(APD_GLOBALS(pprof_file)) {
@@ -823,6 +823,7 @@
endclock - APD_GLOBALS(firstclock));
apd_pprof_fprintf("END_FOOTER\n");
fclose(APD_GLOBALS(pprof_file));
+ APD_GLOBALS(pprof_file) = NULL;
}
if (APD_GLOBALS(dump_sock_id)) {
close(APD_GLOBALS(dump_sock_id));
http://cvs.php.net/diff.php/pecl/apd/pprofp?r1=1.11.4.2&r2=1.11.4.3&ty=u
Index: pecl/apd/pprofp
diff -u pecl/apd/pprofp:1.11.4.2 pecl/apd/pprofp:1.11.4.3
--- pecl/apd/pprofp:1.11.4.2 Wed Mar 10 16:55:36 2004
+++ pecl/apd/pprofp Wed Mar 10 17:31:47 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,9 +20,16 @@
exit(1);
}
+$count = 0;
+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";
+ }
}
$callstack = array();
@@ -39,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)){
@@ -153,6 +165,10 @@
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
Total Elapsed Time = %4.2f
@@ -269,7 +285,7 @@
printf("%3.01f %2.02f %2.02f %2.02f %2.02f %2.02f %2.02f %4d %2.04f %2.04f %12d
%s\n", $pcnt, $rsecs, $c_rsecs, $usecs, $c_usecs, $ssecs, $c_ssecs, $ncalls, $percall,
$cpercall, $mem_usage, $name);
}
}
-
+}
function usage() {
print <<<EOD