summaryrefslogtreecommitdiff
path: root/includes/ProfilerSimple.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/ProfilerSimple.php')
-rw-r--r--includes/ProfilerSimple.php19
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 */