-$points = array();
-$queries = array();
-$sqltotal = 0.0;
-
-$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' ) {
- profile_point::$totaltime = $next->time();
- profile_point::$totalcount = $next->count();
- profile_point::$totalmemory = $next->memory();
- }
- if ( $last !== false ) {
- if ( preg_match( '/^'.preg_quote( $last->name(), '/' ).'/', $next->name() ) ) {
- $last->add_child($next);
- continue;
+ function getEscapedProfileUrl( $_filter = false, $_sort = false, $_expand = false ) {
+ global $filter, $sort, $expand;
+
+ if ( $_expand === false ) {
+ $_expand = $expand;
+ }
+
+ return htmlspecialchars(
+ '?' .
+ wfArrayToCgi( array(
+ 'filter' => $_filter ? $_filter : $filter,
+ 'sort' => $_sort ? $_sort : $sort,
+ 'expand' => implode( ',', array_keys( $_expand ) )
+ ) )
+ );
+ }
+
+ $points = array();
+ $queries = array();
+ $sqltotal = 0.0;
+
+ $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' ) {
+ profile_point::$totaltime = $next->time();
+ profile_point::$totalcount = $next->count();
+ profile_point::$totalmemory = $next->memory();
+ }
+ if ( $last !== false ) {
+ if ( preg_match( '/^' . preg_quote( $last->name(), '/' ) . '/', $next->name() ) ) {
+ $last->add_child( $next );
+ continue;
+ }
+ }
+ $last = $next;
+ if ( preg_match( '/^query: /', $next->name() ) || preg_match( '/^query-m: /', $next->name() ) ) {
+ $sqltotal += $next->time();
+ $queries[] = $next;
+ } else {
+ $points[] = $next;