X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=profileinfo.php;h=2329f6a41eb08cddb3f3661ccf7b7204938a0920;hb=b3fea2070b1566658c439d511f7fe79ed99c8ef9;hp=032df3f20f7f1cc92897b43b7e3dd1d685920aee;hpb=d59abb95f76cb59ba747adb2ff2bd9fd348245d9;p=lhc%2Fweb%2Fwiklou.git
diff --git a/profileinfo.php b/profileinfo.php
index 032df3f20f..2329f6a41e 100644
--- a/profileinfo.php
+++ b/profileinfo.php
@@ -1,27 +1,37 @@
-
+
Profiling data
@@ -56,28 +66,15 @@
Disabled\n";
+ echo "";
exit( 1 );
}
-foreach (array("wgDBadminuser", "wgDBadminpassword", "wgDBserver", "wgDBname") as $var)
- if ($$var === false) {
- echo "AdminSettings.php not correct\n";
- exit( 1 );
- }
-
-
$expand = array();
-if (isset($_REQUEST['expand']))
- foreach(explode(",", $_REQUEST['expand']) as $f)
+if ( isset( $_REQUEST['expand'] ) )
+ foreach( explode( ',', $_REQUEST['expand'] ) as $f )
$expand[$f] = true;
class profile_point {
@@ -86,7 +83,7 @@ class profile_point {
var $time;
var $children;
- function profile_point($name, $count, $time, $memory ) {
+ function __construct( $name, $count, $time, $memory ) {
$this->name = $name;
$this->count = $count;
$this->time = $time;
@@ -94,35 +91,35 @@ class profile_point {
$this->children = array();
}
- function add_child($child) {
+ function add_child( $child ) {
$this->children[] = $child;
}
function display($indent = 0.0) {
global $expand, $totaltime, $totalmemory, $totalcount;
- usort($this->children, "compare_point");
+ usort( $this->children, 'compare_point' );
$extet = '';
- if (isset($expand[$this->name()]))
+ if ( isset( $expand[$this->name()] ) )
$ex = true;
else $ex = false;
- if (!$ex) {
- if (count($this->children)) {
- $url = makeurl(false, false, $expand + array($this->name() => true));
+ if ( !$ex ) {
+ if ( count( $this->children ) ) {
+ $url = getEscapedProfileUrl( false, false, $expand + array( $this->name() => true ) );
$extet = " [+]";
} else $extet = '';
} else {
$e = array();
- foreach ($expand as $name => $ep)
- if ($name != $this->name())
- $e += array($name => $ep);
+ foreach ( $expand as $name => $ep )
+ if ( $name != $this->name() )
+ $e += array( $name => $ep );
- $extet = " [–]";
+ $extet = " [â]";
}
?>
- name()) . $extet ?>
+ name() ) . $extet ?>
|
time() / $totaltime * 100 ) ?> |
memory() / $totalmemory * 100 ) ?> |
@@ -134,9 +131,9 @@ class profile_point {
memory() / $totalcount / 1024 ), 2 ) ?> |
children as $child) {
- $child->display($indent + 2);
+ if ( $ex ) {
+ foreach ( $this->children as $child ) {
+ $child->display( $indent + 2 );
}
}
}
@@ -158,38 +155,38 @@ class profile_point {
}
function timePerCall() {
- return @($this->time / $this->count);
+ return @( $this->time / $this->count );
}
function memoryPerCall() {
- return @($this->memory / $this->count);
+ return @( $this->memory / $this->count );
}
function callsPerRequest() {
global $totalcount;
- return @($this->count / $totalcount);
+ return @( $this->count / $totalcount );
}
function timePerRequest() {
global $totalcount;
- return @($this->time / $totalcount);
+ return @( $this->time / $totalcount );
}
function memoryPerRequest() {
global $totalcount;
- return @($this->memory / $totalcount);
+ return @( $this->memory / $totalcount );
}
function fmttime() {
- return sprintf("%5.02f", $this->time);
+ return sprintf( "%5.02f", $this->time );
}
};
-function compare_point($a, $b) {
+function compare_point( $a, $b ) {
global $sort;
- switch ($sort) {
+ switch ( $sort ) {
case "name":
- return strcmp($a->name(), $b->name());
+ return strcmp( $a->name(), $b->name() );
case "time":
return $a->time() > $b->time() ? -1 : 1;
case "memory":
@@ -209,26 +206,23 @@ function compare_point($a, $b) {
}
}
-$sorts = array("time","memory","count","calls_per_req","name","time_per_call","memory_per_call","time_per_req","memory_per_req");
+$sorts = array( 'time', 'memory', 'count', 'calls_per_req', 'name',
+ 'time_per_call', 'memory_per_call', 'time_per_req', 'memory_per_req' );
$sort = 'time';
-if (isset($_REQUEST['sort']) && in_array($_REQUEST['sort'], $sorts))
+if ( isset( $_REQUEST['sort'] ) && in_array( $_REQUEST['sort'], $sorts ) )
$sort = $_REQUEST['sort'];
-$dbh = mysql_connect($wgDBserver, $wgDBadminuser, $wgDBadminpassword)
- or die("mysql server failed: " . mysql_error());
-mysql_select_db($wgDBname, $dbh) or die(mysql_error($dbh));
-$res = mysql_query("
- SELECT pf_count, pf_time, pf_memory, pf_name
- FROM {$wgDBprefix}profiling
- ORDER BY pf_name ASC
-", $dbh) or die("query failed: " . mysql_error());
-if (isset($_REQUEST['filter']))
+$dbr = wfGetDB( DB_SLAVE );
+$res = $dbr->select( 'profiling', '*', array(), 'profileinfo.php', array( 'ORDER BY' => 'pf_name ASC' ) );
+
+if (isset( $_REQUEST['filter'] ) )
$filter = $_REQUEST['filter'];
-else $filter = '';
+else
+ $filter = '';
?>
-