MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IndexStatSignal.cpp
1 /* Copyright (C) 2003 MySQL AB
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 #include <signaldata/IndexStatSignal.hpp>
17 
18 static void
19 get_req_rt_name(Uint32 rt, char* rt_name)
20 {
21  strcpy(rt_name, "Unknown");
22 #define set_req_rt_name(x) if (rt == IndexStatReq::x) strcpy(rt_name, #x)
23  set_req_rt_name(RT_UPDATE_STAT);
24  set_req_rt_name(RT_CLEAN_NEW);
25  set_req_rt_name(RT_SCAN_FRAG);
26  set_req_rt_name(RT_CLEAN_OLD);
27  set_req_rt_name(RT_START_MON);
28  set_req_rt_name(RT_DELETE_STAT);
29  set_req_rt_name(RT_STOP_MON);
30  set_req_rt_name(RT_DROP_HEAD);
31  set_req_rt_name(RT_CLEAN_ALL);
32 #undef set_req_rt_name
33 }
34 
35 static void
36 get_rep_rt_name(Uint32 rt, char* rt_name)
37 {
38  strcpy(rt_name, "Unknown");
39 #define set_rep_rt_name(x) if (rt == IndexStatRep::x) strcpy(rt_name, #x)
40  set_rep_rt_name(RT_UPDATE_REQ);
41  set_rep_rt_name(RT_UPDATE_CONF);
42 #undef set_rep_rt_name
43 }
44 
45 bool
46 printINDEX_STAT_REQ(FILE* output, const Uint32* theData, Uint32 len, Uint16)
47 {
48  const IndexStatReq* sig = (const IndexStatReq*)theData;
49  fprintf(output, " clientRef: 0x%x", sig->clientRef);
50  fprintf(output, " clientData: %u", sig->clientData);
51  fprintf(output, "\n");
52  Uint32 rt = sig->requestInfo & 0xFF;
53  char rt_name[40];
54  get_req_rt_name(rt, rt_name);
55  fprintf(output, " requestType: %s[%u]", rt_name, rt);
56  fprintf(output, " requestFlag: 0x%x", sig->requestFlag);
57  fprintf(output, "\n");
58  fprintf(output, " indexId: %u", sig->indexId);
59  fprintf(output, " indexVersion: %u", sig->indexVersion);
60  fprintf(output, " tableId: %u", sig->tableId);
61  fprintf(output, "\n");
62  return true;
63 }
64 
65 bool
66 printINDEX_STAT_IMPL_REQ(FILE* output, const Uint32* theData, Uint32 len, Uint16)
67 {
68  const IndexStatImplReq* sig = (const IndexStatImplReq*)theData;
69  fprintf(output, " senderRef: 0x%x", sig->senderRef);
70  fprintf(output, " senderData: %u", sig->senderData);
71  fprintf(output, "\n");
72  Uint32 rt = sig->requestType;
73  char rt_name[40];
74  get_req_rt_name(rt, rt_name);
75  fprintf(output, " requestType: %s[%u]", rt_name, rt);
76  fprintf(output, " requestFlag: 0x%x", sig->requestFlag);
77  fprintf(output, "\n");
78  fprintf(output, " indexId: %u", sig->indexId);
79  fprintf(output, " indexVersion: %u", sig->indexVersion);
80  fprintf(output, " tableId: %u", sig->tableId);
81  fprintf(output, " fragId: %u", sig->fragId);
82  fprintf(output, " fragCount: %u", sig->fragCount);
83  fprintf(output, "\n");
84  return true;
85 }
86 
87 bool
88 printINDEX_STAT_CONF(FILE* output, const Uint32* theData, Uint32 len, Uint16)
89 {
90  const IndexStatConf* sig = (const IndexStatConf*)theData;
91  fprintf(output, " senderRef: 0x%x", sig->senderRef);
92  fprintf(output, " senderData: %u", sig->senderData);
93  fprintf(output, "\n");
94  return true;
95 }
96 
97 bool
98 printINDEX_STAT_IMPL_CONF(FILE* output, const Uint32* theData, Uint32 len, Uint16)
99 {
100  const IndexStatImplConf* sig = (const IndexStatImplConf*)theData;
101  fprintf(output, " senderRef: 0x%x", sig->senderRef);
102  fprintf(output, " senderData: %u", sig->senderData);
103  fprintf(output, "\n");
104  return true;
105 }
106 
107 bool
108 printINDEX_STAT_REF(FILE* output, const Uint32* theData, Uint32 len, Uint16)
109 {
110  const IndexStatRef* sig = (const IndexStatRef*)theData;
111  fprintf(output, " senderRef: 0x%x", sig->senderRef);
112  fprintf(output, " senderData: %u", sig->senderData);
113  fprintf(output, " errorCode: %u", sig->errorCode);
114  fprintf(output, " errorLine: %u", sig->errorLine);
115  fprintf(output, "\n");
116  return true;
117 }
118 
119 bool
120 printINDEX_STAT_IMPL_REF(FILE* output, const Uint32* theData, Uint32 len, Uint16)
121 {
122  const IndexStatImplRef* sig = (const IndexStatImplRef*)theData;
123  fprintf(output, " senderRef: 0x%x", sig->senderRef);
124  fprintf(output, " senderData: %u", sig->senderData);
125  fprintf(output, " errorCode: %u", sig->errorCode);
126  fprintf(output, " errorLine: %u", sig->errorLine);
127  fprintf(output, "\n");
128  return true;
129 }
130 
131 bool
132 printINDEX_STAT_REP(FILE* output, const Uint32* theData, Uint32 len, Uint16)
133 {
134  const IndexStatRep* sig = (const IndexStatRep*)theData;
135  fprintf(output, " senderRef: 0x%x", sig->senderRef);
136  fprintf(output, " senderData: %u", sig->senderData);
137  fprintf(output, "\n");
138  Uint32 rt = sig->requestType;
139  char rt_name[40];
140  get_rep_rt_name(rt, rt_name);
141  fprintf(output, " requestType: %s[%u]", rt_name, rt);
142  fprintf(output, " requestFlag: 0x%x", sig->requestFlag);
143  fprintf(output, "\n");
144  fprintf(output, " indexId: %u", sig->indexId);
145  fprintf(output, " indexVersion: %u", sig->indexVersion);
146  fprintf(output, " tableId: %u", sig->tableId);
147  fprintf(output, "\n");
148  fprintf(output, " fragId: %u", sig->fragId);
149  fprintf(output, " loadTime: %u", sig->loadTime);
150  fprintf(output, "\n");
151  return true;
152 }