Is there a way to see the current request response time in a browser?

Is there a way to see the current mysql query and its response time in the browser? I am working on simple php, but not with any structure. Does anyone know any add-ons for FF that give me this information.

Please, help

thank

+3
source share
6 answers

I am using the MySQL server profiling function (from 5.0.37).

<?php

// profiling init
$set_profiling = $mysqli->query( 'SET profiling = 1' );

// some stuff
$result1 = $mysqli->query( 'SELECT DESTINATIONCODE, ZONENAME FROM ZONES' );
$result2 = $mysqli->query( 'SELECT ZONENAME FROM ZONES' );


// showing profiling printout
$show_profiles = $mysqli->query( 'SHOW PROFILES' );
while( $row = $show_profiles->fetch_assoc() ) {
    echo '<pre>';   
    print_r( $row );    
    echo '</pre>'
}

In addition, if you want to get a more detailed report after each request that you can use:

$show_profile = $mysqli->query( 'SHOW PROFILE' );

Check http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html .

This is a bit raw visualization, but it works.

Output Example:

Array
(
    [Query_ID] => 1
    [Duration] => 0.00012000
    [Query] => SELECT DESTINATIONCODE, ZONENAME FROM ZONES
)
Array
(
    [Query_ID] => 2
    [Duration] => 0.00006800
    [Query] => SELECT ZONENAME FROM ZONES
)

# 1:

Array
(
    [Status] => (initialization)
    [Duration] => 0.000002
)
Array
(
    [Status] => checking query cache for query
    [Duration] => 0.000003
)
Array
(
    [Status] => checking privileges on cached 
    [Duration] => 0.000002
)
Array
(
    [Status] => checking permissions
    [Duration] => 0.000001
)
Array
(
    [Status] => sending cached result to clien
    [Duration] => 0.000056
)
Array
(
    [Status] => logging slow query
    [Duration] => 0.000001
)
+4
+1

php, - ( float)

function time_in_float() {
    $time = microtime();
    $time = explode(" ",$time);
    $time = $time[1] + $time[0];
    return $time;
}
$startTime = time_in_float();

$query = "SELECT SOME QUERY";
mysql_query($query);

$endTime = time_in_float();

$queryTime = ($endTime - $startTime);
echo $queryTime . ' micro seconds';
+1

Firefox mysql-, . ( , , , - ).

(, AJAX ), , ( firebug ), PHP script.

, PHP ( microtime() ), - .

0
source

add these lines to my.ini [cut paste from my WAMP]

[mysqld]
port=3306
# Set Slow Query Log
long_query_time = 1
slow_query_log = 1
slow_query_log_file = "E:/wamp/logs/slowquery.log"
#Set General Log
log = "E:/wamp/logs/genquery.log"
0
source

You can add new add-ons (YSlow) for Firefox. I do not know about other browsers.

Thank.

-1
source

All Articles