1 /* Copyright (c) 2010, 2021, Oracle and/or its affiliates.
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, version 2.0,
5   as published by the Free Software Foundation.
6 
7   This program is also distributed with certain software (including
8   but not limited to OpenSSL) that is licensed under separate terms,
9   as designated in a particular file or component or in included license
10   documentation.  The authors of MySQL hereby grant you an additional
11   permission to link the program and your derivative works with the
12   separately licensed software that they have included with MySQL.
13 
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License, version 2.0, for more details.
18 
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software
21   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 
24 #include "my_global.h"
25 #include "my_thread.h"
26 #include "pfs_con_slice.h"
27 #include "pfs_stat.h"
28 #include "pfs_global.h"
29 #include "pfs_instr_class.h"
30 
31 /**
32   @file storage/perfschema/pfs_con_slice.cc
33   Performance schema connection slice (implementation).
34 */
35 
36 /**
37   @addtogroup Performance_schema_buffers
38   @{
39 */
40 
reset_waits_stats()41 void PFS_connection_slice::reset_waits_stats()
42 {
43   PFS_single_stat *stat= m_instr_class_waits_stats;
44   PFS_single_stat *stat_last= stat + wait_class_max;
45   for ( ; stat < stat_last; stat++)
46     stat->reset();
47 }
48 
reset_stages_stats()49 void PFS_connection_slice::reset_stages_stats()
50 {
51   PFS_stage_stat *stat= m_instr_class_stages_stats;
52   PFS_stage_stat *stat_last= stat + stage_class_max;
53   for ( ; stat < stat_last; stat++)
54     stat->reset();
55 }
56 
reset_statements_stats()57 void PFS_connection_slice::reset_statements_stats()
58 {
59   PFS_statement_stat *stat= m_instr_class_statements_stats;
60   PFS_statement_stat *stat_last= stat + statement_class_max;
61   for ( ; stat < stat_last; stat++)
62     stat->reset();
63 }
64 
reset_transactions_stats()65 void PFS_connection_slice::reset_transactions_stats()
66 {
67   PFS_transaction_stat *stat=
68                     &m_instr_class_transactions_stats[GLOBAL_TRANSACTION_INDEX];
69   if (stat)
70     stat->reset();
71 }
72 
rebase_memory_stats()73 void PFS_connection_slice::rebase_memory_stats()
74 {
75   PFS_memory_stat *stat= m_instr_class_memory_stats;
76   PFS_memory_stat *stat_last= stat + memory_class_max;
77   for ( ; stat < stat_last; stat++)
78     stat->reset();
79 }
80 
81 /** @} */
82 
83