194 lines
12 KiB
PHP
194 lines
12 KiB
PHP
<?php
|
|
/* $Id$ */
|
|
// vim: expandtab sw=4 ts=4 sts=4:
|
|
|
|
class PMA_StorageEngine_innodb extends PMA_StorageEngine {
|
|
function getVariables() {
|
|
return array(
|
|
'innodb_data_home_dir' => array(
|
|
'title' => $GLOBALS['strInnoDBDataHomeDir'],
|
|
'desc' => $GLOBALS['strInnoDBDataHomeDirDesc']
|
|
),
|
|
'innodb_data_file_path' => array(
|
|
'title' => $GLOBALS['strInnoDBDataFilePath']
|
|
),
|
|
'innodb_autoextend_increment' => array(
|
|
'title' => $GLOBALS['strInnoDBAutoextendIncrement'],
|
|
'desc' => $GLOBALS['strInnoDBAutoextendIncrementDesc'],
|
|
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
|
|
),
|
|
'innodb_buffer_pool_size' => array(
|
|
'title' => $GLOBALS['strInnoDBBufferPoolSize'],
|
|
'desc' => $GLOBALS['strInnoDBBufferPoolSizeDesc'],
|
|
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
|
|
)
|
|
);
|
|
}
|
|
|
|
function getVariablesLikePattern () {
|
|
return 'innodb\\_%';
|
|
}
|
|
|
|
function getInfoPages () {
|
|
if ($this->support < PMA_ENGINE_SUPPORT_YES) {
|
|
return array();
|
|
}
|
|
$pages = array();
|
|
if (PMA_MYSQL_INT_VERSION >= 50002) {
|
|
$pages['bufferpool'] = $GLOBALS['strBufferPool'];
|
|
}
|
|
$pages['status'] = $GLOBALS['strInnodbStat'];
|
|
return $pages;
|
|
}
|
|
|
|
function getPage($id) {
|
|
global $cfg;
|
|
|
|
switch ($id) {
|
|
case 'bufferpool':
|
|
if (PMA_MYSQL_INT_VERSION < 50002) {
|
|
return FALSE;
|
|
}
|
|
// rabus: The following query is only possible because we know
|
|
// that we are on MySQL 5 here (checked above)!
|
|
// side note: I love MySQL 5 for this. :-)
|
|
$res = PMA_DBI_query('SHOW STATUS WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' OR Variable_name = \'Innodb_page_size\';');
|
|
$status = array();
|
|
while ($row = PMA_DBI_fetch_row($res)) {
|
|
$status[$row[0]] = $row[1];
|
|
}
|
|
PMA_DBI_free_result($res);
|
|
unset($res, $row);
|
|
$output = '<table>' . "\n"
|
|
. ' <thead>' . "\n"
|
|
. ' <tr>' . "\n"
|
|
. ' <th colspan="4">' . "\n"
|
|
. ' ' . $GLOBALS['strBufferPoolUsage'] . "\n"
|
|
. ' </th>' . "\n"
|
|
. ' </tr>' . "\n"
|
|
. ' </thead>' . "\n"
|
|
. ' <tfoot>' . "\n"
|
|
. ' <tr>' . "\n"
|
|
. ' <th>' . "\n"
|
|
. ' ' . $GLOBALS['strTotalUC'] . "\n"
|
|
. ' </th>' . "\n"
|
|
. ' <th colspan="3">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_total']) . ' ' . $GLOBALS['strInnoDBPages'] . ' / ' . join(' ', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
|
|
. ' </th>' . "\n"
|
|
. ' </tr>' . "\n"
|
|
. ' </tfoot>' . "\n"
|
|
. ' <tbody>' . "\n"
|
|
. ' <tr>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strFreePages'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_free']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strDirtyPages'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_dirty']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' </tr>' . "\n"
|
|
. ' <tr>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strDataPages'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_data']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strPagesToBeFlushed'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_flushed']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' </tr>' . "\n"
|
|
. ' <tr>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strBusyPages'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_misc']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strLatchedPages'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_latched']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' </tr>' . "\n"
|
|
. ' </tbody>' . "\n"
|
|
. '</table>' . "\n\n"
|
|
. '<br />' . "\n\n"
|
|
. '<table>' . "\n"
|
|
. ' <thead>' . "\n"
|
|
. ' <tr>' . "\n"
|
|
. ' <th colspan="4">' . "\n"
|
|
. ' ' . $GLOBALS['strBufferPoolActivity'] . "\n"
|
|
. ' </th>' . "\n"
|
|
. ' </tr>' . "\n"
|
|
. ' </thead>' . "\n"
|
|
. ' <tbody>' . "\n"
|
|
. ' <tr>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strReadRequests'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_read_requests']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strWriteRequests'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_write_requests']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' </tr>' . "\n"
|
|
. ' <tr>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strBufferReadMisses'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_reads']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strBufferWriteWaits'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_wait_free']) . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' </tr>' . "\n"
|
|
. ' <tr>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strBufferReadMissesInPercent'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . ' %') . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
|
. ' ' . $GLOBALS['strBufferWriteWaitsInPercent'] . ' ' . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
|
|
. ' ' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . ' %') . "\n"
|
|
. ' </td>' . "\n"
|
|
. ' </tr>' . "\n"
|
|
. ' </tbody>' . "\n"
|
|
. '</table>' . "\n";
|
|
return $output;
|
|
case 'status':
|
|
$res = PMA_DBI_query('SHOW INNODB STATUS;');
|
|
$row = PMA_DBI_fetch_row($res);
|
|
PMA_DBI_free_result($res);
|
|
return '<pre>' . "\n"
|
|
. htmlspecialchars($row[0]) . "\n"
|
|
. '</pre>' . "\n";
|
|
default:
|
|
return FALSE;
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|