From: Timo Tijhof Date: Fri, 10 Nov 2017 00:31:55 +0000 (-0800) Subject: Merge ProfilerFunctions into GlobalFunctions X-Git-Tag: 1.31.0-rc.0~1557^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22calendrier%22%2C%22type=semaine%22%29%20.%20%22?a=commitdiff_plain;h=fbfc69f5daa299173a6da2f832e2b3abb8f6eded;p=lhc%2Fweb%2Fwiklou.git Merge ProfilerFunctions into GlobalFunctions Even if people use these (deprecated) functions in the earliest hooks or in LocalSettings.php, it will keep working because GlobalFunctions is loaded between DefaultSettings.php and LocalSettings.php. The only places affected would be files in core: AutoLoader.php, Defines.php, and DefaultSettings.php, which don't use these functions. Change-Id: If4c0e8cbe1ea918283df22d72f792a3806569216 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 1cff881c21..404d115280 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3487,3 +3487,37 @@ function wfArrayPlus2d( array $baseArray, array $newValues ) { return $baseArray; } + +/** + * Get system resource usage of current request context. + * Invokes the getrusage(2) system call, requesting RUSAGE_SELF if on PHP5 + * or RUSAGE_THREAD if on HHVM. Returns false if getrusage is not available. + * + * @since 1.24 + * @return array|bool Resource usage data or false if no data available. + */ +function wfGetRusage() { + if ( !function_exists( 'getrusage' ) ) { + return false; + } elseif ( defined( 'HHVM_VERSION' ) && PHP_OS === 'Linux' ) { + return getrusage( 2 /* RUSAGE_THREAD */ ); + } else { + return getrusage( 0 /* RUSAGE_SELF */ ); + } +} + +/** + * Begin profiling of a function + * @param string $functionname Name of the function we will profile + * @deprecated since 1.25 + */ +function wfProfileIn( $functionname ) { +} + +/** + * Stop profiling of a function + * @param string $functionname Name of the function we have profiled + * @deprecated since 1.25 + */ +function wfProfileOut( $functionname = 'missing' ) { +} diff --git a/includes/Setup.php b/includes/Setup.php index e4396ba926..5d8520bfa5 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -37,9 +37,6 @@ if ( !defined( 'MEDIAWIKI' ) ) { * Pre-config setup: Before loading LocalSettings.php */ -// Grab profiling functions -require_once "$IP/includes/profiler/ProfilerFunctions.php"; - // Start the autoloader, so that extensions can derive classes from core files require_once "$IP/includes/AutoLoader.php"; diff --git a/includes/profiler/ProfilerFunctions.php b/includes/profiler/ProfilerFunctions.php deleted file mode 100644 index cc716300a0..0000000000 --- a/includes/profiler/ProfilerFunctions.php +++ /dev/null @@ -1,56 +0,0 @@ -getName(); global $IP; # Start the autoloader, so that extensions can derive classes from core files require_once "$IP/includes/AutoLoader.php"; -# Grab profiling functions -require_once "$IP/includes/profiler/ProfilerFunctions.php"; # Start the profiler $wgProfiler = [];