status['Uptime']; $used_queries = $serverStatusData->used_queries; $total_queries = array_sum($used_queries); $retval .= '

'; /* l10n: Questions is the name of a MySQL Status variable */ $retval .= sprintf( __('Questions since startup: %s'), Util::formatNumber($total_queries, 0) ); $retval .= ' '; $retval .= Util::showMySQLDocu( 'server-status-variables', false, 'statvar_Questions' ); $retval .= '
'; $retval .= ''; $retval .= 'ø ' . __('per hour:') . ' '; $retval .= Util::formatNumber($total_queries * $hour_factor, 0); $retval .= '
'; $retval .= 'ø ' . __('per minute:') . ' '; $retval .= Util::formatNumber( $total_queries * 60 / $serverStatusData->status['Uptime'], 0 ); $retval .= '
'; if ($total_queries / $serverStatusData->status['Uptime'] >= 1) { $retval .= 'ø ' . __('per second:') . ' '; $retval .= Util::formatNumber( $total_queries / $serverStatusData->status['Uptime'], 0 ); } $retval .= '
'; $retval .= '

'; $retval .= self::getHtmlForDetails($serverStatusData); return $retval; } /** * Returns the html content for the query details * * @param Data $serverStatusData Server status data * * @return string */ public static function getHtmlForDetails(Data $serverStatusData) { $hour_factor = 3600 / $serverStatusData->status['Uptime']; $used_queries = $serverStatusData->used_queries; $total_queries = array_sum($used_queries); // reverse sort by value to show most used statements first arsort($used_queries); //(- $serverStatusData->status['Connections']); $perc_factor = 100 / $total_queries; $retval = ''; $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; $chart_json = array(); $query_sum = array_sum($used_queries); $other_sum = 0; foreach ($used_queries as $name => $value) { // For the percentage column, use Questions - Connections, because // the number of connections is not an item of the Query types // but is included in Questions. Then the total of the percentages is 100. $name = str_replace(array('Com_', '_'), array('', ' '), $name); // Group together values that make out less than 2% into "Other", but only // if we have more than 6 fractions already if ($value < $query_sum * 0.02 && count($chart_json)>6) { $other_sum += $value; } else { $chart_json[$name] = $value; } $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; $retval .= ''; } $retval .= ''; $retval .= '
' . __('Statements') . ''; /* l10n: # = Amount of queries */ $retval .= __('#'); $retval .= 'ø ' . __('per hour') . '%
' . htmlspecialchars($name) . ''; $retval .= htmlspecialchars( Util::formatNumber($value, 5, 0, true) ); $retval .= ''; $retval .= htmlspecialchars( Util::formatNumber($value * $hour_factor, 4, 1, true) ); $retval .= ''; $retval .= htmlspecialchars( Util::formatNumber($value * $perc_factor, 0, 2) ); $retval .= '
'; $retval .= '
'; return $retval; } }