InnoDB buffer pool monitor
This commit is contained in:
@@ -12,8 +12,9 @@ $Source$
|
|||||||
libraries/engines/myisam.lib.php:
|
libraries/engines/myisam.lib.php:
|
||||||
- Moved engine-specific settings into plugins;
|
- Moved engine-specific settings into plugins;
|
||||||
- Added ability to create multiple sub-pages in server_engines.php for
|
- 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. :-)
|
- 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>
|
2005-03-04 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* Documentation.html, libraries/common.lib.php: new FAQ 2.8 about
|
* 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(
|
'innodb_data_file_path' => array(
|
||||||
'title' => $GLOBALS['strInnoDBDataFilePath']
|
'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 () {
|
function getInfoPages () {
|
||||||
return array(
|
if ($this->support < PMA_ENGINE_SUPPORT_YES) {
|
||||||
'status' => $GLOBALS['strInnodbStat']
|
return array();
|
||||||
);
|
}
|
||||||
|
$pages = array();
|
||||||
|
if (PMA_MYSQL_INT_VERSION >= 50002) {
|
||||||
|
$pages['bufferpool'] = $GLOBALS['strBufferPool'];
|
||||||
|
}
|
||||||
|
$pages['status'] = $GLOBALS['strInnodbStat'];
|
||||||
|
return $pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPage($id) {
|
function getPage($id) {
|
||||||
if ($id == 'status') {
|
global $cfg;
|
||||||
$res = PMA_DBI_query('SHOW INNODB STATUS;');
|
|
||||||
$row = PMA_DBI_fetch_row($res);
|
switch ($id) {
|
||||||
PMA_DBI_free_result($res);
|
case 'bufferpool':
|
||||||
return '<pre>' . "\n"
|
if (PMA_MYSQL_INT_VERSION < 50002) {
|
||||||
. htmlspecialchars($row[0]) . "\n"
|
return FALSE;
|
||||||
. '</pre>' . "\n";
|
}
|
||||||
} else {
|
$res = PMA_DBI_query('SHOW STATUS LIKE \'Innodb\\_buffer\\_pool\\_%\'');
|
||||||
return FALSE;
|
$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_PLAINTEXT', 0);
|
||||||
define('PMA_ENGINE_DETAILS_TYPE_SIZE', 1);
|
define('PMA_ENGINE_DETAILS_TYPE_SIZE', 1);
|
||||||
define('PMA_ENGINE_DETAILS_TYPE_NUMERIC', 2); //Has no effect yet...
|
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) {
|
function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) {
|
||||||
global $cfg;
|
global $cfg;
|
||||||
|
|
||||||
@@ -69,36 +70,36 @@ function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) {
|
|||||||
foreach ($variables as $var => $details) {
|
foreach ($variables as $var => $details) {
|
||||||
if (!isset($mysql_vars[$var])) continue;
|
if (!isset($mysql_vars[$var])) continue;
|
||||||
|
|
||||||
if (!isset($details['type'])) $details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
|
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;
|
$is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
|
||||||
|
|
||||||
$bgcolor = $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
|
$bgcolor = $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
|
||||||
|
|
||||||
$dt_table .= $spaces . ' <tr>' . "\n"
|
$dt_table .= $spaces . ' <tr>' . "\n"
|
||||||
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n";
|
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n";
|
||||||
if (!empty($variables[$var]['desc'])) {
|
if (!empty($variables[$var]['desc'])) {
|
||||||
$dt_table .= $spaces . ' ' . PMA_showHint($details['desc']) . "\n";
|
$dt_table .= $spaces . ' ' . PMA_showHint($details['desc']) . "\n";
|
||||||
}
|
}
|
||||||
$dt_table .= $spaces . ' </td>' . "\n"
|
$dt_table .= $spaces . ' </td>' . "\n"
|
||||||
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n"
|
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n"
|
||||||
. $spaces . ' ' . $details['title'] . ' ' . "\n"
|
. $spaces . ' ' . $details['title'] . ' ' . "\n"
|
||||||
. $spaces . ' </td>' . "\n"
|
. $spaces . ' </td>' . "\n"
|
||||||
. $spaces . ' <td bgcolor="' . $bgcolor . '"' . ($is_num ? ' align="right"' : '') . '>' . "\n"
|
. $spaces . ' <td bgcolor="' . $bgcolor . '"' . ($is_num ? ' align="right"' : '') . '>' . "\n"
|
||||||
. $spaces . ' ';
|
. $spaces . ' ';
|
||||||
switch ($details['type']) {
|
switch ($details['type']) {
|
||||||
case PMA_ENGINE_DETAILS_TYPE_SIZE:
|
case PMA_ENGINE_DETAILS_TYPE_SIZE:
|
||||||
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
|
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
|
||||||
$dt_table .= $parsed_size[0] . ' ' . $parsed_size[1];
|
$dt_table .= $parsed_size[0] . ' ' . $parsed_size[1];
|
||||||
unset($parsed_size);
|
unset($parsed_size);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$dt_table .= htmlspecialchars($mysql_vars[$var]);
|
$dt_table .= htmlspecialchars($mysql_vars[$var]);
|
||||||
}
|
}
|
||||||
$dt_table .= ' ' . "\n"
|
$dt_table .= ' ' . "\n"
|
||||||
. $spaces . ' </td>' . "\n"
|
. $spaces . ' </td>' . "\n"
|
||||||
. $spaces . ' </tr>' . "\n";
|
. $spaces . ' </tr>' . "\n";
|
||||||
$useBgcolorOne = !$useBgcolorOne;
|
$useBgcolorOne = !$useBgcolorOne;
|
||||||
$has_content = TRUE;
|
$has_content = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$has_content) return '';
|
if (!$has_content) return '';
|
||||||
|
Reference in New Issue
Block a user