~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to storage/perfschema/table_esms_by_host_by_event_name.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2010, 2013, 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_ESMS_BY_HOST_BY_EVENT_NAME_H
 
17
#define TABLE_ESMS_BY_HOST_BY_EVENT_NAME_H
 
18
 
 
19
/**
 
20
  @file storage/perfschema/table_esms_by_host_by_event_name.h
 
21
  Table EVENTS_STATEMENTS_SUMMARY_BY_HOST_BY_EVENT_NAME (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 "pfs_host.h"
 
29
#include "table_helper.h"
 
30
 
 
31
/**
 
32
  @addtogroup Performance_schema_tables
 
33
  @{
 
34
*/
 
35
 
 
36
/**
 
37
  A row of table
 
38
  PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_HOST_BY_EVENT_NAME.
 
39
*/
 
40
struct row_esms_by_host_by_event_name
 
41
{
 
42
  /** Column HOST */
 
43
  PFS_host_row m_host;
 
44
  /** Column EVENT_NAME */
 
45
  PFS_event_name_row m_event_name;
 
46
  /** Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER_WAIT. */
 
47
  PFS_statement_stat_row m_stat;
 
48
};
 
49
 
 
50
/**
 
51
  Position of a cursor on
 
52
  PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_HOST_BY_EVENT_NAME.
 
53
  Index 1 on host (0 based)
 
54
  Index 2 on statement class (1 based)
 
55
*/
 
56
struct pos_esms_by_host_by_event_name
 
57
: public PFS_double_index
 
58
{
 
59
  pos_esms_by_host_by_event_name()
 
60
    : PFS_double_index(0, 1)
 
61
  {}
 
62
 
 
63
  inline void reset(void)
 
64
  {
 
65
    m_index_1= 0;
 
66
    m_index_2= 1;
 
67
  }
 
68
 
 
69
  inline bool has_more_host(void)
 
70
  { return (m_index_1 < host_max); }
 
71
 
 
72
  inline void next_host(void)
 
73
  {
 
74
    m_index_1++;
 
75
    m_index_2= 1;
 
76
  }
 
77
};
 
78
 
 
79
/** Table PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_HOST_BY_EVENT_NAME. */
 
80
class table_esms_by_host_by_event_name : public PFS_engine_table
 
81
{
 
82
public:
 
83
  /** Table share */
 
84
  static PFS_engine_table_share m_share;
 
85
  static PFS_engine_table* create();
 
86
  static int delete_all_rows();
 
87
 
 
88
  virtual int rnd_init(bool scan);
 
89
  virtual int rnd_next();
 
90
  virtual int rnd_pos(const void *pos);
 
91
  virtual void reset_position(void);
 
92
 
 
93
protected:
 
94
  virtual int read_row_values(TABLE *table,
 
95
                              unsigned char *buf,
 
96
                              Field **fields,
 
97
                              bool read_all);
 
98
 
 
99
  table_esms_by_host_by_event_name();
 
100
 
 
101
public:
 
102
  ~table_esms_by_host_by_event_name()
 
103
  {}
 
104
 
 
105
protected:
 
106
  void make_row(PFS_host *host, PFS_statement_class *klass);
 
107
 
 
108
private:
 
109
  /** Table share lock. */
 
110
  static THR_LOCK m_table_lock;
 
111
  /** Fields definition. */
 
112
  static TABLE_FIELD_DEF m_field_def;
 
113
 
 
114
  /** Current row. */
 
115
  row_esms_by_host_by_event_name m_row;
 
116
  /** True is the current row exists. */
 
117
  bool m_row_exists;
 
118
  /** Current position. */
 
119
  pos_esms_by_host_by_event_name m_pos;
 
120
  /** Next position. */
 
121
  pos_esms_by_host_by_event_name m_next_pos;
 
122
};
 
123
 
 
124
/** @} */
 
125
#endif