1/* Copyright (c) 2010, 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
14 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15
16#ifndef PFS_CON_SLICE_H
17#define PFS_CON_SLICE_H
18
19/**
20 @file storage/perfschema/pfs_con_slice.h
21 Performance schema connection slice (declarations).
22*/
23
24#include "pfs_lock.h"
25#include "lf.h"
26
27struct PFS_single_stat;
28struct PFS_stage_stat;
29struct PFS_statement_stat;
30
31/**
32 @addtogroup Performance_schema_buffers
33 @{
34*/
35
36/**
37 A connection slice, an arbitrary grouping of several connections.
38 This structure holds statistics for grouping of connections.
39*/
40struct PFS_connection_slice
41{
42 /**
43 Allocate memory for waits statistics.
44 @param sizing the number of wait classes.
45 @return wait statistics for this slice.
46 */
47 static PFS_single_stat *alloc_waits_slice(uint sizing);
48 /**
49 Allocate memory for stages statistics.
50 @param sizing the number of stage classes.
51 @return stage statistics for this slice.
52 */
53 static PFS_stage_stat *alloc_stages_slice(uint sizing);
54 /**
55 Allocate memory for statement statistics.
56 @param sizing the number of statement classes.
57 @return statement statistics for this slice.
58 */
59 static PFS_statement_stat *alloc_statements_slice(uint sizing);
60
61 /** Reset all statistics. */
62 inline void reset_stats()
63 {
64 reset_waits_stats();
65 reset_stages_stats();
66 reset_statements_stats();
67 }
68
69 /** Reset all wait statistics. */
70 void reset_waits_stats();
71 /** Reset all stages statistics. */
72 void reset_stages_stats();
73 /** Reset all statements statistics. */
74 void reset_statements_stats();
75
76 /**
77 Per connection slice waits aggregated statistics.
78 This member holds the data for the table
79 PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_*_BY_EVENT_NAME.
80 Immutable, safe to use without internal lock.
81 */
82 PFS_single_stat *m_instr_class_waits_stats;
83
84 /**
85 Per connection slice stages aggregated statistics.
86 This member holds the data for the table
87 PERFORMANCE_SCHEMA.EVENTS_STAGES_SUMMARY_BY_*_BY_EVENT_NAME.
88 Immutable, safe to use without internal lock.
89 */
90 PFS_stage_stat *m_instr_class_stages_stats;
91
92 /**
93 Per connection slice statements aggregated statistics.
94 This member holds the data for the table
95 PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_*_BY_EVENT_NAME.
96 Immutable, safe to use without internal lock.
97 */
98 PFS_statement_stat *m_instr_class_statements_stats;
99};
100
101/** @} */
102#endif
103
104