Documentation TYPO3 par Ameos

innodb.lib.php

00001 <?php
00002 /* $Id: innodb.lib.php,v 2.5 2005/03/26 23:34:26 rabus Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 class PMA_StorageEngine_innodb extends PMA_StorageEngine {
00006     function getVariables() {
00007         return array(
00008             'innodb_data_home_dir' => array(
00009                 'title' => $GLOBALS['strInnoDBDataHomeDir'],
00010                 'desc'  => $GLOBALS['strInnoDBDataHomeDirDesc']
00011             ),
00012             'innodb_data_file_path' => array(
00013                 'title' => $GLOBALS['strInnoDBDataFilePath']
00014             ),
00015             'innodb_autoextend_increment' => array(
00016                 'title' => $GLOBALS['strInnoDBAutoextendIncrement'],
00017                 'desc'  => $GLOBALS['strInnoDBAutoextendIncrementDesc'],
00018                 'type'  => PMA_ENGINE_DETAILS_TYPE_NUMERIC
00019             ),
00020             'innodb_buffer_pool_size' => array(
00021                 'title' => $GLOBALS['strInnoDBBufferPoolSize'],
00022                 'desc'  => $GLOBALS['strInnoDBBufferPoolSizeDesc'],
00023                 'type'  => PMA_ENGINE_DETAILS_TYPE_SIZE
00024             )
00025         );
00026     }
00027 
00028     function getVariablesLikePattern () {
00029         return 'innodb\\_%';
00030     }
00031 
00032     function getInfoPages () {
00033         if ($this->support < PMA_ENGINE_SUPPORT_YES) {
00034             return array();
00035         }
00036         $pages = array();
00037         if (PMA_MYSQL_INT_VERSION >= 50002) {
00038             $pages['bufferpool'] = $GLOBALS['strBufferPool'];
00039         }
00040         $pages['status'] = $GLOBALS['strInnodbStat'];
00041         return $pages;
00042     }
00043 
00044     function getPage($id) {
00045         global $cfg;
00046 
00047         switch ($id) {
00048             case 'bufferpool':
00049                 if (PMA_MYSQL_INT_VERSION < 50002) {
00050                     return FALSE;
00051                 }
00052                 // rabus: The following query is only possible because we know
00053                 // that we are on MySQL 5 here (checked above)!
00054                 // side note: I love MySQL 5 for this. :-)
00055                 $res = PMA_DBI_query('SHOW STATUS WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' OR Variable_name = \'Innodb_page_size\';');
00056                 $status = array();
00057                 while ($row = PMA_DBI_fetch_row($res)) {
00058                     $status[$row[0]] = $row[1];
00059                 }
00060                 PMA_DBI_free_result($res);
00061                 unset($res, $row);
00062                 $output = '<table>' . "\n"
00063                         . '    <thead>' . "\n"
00064                         . '        <tr>' . "\n"
00065                         . '            <th colspan="4">' . "\n"
00066                         . '                ' . $GLOBALS['strBufferPoolUsage'] . "\n"
00067                         . '            </th>' . "\n"
00068                         . '        </tr>' . "\n"
00069                         . '    </thead>' . "\n"
00070                         . '    <tfoot>' . "\n"
00071                         . '        <tr>' . "\n"
00072                         . '            <th>' . "\n"
00073                         . '                ' . $GLOBALS['strTotalUC'] . "\n"
00074                         . '            </th>' . "\n"
00075                         . '            <th colspan="3">' . "\n"
00076                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_total']) . '&nbsp;' . $GLOBALS['strInnoDBPages'] . '&nbsp;/ ' . join('&nbsp;', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
00077                         . '            </th>' . "\n"
00078                         . '        </tr>' . "\n"
00079                         . '    </tfoot>' . "\n"
00080                         . '    <tbody>' . "\n"
00081                         . '        <tr>' . "\n"
00082                         . '            <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00083                         . '                &nbsp;' . $GLOBALS['strFreePages'] . '&nbsp;' . "\n"
00084                         . '            </td>' . "\n"
00085                         . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00086                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_free']) . "\n"
00087                         . '            </td>' . "\n"
00088                         . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00089                         . '                &nbsp;' . $GLOBALS['strDirtyPages'] . '&nbsp;' . "\n"
00090                         . '            </td>' . "\n"
00091                         . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00092                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_dirty']) . "\n"
00093                         . '            </td>' . "\n"
00094                         . '        </tr>' . "\n"
00095                         . '        <tr>' . "\n"
00096                         . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00097                         . '                &nbsp;' . $GLOBALS['strDataPages'] . '&nbsp;' . "\n"
00098                         . '            </td>' . "\n"
00099                         . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00100                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_data']) . "\n"
00101                         . '            </td>' . "\n"
00102                         . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00103                         . '                &nbsp;' . $GLOBALS['strPagesToBeFlushed'] . '&nbsp;' . "\n"
00104                         . '            </td>' . "\n"
00105                         . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00106                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_flushed']) . "\n"
00107                         . '            </td>' . "\n"
00108                         . '        </tr>' . "\n"
00109                         . '        <tr>' . "\n"
00110                         . '            <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00111                         . '                &nbsp;' . $GLOBALS['strBusyPages'] . '&nbsp;' . "\n"
00112                         . '            </td>' . "\n"
00113                         . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00114                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_misc']) . "\n"
00115                         . '            </td>' . "\n"
00116                         . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00117                         . '                &nbsp;' . $GLOBALS['strLatchedPages'] . '&nbsp;' . "\n"
00118                         . '            </td>' . "\n"
00119                         . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00120                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_latched']) . "\n"
00121                         . '            </td>' . "\n"
00122                         . '        </tr>' . "\n"
00123                         . '    </tbody>' . "\n"
00124                         . '</table>' . "\n\n"
00125                         . '<br />' . "\n\n"
00126                         . '<table>' . "\n"
00127                         . '    <thead>' . "\n"
00128                         . '        <tr>' . "\n"
00129                         . '            <th colspan="4">' . "\n"
00130                         . '                ' . $GLOBALS['strBufferPoolActivity'] . "\n"
00131                         . '            </th>' . "\n"
00132                         . '        </tr>' . "\n"
00133                         . '    </thead>' . "\n"
00134                         . '    <tbody>' . "\n"
00135                         . '        <tr>' . "\n"
00136                         . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00137                         . '                &nbsp;' . $GLOBALS['strReadRequests'] . '&nbsp;' . "\n"
00138                         . '            </td>' . "\n"
00139                         . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00140                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_read_requests']) . "\n"
00141                         . '            </td>' . "\n"
00142                         . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00143                         . '                &nbsp;' . $GLOBALS['strWriteRequests'] . '&nbsp;' . "\n"
00144                         . '            </td>' . "\n"
00145                         . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00146                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_write_requests']) . "\n"
00147                         . '            </td>' . "\n"
00148                         . '        </tr>' . "\n"
00149                         . '        <tr>' . "\n"
00150                         . '            <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00151                         . '                &nbsp;' . $GLOBALS['strBufferReadMisses'] . '&nbsp;' . "\n"
00152                         . '            </td>' . "\n"
00153                         . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00154                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_reads']) . "\n"
00155                         . '            </td>' . "\n"
00156                         . '            <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00157                         . '                &nbsp;' . $GLOBALS['strBufferWriteWaits'] . '&nbsp;' . "\n"
00158                         . '            </td>' . "\n"
00159                         . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00160                         . '                ' . htmlspecialchars($status['Innodb_buffer_pool_wait_free']) . "\n"
00161                         . '            </td>' . "\n"
00162                         . '        </tr>' . "\n"
00163                         . '        <tr>' . "\n"
00164                         . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00165                         . '                &nbsp;' . $GLOBALS['strBufferReadMissesInPercent'] . '&nbsp;' . "\n"
00166                         . '            </td>' . "\n"
00167                         . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00168                         . '                ' . ($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'])) . '&nbsp;%') . "\n"
00169                         . '            </td>' . "\n"
00170                         . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00171                         . '                &nbsp;' . $GLOBALS['strBufferWriteWaitsInPercent'] . '&nbsp;' . "\n"
00172                         . '            </td>' . "\n"
00173                         . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
00174                         . '                ' . ($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'])) . '&nbsp;%') . "\n"
00175                         . '            </td>' . "\n"
00176                         . '        </tr>' . "\n"
00177                         . '    </tbody>' . "\n"
00178                         . '</table>' . "\n";
00179                 return $output;
00180             case 'status':
00181                 $res = PMA_DBI_query('SHOW INNODB STATUS;');
00182                 $row = PMA_DBI_fetch_row($res);
00183                 PMA_DBI_free_result($res);
00184                 return '<pre>' . "\n"
00185                       . htmlspecialchars($row[0]) . "\n"
00186                       . '</pre>' . "\n";
00187             default:
00188                 return FALSE;
00189         }
00190     }
00191 }
00192 
00193 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6