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

« back to all changes in this revision

Viewing changes to storage/perfschema/pfs_con_slice.cc

  • 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, 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
 
 
24
/**
 
25
  @file storage/perfschema/pfs_con_slice.cc
 
26
  Performance schema connection slice (implementation).
 
27
*/
 
28
 
 
29
/**
 
30
  @addtogroup Performance_schema_buffers
 
31
  @{
 
32
*/
 
33
 
 
34
PFS_single_stat *
 
35
PFS_connection_slice::alloc_waits_slice(uint sizing)
 
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
 
 
53
PFS_stage_stat *
 
54
PFS_connection_slice::alloc_stages_slice(uint sizing)
 
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
 
 
72
PFS_statement_stat *
 
73
PFS_connection_slice::alloc_statements_slice(uint sizing)
 
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
 
 
91
void PFS_connection_slice::reset_waits_stats()
 
92
{
 
93
  PFS_single_stat *stat= m_instr_class_waits_stats;
 
94
  PFS_single_stat *stat_last= stat + wait_class_max;
 
95
  for ( ; stat < stat_last; stat++)
 
96
    stat->reset();
 
97
}
 
98
 
 
99
void PFS_connection_slice::reset_stages_stats()
 
100
{
 
101
  PFS_stage_stat *stat= m_instr_class_stages_stats;
 
102
  PFS_stage_stat *stat_last= stat + stage_class_max;
 
103
  for ( ; stat < stat_last; stat++)
 
104
    stat->reset();
 
105
}
 
106
 
 
107
void PFS_connection_slice::reset_statements_stats()
 
108
{
 
109
  PFS_statement_stat *stat= m_instr_class_statements_stats;
 
110
  PFS_statement_stat *stat_last= stat + statement_class_max;
 
111
  for ( ; stat < stat_last; stat++)
 
112
    stat->reset();
 
113
}
 
114
 
 
115
/** @} */
 
116