File: innodb.lib.php

package info (click to toggle)
phpmyadmin 4%3A2.6.2-3sarge6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,240 kB
  • ctags: 91,384
  • sloc: php: 115,860; sh: 557; sql: 224; perl: 4
file content (193 lines) | stat: -rw-r--r-- 11,853 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
/* $Id: innodb.lib.php,v 2.5 2005/03/26 23:34:26 rabus Exp $ */
// 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']) . '&nbsp;' . $GLOBALS['strInnoDBPages'] . '&nbsp;/ ' . join('&nbsp;', 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"
                        . '                &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\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"
                        . '                &nbsp;' . $GLOBALS['strReadRequests'] . '&nbsp;' . "\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"
                        . '                &nbsp;' . $GLOBALS['strWriteRequests'] . '&nbsp;' . "\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"
                        . '                &nbsp;' . $GLOBALS['strBufferReadMisses'] . '&nbsp;' . "\n"
                        . '            </td>' . "\n"
                        . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
                        . '                ' . htmlspecialchars($status['Innodb_buffer_pool_reads']) . "\n"
                        . '            </td>' . "\n"
                        . '            <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
                        . '                &nbsp;' . $GLOBALS['strBufferWriteWaits'] . '&nbsp;' . "\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"
                        . '                &nbsp;' . $GLOBALS['strBufferReadMissesInPercent'] . '&nbsp;' . "\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'])) . '&nbsp;%') . "\n"
                        . '            </td>' . "\n"
                        . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
                        . '                &nbsp;' . $GLOBALS['strBufferWriteWaitsInPercent'] . '&nbsp;' . "\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'])) . '&nbsp;%') . "\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;
        }
    }
}

?>