Typo in comment of Html::radio()
[lhc/web/wiklou.git] / profileinfo.php
index 762af69..f44ee5a 100644 (file)
@@ -27,7 +27,7 @@
 
 ini_set( 'zlib.output_compression', 'off' );
 
-$wgEnableProfileInfo = $wgProfileToDatabase = false;
+$wgEnableProfileInfo = false;
 require __DIR__ . '/includes/WebStart.php';
 
 header( 'Content-Type: text/html; charset=utf-8' );
@@ -36,7 +36,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
 <!DOCTYPE html>
 <html>
 <head>
-       <meta charset="UTF-8">
+       <meta charset="UTF-8" />
        <title>Profiling data</title>
        <style>
                /* noc.wikimedia.org/base.css */
@@ -149,8 +149,8 @@ $dbr = wfGetDB( DB_SLAVE );
 
 if ( !$dbr->tableExists( 'profiling' ) ) {
        echo '<p>No <code>profiling</code> table exists, so we can\'t show you anything.</p>'
-               . '<p>If you want to log profiling data, enable <code>$wgProfileToDatabase</code>'
-               . ' in your LocalSettings.php and run <code>maintenance/update.php</code> to'
+               . '<p>If you want to log profiling data, enable <code>$wgProfiler[\'output\'] = \'db\'</code>'
+               . ' in your StartProfiler.php and run <code>maintenance/update.php</code> to'
                . ' create the profiling table.'
                . '</body></html>';
        exit( 1 );
@@ -320,7 +320,13 @@ if ( isset( $_REQUEST['sort'] ) && in_array( $_REQUEST['sort'], $sorts ) ) {
        $sort = $_REQUEST['sort'];
 }
 
-$res = $dbr->select( 'profiling', '*', array(), 'profileinfo.php', array( 'ORDER BY' => 'pf_name ASC' ) );
+$res = $dbr->select(
+       'profiling',
+       '*',
+       array(),
+       'profileinfo.php',
+       array( 'ORDER BY' => 'pf_name ASC' )
+);
 
 if ( isset( $_REQUEST['filter'] ) ) {
        $filter = $_REQUEST['filter'];
@@ -333,7 +339,9 @@ if ( isset( $_REQUEST['filter'] ) ) {
        <p>
                <input type="text" name="filter" value="<?php echo htmlspecialchars( $filter ); ?>">
                <input type="hidden" name="sort" value="<?php echo htmlspecialchars( $sort ); ?>">
-               <input type="hidden" name="expand" value="<?php echo htmlspecialchars( implode( ",", array_keys( $expand ) ) ); ?>">
+               <input type="hidden" name="expand" value="<?php
+                       echo htmlspecialchars( implode( ",", array_keys( $expand ) ) );
+               ?>">
                <input type="submit" value="Filter">
        </p>
 </form>
@@ -341,15 +349,33 @@ if ( isset( $_REQUEST['filter'] ) ) {
 <table class="mw-profileinfo-table table table-striped table-hover">
        <thead>
        <tr>
-               <th><a href="<?php echo getEscapedProfileUrl( false, 'name' ); ?>">Name</a></th>
-               <th><a href="<?php echo getEscapedProfileUrl( false, 'time' ); ?>">Time (%)</a></th>
-               <th><a href="<?php echo getEscapedProfileUrl( false, 'memory' ); ?>">Memory (%)</a></th>
-               <th><a href="<?php echo getEscapedProfileUrl( false, 'count' ); ?>">Count</a></th>
-               <th><a href="<?php echo getEscapedProfileUrl( false, 'calls_per_req' ); ?>">Calls/req</a></th>
-               <th><a href="<?php echo getEscapedProfileUrl( false, 'time_per_call' ); ?>">ms/call</a></th>
-               <th><a href="<?php echo getEscapedProfileUrl( false, 'memory_per_call' ); ?>">kb/call</a></th>
-               <th><a href="<?php echo getEscapedProfileUrl( false, 'time_per_req' ); ?>">ms/req</a></th>
-               <th><a href="<?php echo getEscapedProfileUrl( false, 'memory_per_req' ); ?>">kb/req</a></th>
+               <th><a href="<?php
+                       echo getEscapedProfileUrl( false, 'name' );
+               ?>">Name</a></th>
+               <th><a href="<?php
+                       echo getEscapedProfileUrl( false, 'time' );
+               ?>">Time (%)</a></th>
+               <th><a href="<?php
+                       echo getEscapedProfileUrl( false, 'memory' );
+               ?>">Memory (%)</a></th>
+               <th><a href="<?php
+                       echo getEscapedProfileUrl( false, 'count' );
+               ?>">Count</a></th>
+               <th><a href="<?php
+                       echo getEscapedProfileUrl( false, 'calls_per_req' );
+               ?>">Calls/req</a></th>
+               <th><a href="<?php
+                       echo getEscapedProfileUrl( false, 'time_per_call' );
+               ?>">ms/call</a></th>
+               <th><a href="<?php
+                       echo getEscapedProfileUrl( false, 'memory_per_call' );
+               ?>">kb/call</a></th>
+               <th><a href="<?php
+                       echo getEscapedProfileUrl( false, 'time_per_req' );
+               ?>">ms/req</a></th>
+               <th><a href="<?php
+                       echo getEscapedProfileUrl( false, 'memory_per_req' );
+               ?>">kb/req</a></th>
        </tr>
        </thead>
        <tbody>
@@ -384,7 +410,7 @@ if ( isset( $_REQUEST['filter'] ) ) {
        $last = false;
        foreach ( $res as $o ) {
                $next = new profile_point( $o->pf_name, $o->pf_count, $o->pf_time, $o->pf_memory );
-               if ( $next->name() == '-total' ) {
+               if ( $next->name() == '-total' || $next->name() == 'main()' ) {
                        profile_point::$totaltime = $next->time();
                        profile_point::$totalcount = $next->count();
                        profile_point::$totalmemory = $next->memory();
@@ -422,7 +448,7 @@ if ( isset( $_REQUEST['filter'] ) ) {
        ?>
        </tbody>
 </table>
-<hr>
+<hr />
 <p>Total time: <code><?php printf( '%5.02f', profile_point::$totaltime ); ?></code></p>
 
 <p>Total memory: <code><?php printf( '%5.02f', profile_point::$totalmemory / 1024 ); ?></code></p>