InnoDB buffer pool monitor

This commit is contained in:
Alexander M. Turek
2005-03-05 21:36:13 +00:00
parent afc124567a
commit 857fdb0e79
3 changed files with 128 additions and 37 deletions

View File

@@ -12,8 +12,9 @@ $Source$
libraries/engines/myisam.lib.php:
- Moved engine-specific settings into plugins;
- Added ability to create multiple sub-pages in server_engines.php for
a specific engine.
a specific engine;
- Added a few InnoDB variables. To be continued. :-)
- New InnoDB buffer pool monitor for MySQL >= 5.0.2.
2005-03-04 Marc Delisle <lem9@users.sourceforge.net>
* Documentation.html, libraries/common.lib.php: new FAQ 2.8 about

View File

@@ -11,6 +11,11 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine {
),
'innodb_data_file_path' => array(
'title' => $GLOBALS['strInnoDBDataFilePath']
),
'innodb_autoextend_increment' => array(
'title' => $GLOBALS['strInnoDBAutoextendIncrement'],
'desc' => $GLOBALS['strInnoDBAutoextendIncrementDesc'],
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
)
);
}
@@ -20,20 +25,104 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine {
}
function getInfoPages () {
return array(
'status' => $GLOBALS['strInnodbStat']
);
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) {
if ($id == 'status') {
global $cfg;
switch ($id) {
case 'bufferpool':
if (PMA_MYSQL_INT_VERSION < 50002) {
return FALSE;
}
$res = PMA_DBI_query('SHOW STATUS LIKE \'Innodb\\_buffer\\_pool\\_%\'');
$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>' . "\n"
. ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_total']) . "\n"
. ' </th>' . "\n"
. ' </tr>' . "\n"
. ' </tfoot>' . "\n"
. ' <tbody>' . "\n"
. ' <tr>' . "\n"
. ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
. ' &nbsp;' . $GLOBALS['strFreePages'] . '&nbsp;' . "\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"
. ' &nbsp;' . $GLOBALS['strDirtyPages'] . '&nbsp;' . "\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"
. ' &nbsp;' . $GLOBALS['strDataPages'] . '&nbsp;' . "\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"
. ' &nbsp;' . $GLOBALS['strPagesToBeFlushed'] . '&nbsp;' . "\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"
. ' &nbsp;' . $GLOBALS['strBusyPages'] . '&nbsp;' . "\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"
. ' &nbsp;' . $GLOBALS['strLatchedPages'] . '&nbsp;' . "\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";
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";
} else {
default:
return FALSE;
}
}

View File

@@ -32,6 +32,7 @@ require('./server_links.inc.php');
define('PMA_ENGINE_DETAILS_TYPE_PLAINTEXT', 0);
define('PMA_ENGINE_DETAILS_TYPE_SIZE', 1);
define('PMA_ENGINE_DETAILS_TYPE_NUMERIC', 2); //Has no effect yet...
define('PMA_ENGINE_DETAILS_TYPE_BOOLEAN', 3); // 'ON' or 'OFF'
function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) {
global $cfg;