Implemented stacking close queries
This commit is contained in:
1 parent
e2a176f8ef
commit
3031ca5ca0
1 file changed
+25
-1
+25
-1
@@ -164,6 +164,7 @@ class Laps {
|
||||
jQuery(".laps-timeline .event").lapstooltip({
|
||||
container: '#wpadminbar'
|
||||
, placement: 'bottom'
|
||||
, html: true
|
||||
// , trigger: 'click'
|
||||
});
|
||||
});
|
||||
@@ -205,6 +206,8 @@ class Laps {
|
||||
|
||||
$query_data = array();
|
||||
$last_query_end = 0;
|
||||
$last_offset = 0;
|
||||
$last_duration = 0;
|
||||
$category = 'query';
|
||||
|
||||
if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
|
||||
@@ -215,7 +218,28 @@ class Laps {
|
||||
$duration *= 1000;
|
||||
$last_query_end = $query_start + $duration;
|
||||
$offset = round( ( $query_start - $start ) / $total * 100, 2 );
|
||||
$width = round( $duration / $total * 100, 2 );
|
||||
|
||||
// if query is indistinguishably close to previous then stack it
|
||||
if ( $offset == $last_offset ) {
|
||||
$key = count( $query_data ) - 1;
|
||||
$query_data[$key]['sql'] .= '<br />' . $sql;
|
||||
$last_duration += $duration;
|
||||
$width = round( $last_duration / $total * 100, 2 );
|
||||
|
||||
if ( 0 == $width ) {
|
||||
$width = '2px';
|
||||
} else {
|
||||
$width .= '%';
|
||||
}
|
||||
|
||||
$query_data[$key]['width'] = $width;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$width = round( $duration / $total * 100, 2 );
|
||||
$last_offset = $offset;
|
||||
$last_duration = $duration;
|
||||
|
||||
if ( 0 == $width ) {
|
||||
$width = '2px';
|
||||
|
||||
Reference in new issue
Block a user