MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pfs_con_slice.cc
Go to the documentation of this file.
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 
17 #include "my_global.h"
18 #include "my_pthread.h"
19 #include "pfs_con_slice.h"
20 #include "pfs_stat.h"
21 #include "pfs_global.h"
22 #include "pfs_instr_class.h"
23 
36 {
37  PFS_single_stat *slice= NULL;
38  uint index;
39 
40  if (sizing > 0)
41  {
42  slice= PFS_MALLOC_ARRAY(sizing, PFS_single_stat, MYF(MY_ZEROFILL));
43  if (unlikely(slice == NULL))
44  return NULL;
45 
46  for (index= 0; index < sizing; index++)
47  slice[index].reset();
48  }
49 
50  return slice;
51 }
52 
55 {
56  PFS_stage_stat *slice= NULL;
57  uint index;
58 
59  if (sizing > 0)
60  {
61  slice= PFS_MALLOC_ARRAY(sizing, PFS_stage_stat, MYF(MY_ZEROFILL));
62  if (unlikely(slice == NULL))
63  return NULL;
64 
65  for (index= 0; index < sizing; index++)
66  slice[index].reset();
67  }
68 
69  return slice;
70 }
71 
74 {
75  PFS_statement_stat *slice= NULL;
76  uint index;
77 
78  if (sizing > 0)
79  {
80  slice= PFS_MALLOC_ARRAY(sizing, PFS_statement_stat, MYF(MY_ZEROFILL));
81  if (unlikely(slice == NULL))
82  return NULL;
83 
84  for (index= 0; index < sizing; index++)
85  slice[index].reset();
86  }
87 
88  return slice;
89 }
90 
92 {
94  PFS_single_stat *stat_last= stat + wait_class_max;
95  for ( ; stat < stat_last; stat++)
96  stat->reset();
97 }
98 
100 {
102  PFS_stage_stat *stat_last= stat + stage_class_max;
103  for ( ; stat < stat_last; stat++)
104  stat->reset();
105 }
106 
108 {
110  PFS_statement_stat *stat_last= stat + statement_class_max;
111  for ( ; stat < stat_last; stat++)
112  stat->reset();
113 }
114