diff --git a/control/Director.php b/control/Director.php index 7bf98dcff..421bae209 100644 --- a/control/Director.php +++ b/control/Director.php @@ -134,15 +134,7 @@ class Director implements TemplateGlobalProvider { $res = Injector::inst()->get('RequestProcessor')->postRequest($req, $response, $model); if ($res !== false) { - // ?debug_memory=1 will output the number of bytes of memory used for this request - if(isset($_REQUEST['debug_memory']) && $_REQUEST['debug_memory']) { - Debug::message(sprintf( - "Peak memory usage in bytes: %s", - number_format(memory_get_peak_usage(),0) - )); - } else { - $response->output(); - } + $response->output(); } else { // @TODO Proper response here. throw new SS_HTTPResponse_Exception("Invalid response"); @@ -957,4 +949,4 @@ class Director implements TemplateGlobalProvider { 'BaseHref' => 'absoluteBaseURL', //@deprecated 3.0 ); } -} \ No newline at end of file +} diff --git a/dev/Profiler.php b/dev/Profiler.php index 5565b9655..dbfd736cd 100644 --- a/dev/Profiler.php +++ b/dev/Profiler.php @@ -9,6 +9,8 @@ /** * Execution time profiler. + * + * @deprecated 3.1 The Profiler class is deprecated, use third party tools like XHProf instead * * @package framework * @subpackage misc @@ -51,6 +53,7 @@ class Profiler { // Public Methods static function init() { + Deprecation::notice('3.1', 'The Profiler class is deprecated, use third party tools like XHProf instead'); if(!self::$inst) self::$inst = new Profiler(true,true); } diff --git a/docs/en/changelogs/3.1.0.md b/docs/en/changelogs/3.1.0.md new file mode 100644 index 000000000..4046add99 --- /dev/null +++ b/docs/en/changelogs/3.1.0.md @@ -0,0 +1,9 @@ +# 3.1.0 (unreleased) + +## Overview ## + +## Upgrading + + * Deprecated `Profiler` class, use third-party solutions like [xhprof](https://github.com/facebook/xhprof/) + * Removed defunct or unnecessary debug GET parameters: + `debug_profile`, `debug_memory`, `profile_trace`, `debug_javascript`, `debug_behaviour` \ No newline at end of file diff --git a/docs/en/reference/urlvariabletools.md b/docs/en/reference/urlvariabletools.md index 7816cdfcf..8ff6bf29e 100644 --- a/docs/en/reference/urlvariabletools.md +++ b/docs/en/reference/urlvariabletools.md @@ -45,15 +45,6 @@ Append the option and corresponding value to your URL in your browser's address | showqueries | | 1 | | List all SQL queries executed | | previewwrite | | 1 | | List all insert / update SQL queries, and **don't** execute them. Useful for previewing writes to the database. | -## Profiling - - | URL Variable | | Values | | Description | - | ------------ | | ------ | | ----------- | - | debug_memory | | 1 | | Output the number of bytes of memory used for this - | debug_memory | | 1 | | Output the number of bytes of memory used for this request | - | debug_profile | | 1 | | Enable the [profiler](/topics/debugging) for the duration of the request | - | profile_trace | | 1 | | Includes full stack traces, must be used with **debug_profile** | - ## Security Redirects You can set an URL to redirect back to after a [Security](/topics/security) action. See the section on [URL diff --git a/main.php b/main.php index b81ef254f..edbea5c72 100644 --- a/main.php +++ b/main.php @@ -36,9 +36,6 @@ if (version_compare(phpversion(), '5.3.2', '<')) { * After that, it calls {@link Director::direct()}, which is responsible for doing most of the * real work. * - * Finally, main.php will use {@link Profiler} to show a profile if the querystring variable - * "debug_profile" is set. - * * CONFIGURING THE WEBSERVER * * To use SilverStripe, every request that doesn't point directly to a file should be rewritten to @@ -89,12 +86,6 @@ if (isset($_GET['url'])) { // Remove base folders from the URL if webroot is hosted in a subfolder if (substr(strtolower($url), 0, strlen(BASE_URL)) == strtolower(BASE_URL)) $url = substr($url, strlen(BASE_URL)); -if (isset($_GET['debug_profile'])) { - Profiler::init(); - Profiler::mark('all_execution'); - Profiler::mark('main.php init'); -} - // Connect to database require_once('model/DB.php'); @@ -114,20 +105,8 @@ if(!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseC die(); } -if (isset($_GET['debug_profile'])) Profiler::mark('DB::connect'); DB::connect($databaseConfig); -if (isset($_GET['debug_profile'])) Profiler::unmark('DB::connect'); - -if (isset($_GET['debug_profile'])) Profiler::unmark('main.php init'); - // Direct away - this is the "main" function, that hands control to the appropriate controller DataModel::set_inst(new DataModel()); -Director::direct($url, DataModel::inst()); - -if (isset($_GET['debug_profile'])) { - Profiler::unmark('all_execution'); - if(!Director::isLive()) { - Profiler::show(isset($_GET['profile_trace'])); - } -} +Director::direct($url, DataModel::inst()); \ No newline at end of file diff --git a/model/Database.php b/model/Database.php index 8d41b6a73..9d4af0bca 100644 --- a/model/Database.php +++ b/model/Database.php @@ -455,8 +455,6 @@ abstract class SS_Database { $fieldValue = null; $newTable = false; - Profiler::mark('requireField'); - // backwards compatibility patch for pre 2.4 requireField() calls $spec_orig=$spec; @@ -507,10 +505,7 @@ abstract class SS_Database { } if($newTable || $fieldValue=='') { - Profiler::mark('createField'); - $this->transCreateField($table, $field, $spec_orig); - Profiler::unmark('createField'); $this->alterationMessage("Field $table.$field: created as $spec_orig","created"); } else if($fieldValue != $specValue) { // If enums/sets are being modified, then we need to fix existing data in the table. @@ -545,12 +540,9 @@ abstract class SS_Database { } } } - Profiler::mark('alterField'); $this->transAlterField($table, $field, $spec_orig); - Profiler::unmark('alterField'); $this->alterationMessage("Field $table.$field: changed to $specValue (from {$fieldValue})","changed"); } - Profiler::unmark('requireField'); } /** diff --git a/view/Requirements.php b/view/Requirements.php index 426f12862..005ef1997 100644 --- a/view/Requirements.php +++ b/view/Requirements.php @@ -646,8 +646,6 @@ class Requirements_Backend { * @return string HTML content thats augumented with the requirements before the closing
tag. */ function includeInHTML($templateFile, $content) { - if(isset($_GET['debug_profile'])) Profiler::mark("Requirements::includeInHTML"); - if((strpos($content, '') !== false || strpos($content, 'css || $this->javascript || $this->customCSS || $this->customScript || $this->customHeadTags)) { $requirements = ''; $jsRequirements = ''; @@ -712,8 +710,6 @@ class Requirements_Backend { } } - if(isset($_GET['debug_profile'])) Profiler::unmark("Requirements::includeInHTML"); - return $content; } diff --git a/view/SSViewer.php b/view/SSViewer.php index 70215dbfc..c5896f924 100644 --- a/view/SSViewer.php +++ b/view/SSViewer.php @@ -810,22 +810,16 @@ class SSViewer { $template = $this->chosenTemplates[$key]; } - if(isset($_GET['debug_profile'])) Profiler::mark("SSViewer::process", " for $template"); $cacheFile = TEMP_FOLDER . "/.cache" . str_replace(array('\\','/',':'), '.', Director::makeRelative(realpath($template))); - $lastEdited = filemtime($template); if(!file_exists($cacheFile) || filemtime($cacheFile) < $lastEdited || isset($_GET['flush'])) { - if(isset($_GET['debug_profile'])) Profiler::mark("SSViewer::process - compile", " for $template"); - $content = file_get_contents($template); $content = SSViewer::parseTemplateContent($content, $template); $fh = fopen($cacheFile,'w'); fwrite($fh, $content); fclose($fh); - - if(isset($_GET['debug_profile'])) Profiler::unmark("SSViewer::process - compile", " for $template"); } $underlay = array('I18NNamespace' => basename($template)); @@ -846,8 +840,6 @@ class SSViewer { array_pop(SSViewer::$topLevel); - if(isset($_GET['debug_profile'])) Profiler::unmark("SSViewer::process", " for $template"); - // If we have our crazy base tag, then fix # links referencing the current page. if($this->rewriteHashlinks && self::$options['rewriteHashlinks']) { if(strpos($output, '