diff --git a/cache/classes/loaders.php b/cache/classes/loaders.php index a8ebef37503..f0a12df383b 100644 --- a/cache/classes/loaders.php +++ b/cache/classes/loaders.php @@ -1703,7 +1703,7 @@ class cache_application extends cache implements cache_loader_with_locking { $after = microtime(true); if ($lock) { $this->locks[$key] = $lock; - if ((defined('MDL_PERF') && MDL_PERF) || $this->perfdebug) { + if (MDL_PERF || $this->perfdebug) { \core\lock\timing_wrapper_lock_factory::record_lock_data($after, $before, $this->get_definition()->get_id(), $key, $lock, $this->get_identifier() . $key); } @@ -1748,7 +1748,7 @@ class cache_application extends cache implements cache_loader_with_locking { } if ($released && array_key_exists($key, $this->locks)) { unset($this->locks[$key]); - if ((defined('MDL_PERF') && MDL_PERF) || $this->perfdebug) { + if (MDL_PERF || $this->perfdebug) { \core\lock\timing_wrapper_lock_factory::record_lock_released_data($this->get_identifier() . $key); } } diff --git a/config-dist.php b/config-dist.php index 2cee359e9f1..4f7447efe0a 100644 --- a/config-dist.php +++ b/config-dist.php @@ -422,9 +422,6 @@ $CFG->admin = 'admin'; // Capture performance profiling data // define('MDL_PERF' , true); // -// Capture additional data from DB -// define('MDL_PERFDB' , true); -// // Print to log (for passive profiling of production servers) // define('MDL_PERFTOLOG' , true); // diff --git a/install.php b/install.php index 82c5e350b86..76a2b568a1c 100644 --- a/install.php +++ b/install.php @@ -49,6 +49,10 @@ define('CACHE_DISABLE_ALL', true); // Disables caching.. just in case. define('PHPUNIT_TEST', false); define('IGNORE_COMPONENT_CACHE', true); define('MDL_PERF_TEST', false); +define('MDL_PERF', false); +define('MDL_PERFTOFOOT', false); +define('MDL_PERFTOLOG', false); +define('MDL_PERFINC', false); // Servers should define a default timezone in php.ini, but if they don't then make sure something is defined. if (!function_exists('date_default_timezone_set') or !function_exists('date_default_timezone_get')) { diff --git a/lib/classes/lock/lock_config.php b/lib/classes/lock/lock_config.php index 30178089009..d51d2a4f74e 100644 --- a/lib/classes/lock/lock_config.php +++ b/lib/classes/lock/lock_config.php @@ -93,7 +93,7 @@ class lock_config { } // If tracking performance, insert a timing wrapper to keep track of lock delays. - if ((defined('MDL_PERF') && MDL_PERF) || (!empty($CFG->perfdebug) && $CFG->perfdebug > 7)) { + if (MDL_PERF || (!empty($CFG->perfdebug) && $CFG->perfdebug > 7)) { $wrapper = new timing_wrapper_lock_factory($type, $lockfactory); $lockfactory = $wrapper; } diff --git a/lib/classes/shutdown_manager.php b/lib/classes/shutdown_manager.php index 5f0aec5dcf6..c610f637701 100644 --- a/lib/classes/shutdown_manager.php +++ b/lib/classes/shutdown_manager.php @@ -208,15 +208,15 @@ class core_shutdown_manager { } // Deal with perf logging. - if ((defined('MDL_PERF') && MDL_PERF) || (!empty($CFG->perfdebug) && $CFG->perfdebug > 7)) { + if (MDL_PERF || (!empty($CFG->perfdebug) && $CFG->perfdebug > 7)) { if ($apachereleasemem) { error_log('Mem usage over '.$apachereleasemem.': marking Apache child for reaping.'); } - if (defined('MDL_PERFTOLOG') && MDL_PERFTOLOG) { + if (MDL_PERFTOLOG) { $perf = get_performance_info(); error_log("PERF: " . $perf['txt']); } - if (defined('MDL_PERFINC') && MDL_PERFINC) { + if (MDL_PERFINC) { $inc = get_included_files(); $ts = 0; foreach ($inc as $f) { @@ -224,9 +224,9 @@ class core_shutdown_manager { $fs = filesize($f); $ts += $fs; $hfs = display_size($fs); - error_log(substr($f, strlen($CFG->dirroot)) . " size: $fs ($hfs)", null, null, 0); + error_log(substr($f, strlen($CFG->dirroot)) . " size: $fs ($hfs)"); } else { - error_log($f , null, null, 0); + error_log($f); } } if ($ts > 0 ) { diff --git a/lib/classes/task/logging_trait.php b/lib/classes/task/logging_trait.php index 8701c2a5ae2..ef22ba9ba28 100644 --- a/lib/classes/task/logging_trait.php +++ b/lib/classes/task/logging_trait.php @@ -79,7 +79,7 @@ trait logging_trait { protected function log_start($message, $depth = 0) { $this->log($message, $depth); - if (defined('MDL_PERFTOLOG') && MDL_PERFTOLOG) { + if (MDL_PERFTOLOG) { $this->tracestats->$depth = [ 'mem' => memory_get_usage(), 'time' => microtime(), diff --git a/lib/classes/task/logmanager.php b/lib/classes/task/logmanager.php index 819ec44a588..b0efd994e91 100644 --- a/lib/classes/task/logmanager.php +++ b/lib/classes/task/logmanager.php @@ -301,7 +301,7 @@ class logmanager { self::$logpath, $failed, $DB->perf_get_reads() - self::$taskloginfo->dbread, - $DB->perf_get_writes() - self::$taskloginfo->dbwrite - $PERF->logwrites, + $DB->perf_get_writes() - self::$taskloginfo->dbwrite, self::$taskloginfo->timestart, microtime(true) ); diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 44300f978a2..c4648935b95 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -9642,13 +9642,7 @@ function get_performance_info() { } } - if (!empty($PERF->logwrites)) { - $info['logwrites'] = $PERF->logwrites; - $info['html'] .= '