diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2006-10-11 20:21:25 +0000 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2006-10-11 20:21:25 +0000 |
commit | d81f562b712f2387fa02290bf2ca86392ab356f2 (patch) | |
tree | d666cdefbe6ac320827a2c6cb473581b46e22c4c /includes/ProfilerSimple.php | |
parent | 183851b06bd6c52f3cae5375f433da720d410447 (diff) |
Aktualisierung auf Version 1.8.1
Diffstat (limited to 'includes/ProfilerSimple.php')
-rw-r--r-- | includes/ProfilerSimple.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/includes/ProfilerSimple.php b/includes/ProfilerSimple.php index ed058c65..d5bdaf94 100644 --- a/includes/ProfilerSimple.php +++ b/includes/ProfilerSimple.php @@ -8,9 +8,11 @@ * @todo document * @package MediaWiki */ -require_once(dirname(__FILE__).'/Profiling.php'); +require_once(dirname(__FILE__).'/Profiler.php'); class ProfilerSimple extends Profiler { + var $mMinimumTime = 0; + function ProfilerSimple() { global $wgRequestTime,$wgRUstart; if (!empty($wgRequestTime) && !empty($wgRUstart)) { @@ -33,6 +35,10 @@ class ProfilerSimple extends Profiler { } } + function setMinimum( $min ) { + $this->mMinimumTime = $min; + } + function profileIn($functionname) { global $wgDebugFunctionEntry; if ($wgDebugFunctionEntry) { @@ -86,9 +92,14 @@ class ProfilerSimple extends Profiler { } function getCpuTime($ru=null) { - if ($ru==null) - $ru=getrusage(); - return ($ru['ru_utime.tv_sec']+$ru['ru_stime.tv_sec']+($ru['ru_utime.tv_usec']+$ru['ru_stime.tv_usec'])*1e-6); + if ( function_exists( 'getrusage' ) ) { + if ( $ru == null ) + $ru = getrusage(); + return ($ru['ru_utime.tv_sec'] + $ru['ru_stime.tv_sec'] + ($ru['ru_utime.tv_usec'] + + $ru['ru_stime.tv_usec']) * 1e-6); + } else { + return 0; + } } /* If argument is passed, it assumes that it is dual-format time string, returns proper float time value */ |