Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / profiler / ProfilerFunctions.php
blobcc716300a0e4056d875d0b1ed8bc2f28bcb20a79
1 <?php
2 /**
3 * Core profiling functions. Have to exist before basically anything.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @ingroup Profiler
24 /**
25 * Get system resource usage of current request context.
26 * Invokes the getrusage(2) system call, requesting RUSAGE_SELF if on PHP5
27 * or RUSAGE_THREAD if on HHVM. Returns false if getrusage is not available.
29 * @since 1.24
30 * @return array|bool Resource usage data or false if no data available.
32 function wfGetRusage() {
33 if ( !function_exists( 'getrusage' ) ) {
34 return false;
35 } elseif ( defined( 'HHVM_VERSION' ) && PHP_OS === 'Linux' ) {
36 return getrusage( 2 /* RUSAGE_THREAD */ );
37 } else {
38 return getrusage( 0 /* RUSAGE_SELF */ );
42 /**
43 * Begin profiling of a function
44 * @param string $functionname Name of the function we will profile
45 * @deprecated since 1.25
47 function wfProfileIn( $functionname ) {
50 /**
51 * Stop profiling of a function
52 * @param string $functionname Name of the function we have profiled
53 * @deprecated since 1.25
55 function wfProfileOut( $functionname = 'missing' ) {