1/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
15
16#ifndef TABLE_IO_WAITS_SUMMARY_BY_TABLE_H
17#define TABLE_IO_WAITS_SUMMARY_BY_TABLE_H
18
19/**
20 @file storage/perfschema/table_tiws_by_table.h
21 Table TABLE_IO_WAITS_SUMMARY_BY_TABLE (declarations).
22*/
23
24#include "pfs_column_types.h"
25#include "pfs_engine_table.h"
26#include "pfs_instr_class.h"
27#include "pfs_instr.h"
28#include "table_helper.h"
29
30/**
31 @addtogroup Performance_schema_tables
32 @{
33*/
34
35/**
36 A row of table
37 PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMARY_BY_TABLE.
38*/
39struct row_tiws_by_table
40{
41 /** Column OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME. */
42 PFS_object_row m_object;
43 /** Columns COUNT/SUM/MIN/AVG/MAX (+_READ, +WRITE). */
44 PFS_table_io_stat_row m_stat;
45};
46
47/** Table PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMARY_BY_TABLE. */
48class table_tiws_by_table : public PFS_engine_table
49{
50public:
51 /** Table share */
52 static PFS_engine_table_share m_share;
53 static PFS_engine_table* create();
54 static int delete_all_rows();
55
56 virtual int rnd_init(bool scan);
57 virtual int rnd_next();
58 virtual int rnd_pos(const void *pos);
59 virtual void reset_position(void);
60
61protected:
62 virtual int read_row_values(TABLE *table,
63 unsigned char *buf,
64 Field **fields,
65 bool read_all);
66
67 table_tiws_by_table();
68
69public:
70 ~table_tiws_by_table()
71 {}
72
73protected:
74 void make_row(PFS_table_share *table_share);
75
76private:
77 /** Table share lock. */
78 static THR_LOCK m_table_lock;
79
80 /** Current row. */
81 row_tiws_by_table m_row;
82 /** True is the current row exists. */
83 bool m_row_exists;
84 /** Current position. */
85 PFS_simple_index m_pos;
86 /** Next position. */
87 PFS_simple_index m_next_pos;
88};
89
90/** @} */
91#endif
92