Small adjustments and linux cpu usage fixed

This commit is contained in:
Tyron Madlener 2011-07-04 11:33:11 +02:00
parent 89d7c85087
commit cdffaf3115
5 changed files with 19 additions and 8 deletions

View File

@ -1508,7 +1508,7 @@ function PMA_createChart(passedSettings) {
if(server_time_diff) {
settings.xAxis.min = new Date().getTime() - server_time_diff - passedSettings.realtime.numMaxPoints * passedSettings.realtime.refreshRate;
settings.xAxis.max = new Date().getTime() - server_time_diff;
settings.xAxis.max = new Date().getTime() - server_time_diff + passedSettings.realtime.refreshRate;
}
}

View File

@ -101,6 +101,9 @@ $(function() {
tabStatus[$(this).attr('id')] = 'static';
});
// Display button links
$('div.buttonlinks').show();
// Handles refresh rate changing
$('.buttonlinks select').change(function() {
var chart=tabChart[$(this).parents('div.ui-tabs-panel').attr('id')];
@ -330,7 +333,7 @@ $(function() {
// Build query statistics chart
var cdata = new Array();
$.each(jQuery.parseJSON($('#serverstatusquerieschart').html()),function(key,value) {
$.each(jQuery.parseJSON($('#serverstatusquerieschart span').html()),function(key,value) {
cdata.push([key,parseInt(value)]);
});
@ -703,7 +706,7 @@ $(function() {
{ dataType: 'cpu',
name: 'none',
transformFn: function(cur, prev) {
if(prev==null) return undefined;
if(prev == null) return undefined;
var diff_total = cur.busy + cur.idle - (prev.busy + prev.idle);
var diff_idle = cur.idle - prev.idle;
return 100*(diff_total - diff_idle) / diff_total;
@ -883,12 +886,13 @@ $(function() {
if(elem.nodes[j].valueDivisor)
value = value / elem.nodes[j].valueDivisor;
if(elem.nodes[j].transformFn)
if(elem.nodes[j].transformFn) {
value = elem.nodes[j].transformFn(
chartData[key][j],
(oldChartData == null) ? null : oldChartData[key][j],
j
);
}
if(value != undefined)
elem.chart.series[j].addPoint(

View File

@ -95,7 +95,7 @@ class Linux {
function loadavg() {
$buf = file_get_contents('/proc/stat');
$nums=preg_split("/\s+/", substr($buf,0,strpos($buf,"\n")));
return Array('busy' => $nums[1]+$nums[2]+$nums[3], 'idle' => $nums[4]);
return Array('busy' => $nums[1]+$nums[2]+$nums[3], 'idle' => intval($nums[4]));
}
function memory() {
@ -105,6 +105,9 @@ class Linux {
$mem['MemUsed'] = $mem['MemTotal'] - $mem['MemFree'] - $mem['Cached'] - $mem['Buffers'];
$mem['SwapUsed'] = $mem['SwapTotal'] - $mem['SwapFree'] - $mem['SwapCached'];
foreach($mem as $idx=>$value)
$mem[$idx] = intval($value);
return $mem;
}
}

View File

@ -642,16 +642,16 @@ function printQueryStatistics() {
<br>
<span>
<?php
echo '&oslash;'.__('per hour').':';
echo '&oslash; '.__('per hour').':';
echo PMA_formatNumber($total_queries * $hour_factor, 0);
echo '<br>';
echo '&oslash;'.__('per minute').':';
echo '&oslash; '.__('per minute').':';
echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0);
echo '<br>';
if($total_queries / $server_status['Uptime'] >= 1) {
echo '&oslash;'.__('per second').':';
echo '&oslash; '.__('per second').':';
echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0);
}
?>
@ -715,12 +715,14 @@ function printQueryStatistics() {
</table>
<div id="serverstatusquerieschart">
<span style="display:none;">
<?php
if($other_sum > 0)
$chart_json[__('Other')] = $other_sum;
echo json_encode($chart_json);
?>
</span>
</div>
<?php
}
@ -971,6 +973,7 @@ function printVariablesTable() {
* Messages are built using the message name
*/
$strShowStatus = array(
'Aborted_clients' => __('The number of connections that were aborted because the client died without closing the connection properly.'),
'Aborted_connects' => __('The number of failed attempts to connect to the MySQL server.'),
'Binlog_cache_disk_use' => __('The number of transactions that used the temporary binary log cache but that exceeded the value of binlog_cache_size and used a temporary file to store statements from the transaction.'),
'Binlog_cache_use' => __('The number of transactions that used the temporary binary log cache.'),

View File

@ -1185,6 +1185,7 @@ table#serverstatusqueriesdetails th.headerSortDown img.sortableIcon, table#serve
.buttonlinks {
float: <?php echo $right; ?>;
white-space: nowrap;
display: none; /* Made visible with js */
}
/* Also used for the variables page */