InnoDB buffer pool monitor
This commit is contained in:
@@ -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
|
||||
|
@@ -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,21 +25,105 @@ 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') {
|
||||
$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 {
|
||||
return FALSE;
|
||||
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"
|
||||
. ' ' . $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";
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
@@ -69,36 +70,36 @@ function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) {
|
||||
foreach ($variables as $var => $details) {
|
||||
if (!isset($mysql_vars[$var])) continue;
|
||||
|
||||
if (!isset($details['type'])) $details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
|
||||
$is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
|
||||
if (!isset($details['type'])) $details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
|
||||
$is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
|
||||
|
||||
$bgcolor = $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
|
||||
|
||||
$dt_table .= $spaces . ' <tr>' . "\n"
|
||||
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n";
|
||||
if (!empty($variables[$var]['desc'])) {
|
||||
$dt_table .= $spaces . ' ' . PMA_showHint($details['desc']) . "\n";
|
||||
}
|
||||
$dt_table .= $spaces . ' </td>' . "\n"
|
||||
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n"
|
||||
. $spaces . ' ' . $details['title'] . ' ' . "\n"
|
||||
. $spaces . ' </td>' . "\n"
|
||||
. $spaces . ' <td bgcolor="' . $bgcolor . '"' . ($is_num ? ' align="right"' : '') . '>' . "\n"
|
||||
. $spaces . ' ';
|
||||
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n";
|
||||
if (!empty($variables[$var]['desc'])) {
|
||||
$dt_table .= $spaces . ' ' . PMA_showHint($details['desc']) . "\n";
|
||||
}
|
||||
$dt_table .= $spaces . ' </td>' . "\n"
|
||||
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n"
|
||||
. $spaces . ' ' . $details['title'] . ' ' . "\n"
|
||||
. $spaces . ' </td>' . "\n"
|
||||
. $spaces . ' <td bgcolor="' . $bgcolor . '"' . ($is_num ? ' align="right"' : '') . '>' . "\n"
|
||||
. $spaces . ' ';
|
||||
switch ($details['type']) {
|
||||
case PMA_ENGINE_DETAILS_TYPE_SIZE:
|
||||
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
|
||||
$dt_table .= $parsed_size[0] . ' ' . $parsed_size[1];
|
||||
unset($parsed_size);
|
||||
break;
|
||||
default:
|
||||
$dt_table .= htmlspecialchars($mysql_vars[$var]);
|
||||
}
|
||||
$dt_table .= ' ' . "\n"
|
||||
. $spaces . ' </td>' . "\n"
|
||||
. $spaces . ' </tr>' . "\n";
|
||||
case PMA_ENGINE_DETAILS_TYPE_SIZE:
|
||||
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
|
||||
$dt_table .= $parsed_size[0] . ' ' . $parsed_size[1];
|
||||
unset($parsed_size);
|
||||
break;
|
||||
default:
|
||||
$dt_table .= htmlspecialchars($mysql_vars[$var]);
|
||||
}
|
||||
$dt_table .= ' ' . "\n"
|
||||
. $spaces . ' </td>' . "\n"
|
||||
. $spaces . ' </tr>' . "\n";
|
||||
$useBgcolorOne = !$useBgcolorOne;
|
||||
$has_content = TRUE;
|
||||
$has_content = TRUE;
|
||||
}
|
||||
|
||||
if (!$has_content) return '';
|
||||
|
Reference in New Issue
Block a user