diff options
author | oetting <jacob@oettinger.dk> | 2008-04-17 13:42:58 +0000 |
---|---|---|
committer | oetting <jacob@oettinger.dk> | 2008-04-17 13:42:58 +0000 |
commit | bd21f5a74c92ce53af546e858e88c8259629e37f (patch) | |
tree | 77c7b6c3efcbc3a96215f755153dc2189ed014cb | |
parent | be249ef39aec96f50f21d08d244593bf28c2df88 (diff) | |
download | webgrind-bd21f5a74c92ce53af546e858e88c8259629e37f.zip webgrind-bd21f5a74c92ce53af546e858e88c8259629e37f.tar.gz webgrind-bd21f5a74c92ce53af546e858e88c8259629e37f.tar.bz2 |
Namespaced classes
-rw-r--r-- | index.php | 10 | ||||
-rw-r--r-- | lib/Webgrind/FileHandler.php (renamed from lib/FileHandler.php) | 13 | ||||
-rw-r--r-- | lib/Webgrind/Preprocessor.php (renamed from lib/CallgrindPreprocessor.php) | 29 | ||||
-rw-r--r-- | lib/Webgrind/Reader.php (renamed from lib/Reader.php) | 2 | ||||
-rw-r--r-- | templates/index.phtml | 2 |
5 files changed, 15 insertions, 41 deletions
@@ -1,7 +1,7 @@ <?php require 'config.php'; -require 'lib/FileHandler.php'; +require 'lib/Webgrind/FileHandler.php'; // Errorhandling. // No files, outputdir not writabel // Show self traces in option group @@ -14,15 +14,15 @@ if (ini_get('date.timezone') == '') switch(get('op')){ case 'file_list': - echo json_encode(FileHandler::getInstance()->getTraceList()); + echo json_encode(Webgrind_FileHandler::getInstance()->getTraceList()); break; case 'function_list': $dataFile = get('dataFile'); if($dataFile=='0'){ - $files = FileHandler::getInstance()->getTraceList(); + $files = Webgrind_FileHandler::getInstance()->getTraceList(); $dataFile = $files[0]['filename']; } - $reader = FileHandler::getInstance()->getTraceReader($dataFile); + $reader = Webgrind_FileHandler::getInstance()->getTraceReader($dataFile); $count = $reader->getFunctionCount(); $functions = array(); $summedCost = $shownTotal = 0; @@ -62,7 +62,7 @@ switch(get('op')){ echo json_encode($result); break; case 'callinfo_list': - $reader = FileHandler::getInstance()->getTraceReader(get('file')); + $reader = Webgrind_FileHandler::getInstance()->getTraceReader(get('file')); $functionNr = get('functionNr'); $function = $reader->getFunctionInfo($functionNr); diff --git a/lib/FileHandler.php b/lib/Webgrind/FileHandler.php index 9b6266a..790ac6a 100644 --- a/lib/FileHandler.php +++ b/lib/Webgrind/FileHandler.php @@ -1,12 +1,13 @@ <?php require 'Reader.php'; -require 'CallgrindPreprocessor.php'; -class FileHandler{ +require 'Preprocessor.php'; + +class Webgrind_FileHandler{ private static $singleton = null; public static function getInstance(){ if(self::$singleton==null) - self::$singleton = new FileHandler(); + self::$singleton = new self(); return self::$singleton; } @@ -68,12 +69,12 @@ class FileHandler{ public function getTraceReader($file){ $prepFile = Config::$storageDir.$file.Config::$preprocessedSuffix; try{ - $r = new Reader($prepFile); + $r = new Webgrind_Reader($prepFile); } catch (Exception $e){ // Preprocessed file does not exist or other error - $cg = new CallgrindPreprocessor(Config::$xdebugOutputDir.$file, $prepFile); + $cg = new Webgrind_Preprocessor(Config::$xdebugOutputDir.$file, $prepFile); $cg->parse(); - $r = new Reader($prepFile); + $r = new Webgrind_Reader($prepFile); } return $r; } diff --git a/lib/CallgrindPreprocessor.php b/lib/Webgrind/Preprocessor.php index 7beddd5..3a9d033 100644 --- a/lib/CallgrindPreprocessor.php +++ b/lib/Webgrind/Preprocessor.php @@ -1,33 +1,6 @@ <?php -/* -Preprocessed file format v5: - -file_contents: version_number header_address function_count function_addresses functions headers -version_number: number -header_address: number -function_count: number -function_addresses: {number} -functions: {summed_self_cost summed_inclusive_cost invocation_count called_from_count call_information file_name function_name} -summed_self_cost: number -summed_inclusive_cost: number -summed_call_cost: number -invocation_count: number -called_from_count: number -call_information: {function_number line call_count summed_call_cost} -function_number: number -line: number -call_count: number -summed_call_cost: number -file_name: string_newline -function_name: string_newline -headers: {string_newline} -string_newline: any string terminated by a newline character -number: unsigned long (always 32 bit, little endian byte order) - -*/ - -class CallgrindPreprocessor{ +class Webgrind_Preprocessor{ const FILE_FORMAT_VERSION = 5; const NR_FORMAT = 'V'; diff --git a/lib/Reader.php b/lib/Webgrind/Reader.php index 26401b7..822fdb0 100644 --- a/lib/Reader.php +++ b/lib/Webgrind/Reader.php @@ -1,6 +1,6 @@ <?php -class Reader{ +class Webgrind_Reader{ const FILE_FORMAT_VERSION = 5; const NR_FORMAT = 'V'; diff --git a/templates/index.phtml b/templates/index.phtml index 501f98e..dba39a0 100644 --- a/templates/index.phtml +++ b/templates/index.phtml @@ -200,7 +200,7 @@ <label style="margin:0 5px">of</label> <select id="dataFile" name="dataFile" style="width:200px"> <option value="0">Auto (newest)</option> - <?foreach(FileHandler::getInstance()->getTraceList() as $trace):?> + <?foreach(Webgrind_FileHandler::getInstance()->getTraceList() as $trace):?> <option value="<?=$trace['filename']?>"><?=$trace['invokeUrl']?> (<?=$trace['filename']?>)</option> <?endforeach;?> </select> |