1/* Copyright (c) 2008, 2011 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 Foundation,
14 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15
16#ifndef TABLE_FILE_SUMMARY_BY_INSTANCE_H
17#define TABLE_FILE_SUMMARY_BY_INSTANCE_H
18
19/**
20 @file storage/perfschema/table_file_summary_by_instance.h
21 Table FILE_SUMMARY_BY_INSTANCE (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/** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_INSTANCE. */
36struct row_file_summary_by_instance
37{
38 /** Column FILE_NAME. */
39 const char *m_filename;
40 /** Length in bytes of @c m_filename. */
41 uint m_filename_length;
42
43 /** Column EVENT_NAME. */
44 PFS_event_name_row m_event_name;
45
46 /** Column OBJECT_INSTANCE_BEGIN */
47 const void *m_identity;
48 /**
49 Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER and NUMBER_OF_BYTES for READ,
50 WRITE and MISC operation types.
51 */
52 PFS_file_io_stat_row m_io_stat;
53};
54
55/** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_INSTANCE. */
56class table_file_summary_by_instance : public PFS_engine_table
57{
58public:
59 /** Table share */
60 static PFS_engine_table_share m_share;
61 static PFS_engine_table* create();
62 static int delete_all_rows();
63
64 virtual int rnd_next();
65 virtual int rnd_pos(const void *pos);
66 virtual void reset_position(void);
67
68private:
69 virtual int read_row_values(TABLE *table,
70 unsigned char *buf,
71 Field **fields,
72 bool read_all);
73
74 table_file_summary_by_instance();
75
76public:
77 ~table_file_summary_by_instance()
78 {}
79
80private:
81 void make_row(PFS_file *pfs);
82
83 /** Table share lock. */
84 static THR_LOCK m_table_lock;
85
86 /** Current row. */
87 row_file_summary_by_instance m_row;
88 /** True if the current row exists. */
89 bool m_row_exists;
90 /** Current position. */
91 PFS_simple_index m_pos;
92 /** Next position. */
93 PFS_simple_index m_next_pos;
94};
95
96/** @} */
97#endif
98