diff options
author | Jacob Oettinger <jacob@oettinger.dk> | 2011-11-14 16:14:00 +0100 |
---|---|---|
committer | Jacob Oettinger <jacob@oettinger.dk> | 2011-11-14 16:14:00 +0100 |
commit | ed09455bfbbb986a81ab107a4aa4e8b4b1d76042 (patch) | |
tree | 9084a1fb81533d269eae93a341d6ef472a3548fc | |
parent | 0c801cd27a68b37af51ecd72f4bd3f90641f9e4a (diff) | |
download | webgrind-ed09455bfbbb986a81ab107a4aa4e8b4b1d76042.zip webgrind-ed09455bfbbb986a81ab107a4aa4e8b4b1d76042.tar.gz webgrind-ed09455bfbbb986a81ab107a4aa4e8b4b1d76042.tar.bz2 |
Implements changes in Preprocessor required by new reader that includes line number information in debug versions greater than 2.1.
Fixes #30 and #29
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | library/Preprocessor.php | 5 | ||||
-rw-r--r-- | library/Reader.php | 2 |
3 files changed, 6 insertions, 5 deletions
@@ -88,8 +88,8 @@ try { $result['breakdown'] = $breakdown; $result['mtime'] = date(Webgrind_Config::$dateFormat,filemtime(Webgrind_Config::xdebugOutputDir().$dataFile)); - $version = preg_replace('/[^0-9\.]/', '', $reader->getHeader('creator')); - $result['linkToFunctionLine'] = version_compare($version, '2.1') > 0; + $creator = preg_replace('/[^0-9\.]/', '', $reader->getHeader('creator')); + $result['linkToFunctionLine'] = version_compare($creator, '2.1') > 0; echo json_encode($result); break; diff --git a/library/Preprocessor.php b/library/Preprocessor.php index 4365b79..b29581c 100644 --- a/library/Preprocessor.php +++ b/library/Preprocessor.php @@ -16,7 +16,7 @@ class Webgrind_Preprocessor /** * Fileformat version. Embedded in the output for parsers to use. */ - const FILE_FORMAT_VERSION = 6; + const FILE_FORMAT_VERSION = 7; /** * Binary number format used. @@ -83,6 +83,7 @@ class Webgrind_Preprocessor } // Cost line list($lnr, $cost) = fscanf($in,"%d %d"); + $functions[$function]['line'] = $lnr; $functions[$function]['summedSelfCost'] += $cost; $functions[$function]['summedInclusiveCost'] += $cost; } else if(substr($line,0,4)==='cfn=') { @@ -127,7 +128,7 @@ class Webgrind_Preprocessor $functionAddresses[] = ftell($out); $calledFromCount = sizeof($function['calledFromInformation']); $subCallCount = sizeof($function['subCallInformation']); - fwrite($out, pack(self::NR_FORMAT.'*', $function['summedSelfCost'], $function['summedInclusiveCost'], $function['invocationCount'], $calledFromCount, $subCallCount)); + fwrite($out, pack(self::NR_FORMAT.'*', $function['line'], $function['summedSelfCost'], $function['summedInclusiveCost'], $function['invocationCount'], $calledFromCount, $subCallCount)); // Write called from information foreach((array)$function['calledFromInformation'] as $call){ fwrite($out, pack(self::NR_FORMAT.'*', $call['functionNr'], $call['line'], $call['callCount'], $call['summedCallCost'])); diff --git a/library/Reader.php b/library/Reader.php index f4bf9e3..35c5113 100644 --- a/library/Reader.php +++ b/library/Reader.php @@ -10,7 +10,7 @@ class Webgrind_Reader /** * File format version that this reader understands */ - const FILE_FORMAT_VERSION = 6; + const FILE_FORMAT_VERSION = 7; /** * Binary number format used. |