Debian Codegraph @

mysql-test/suite/perfschema/include/memory_aggregate_load.inc

raw
1 # Tests for the performance schema
2
3 # ========================================
4 # HELPER include/memory_aggregate_load.inc
5 # ========================================
6
7 echo "================== Step 1 ==================";
8 --vertical_results
9 call dump_thread();
10 execute dump_memory_account;
11 execute dump_memory_user;
12 execute dump_memory_host;
13 execute dump_memory_global;
14 --horizontal_results
15 execute dump_accounts;
16 execute dump_users;
17 execute dump_hosts;
18
19 # Notes about this test
20 #
21 # get_lock("marker") causes the following memory allocation:
22 # memory/sql/User_level_lock, 1 malloc, size 16 (size 8 for 32-bit systems).
23 # release_lock("marker") causes the following memory free:
24 # memory/sql/User_level_lock, 1 free, size 16 (size 8 for 32-bit systems).
25 #
26 # To avoid noise from main, the background threads are disabled.
27
28 connect (con1, localhost, user1, , );
29
30 echo "================== con1 connected ==================";
31
32 --connection default
33
34 # Wait for the connect to complete
35 let $wait_condition=
36 select count(*) = 1 from performance_schema.threads
37 where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user1';
38 --source include/wait_condition.inc
39
40 echo "================== Step 2 ==================";
41 --vertical_results
42 call dump_thread();
43 execute dump_memory_account;
44 execute dump_memory_user;
45 execute dump_memory_host;
46 execute dump_memory_global;
47 --horizontal_results
48 execute dump_accounts;
49 execute dump_users;
50 execute dump_hosts;
51
52 --connection con1
53
54 select get_lock("marker_1", 10);
55 select release_lock("marker_1");
56 set @v1 = repeat("a", 1000);
57 set @v2 = repeat("b", 2000);
58 set @v3 = repeat("c", 4000);
59
60 echo "================== con1 marker ==================";
61
62 --connection default
63
64 # Wait for the payload to complete
65 let $wait_condition=
66 select count(*) = 1 from performance_schema.events_waits_current
67 where EVENT_NAME= 'idle';
68 --source include/wait_condition.inc
69
70 echo "================== Step 3 ==================";
71 --vertical_results
72 call dump_thread();
73 execute dump_memory_account;
74 execute dump_memory_user;
75 execute dump_memory_host;
76 execute dump_memory_global;
77 --horizontal_results
78 execute dump_accounts;
79 execute dump_users;
80 execute dump_hosts;
81
82 # Debugging helpers
83 # select * from performance_schema.events_waits_history_long;
84 # select PROCESSLIST_USER, PROCESSLIST_HOST, INSTRUMENTED from performance_schema.threads;
85
86 connect (con2, localhost, user2, , );
87
88 echo "================== con2 connected ==================";
89
90 --connection default
91
92 # Wait for the connect to complete
93 let $wait_condition=
94 select count(*) = 1 from performance_schema.threads
95 where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user2';
96 --source include/wait_condition.inc
97
98 echo "================== Step 4 ==================";
99 --vertical_results
100 call dump_thread();
101 execute dump_memory_account;
102 execute dump_memory_user;
103 execute dump_memory_host;
104 execute dump_memory_global;
105 --horizontal_results
106 execute dump_accounts;
107 execute dump_users;
108 execute dump_hosts;
109
110 --connection con2
111
112 select get_lock("marker_2", 10);
113 select release_lock("marker_2");
114 set @v1 = repeat("a", 1000);
115 set @v2 = repeat("b", 2000);
116 set @v3 = repeat("c", 4000);
117
118 echo "================== con2 marker ==================";
119
120 --connection default
121
122 # Wait for the payload to complete
123 let $wait_condition=
124 select count(*) = 2 from performance_schema.events_waits_current
125 where EVENT_NAME= 'idle';
126 --source include/wait_condition.inc
127
128 echo "================== Step 5 ==================";
129 --vertical_results
130 call dump_thread();
131 execute dump_memory_account;
132 execute dump_memory_user;
133 execute dump_memory_host;
134 execute dump_memory_global;
135 --horizontal_results
136 execute dump_accounts;
137 execute dump_users;
138 execute dump_hosts;
139
140 truncate table performance_schema.memory_summary_by_thread_by_event_name;
141
142 echo "================== MEMORY_BY_THREAD truncated ==================";
143
144 echo "================== Step 5b ==================";
145 --vertical_results
146 call dump_thread();
147 execute dump_memory_account;
148 execute dump_memory_user;
149 execute dump_memory_host;
150 execute dump_memory_global;
151 --horizontal_results
152 execute dump_accounts;
153 execute dump_users;
154 execute dump_hosts;
155
156 connect (con3, localhost, user3, , );
157
158 echo "================== con3 connected ==================";
159
160 --connection default
161
162 # Wait for the connect to complete
163 let $wait_condition=
164 select count(*) = 1 from performance_schema.threads
165 where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user3';
166 --source include/wait_condition.inc
167
168 echo "================== Step 6 ==================";
169 --vertical_results
170 call dump_thread();
171 execute dump_memory_account;
172 execute dump_memory_user;
173 execute dump_memory_host;
174 execute dump_memory_global;
175 --horizontal_results
176 execute dump_accounts;
177 execute dump_users;
178 execute dump_hosts;
179
180 --connection con3
181
182 select get_lock("marker_3", 10);
183 select release_lock("marker_3");
184 set @v1 = repeat("a", 1000);
185 set @v2 = repeat("b", 2000);
186 set @v3 = repeat("c", 4000);
187
188 echo "================== con3 marker ==================";
189
190 --connection default
191
192 # Wait for the payload to complete
193 let $wait_condition=
194 select count(*) = 3 from performance_schema.events_waits_current
195 where EVENT_NAME= 'idle';
196 --source include/wait_condition.inc
197
198 echo "================== Step 7 ==================";
199 --vertical_results
200 call dump_thread();
201 execute dump_memory_account;
202 execute dump_memory_user;
203 execute dump_memory_host;
204 execute dump_memory_global;
205 --horizontal_results
206 execute dump_accounts;
207 execute dump_users;
208 execute dump_hosts;
209
210 connect (con4, localhost, user4, , );
211 connect (con5, localhost, user4, , );
212
213 echo "================== con4/con5 (both user4) connected ==================";
214
215 --connection default
216
217 # Wait for the connects to complete
218 let $wait_condition=
219 select count(*) = 2 from performance_schema.threads
220 where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user4';
221 --source include/wait_condition.inc
222
223 echo "================== Step 8 ==================";
224 --vertical_results
225 call dump_thread();
226 execute dump_memory_account;
227 execute dump_memory_user;
228 execute dump_memory_host;
229 execute dump_memory_global;
230 --horizontal_results
231 execute dump_accounts;
232 execute dump_users;
233 execute dump_hosts;
234
235 --connection con4
236
237 select get_lock("marker_4", 10);
238 select release_lock("marker_4");
239 set @v1 = repeat("a", 1000);
240 set @v2 = repeat("b", 2000);
241 set @v3 = repeat("c", 4000);
242
243 --connection con5
244 select get_lock("marker_5", 10);
245 select release_lock("marker_5");
246 set @v1 = repeat("a", 1000);
247 set @v2 = repeat("b", 2000);
248 set @v3 = repeat("c", 4000);
249
250 echo "================== con4/con5 marker ==================";
251
252 --connection default
253
254 # Wait for the payload to complete
255 let $wait_condition=
256 select count(*) = 5 from performance_schema.events_waits_current
257 where EVENT_NAME= 'idle';
258 --source include/wait_condition.inc
259
260 echo "================== Step 9 ==================";
261 --vertical_results
262 call dump_thread();
263 execute dump_memory_account;
264 execute dump_memory_user;
265 execute dump_memory_host;
266 execute dump_memory_global;
267 --horizontal_results
268 execute dump_accounts;
269 execute dump_users;
270 execute dump_hosts;
271
272 --disconnect con1
273 --disconnect con5
274
275 --connection default
276
277 # Wait for the disconnects to complete
278 let $wait_condition=
279 select count(*) = 0 from performance_schema.threads
280 where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user1';
281 --source include/wait_condition.inc
282 let $wait_condition=
283 select count(*) = 1 from performance_schema.threads
284 where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user4';
285 --source include/wait_condition.inc
286
287 echo "================== con1/con5 disconnected ==================";
288
289 echo "================== Step 10 ==================";
290 --vertical_results
291 call dump_thread();
292 execute dump_memory_account;
293 execute dump_memory_user;
294 execute dump_memory_host;
295 execute dump_memory_global;
296 --horizontal_results
297 execute dump_accounts;
298 execute dump_users;
299 execute dump_hosts;
300
301 --disconnect con2
302
303 --connection default
304
305 # Wait for the disconnect to complete
306 let $wait_condition=
307 select count(*) = 0 from performance_schema.threads
308 where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user2';
309 --source include/wait_condition.inc
310
311 echo "================== con2 disconnected ==================";
312
313 echo "================== Step 11 ==================";
314 --vertical_results
315 call dump_thread();
316 execute dump_memory_account;
317 execute dump_memory_user;
318 execute dump_memory_host;
319 execute dump_memory_global;
320 --horizontal_results
321 execute dump_accounts;
322 execute dump_users;
323 execute dump_hosts;
324
325 --disconnect con3
326
327 --connection default
328
329 # Wait for the disconnect to complete
330 let $wait_condition=
331 select count(*) = 0 from performance_schema.threads
332 where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user3';
333 --source include/wait_condition.inc
334
335 echo "================== con3 disconnected ==================";
336
337 echo "================== Step 12 ==================";
338 --vertical_results
339 call dump_thread();
340 execute dump_memory_account;
341 execute dump_memory_user;
342 execute dump_memory_host;
343 execute dump_memory_global;
344 --horizontal_results
345 execute dump_accounts;
346 execute dump_users;
347 execute dump_hosts;
348
349 --disconnect con4
350
351 --connection default
352
353 # Wait for the disconnect to complete
354 let $wait_condition=
355 select count(*) = 0 from performance_schema.threads
356 where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user4';
357 --source include/wait_condition.inc
358
359 echo "================== con4 disconnected ==================";
360
361 echo "================== Step 13 ==================";
362 --vertical_results
363 call dump_thread();
364 execute dump_memory_account;
365 execute dump_memory_user;
366 execute dump_memory_host;
367 execute dump_memory_global;
368 --horizontal_results
369 execute dump_accounts;
370 execute dump_users;
371 execute dump_hosts;
372
373 --connection default
374
375 truncate performance_schema.memory_summary_by_thread_by_event_name;
376
377 echo "================== MEMORY_BY_THREAD truncated ==================";
378
379 echo "================== Step 14 ==================";
380 --vertical_results
381 call dump_thread();
382 execute dump_memory_account;
383 execute dump_memory_user;
384 execute dump_memory_host;
385 execute dump_memory_global;
386 --horizontal_results
387 execute dump_accounts;
388 execute dump_users;
389 execute dump_hosts;
390
391 truncate performance_schema.memory_summary_by_account_by_event_name;
392
393 echo "================== MEMORY_BY_ACCOUNT truncated ==================";
394
395 echo "================== Step 15 ==================";
396 --vertical_results
397 call dump_thread();
398 execute dump_memory_account;
399 execute dump_memory_user;
400 execute dump_memory_host;
401 execute dump_memory_global;
402 --horizontal_results
403 execute dump_accounts;
404 execute dump_users;
405 execute dump_hosts;
406
407 truncate performance_schema.memory_summary_by_user_by_event_name;
408
409 echo "================== MEMORY_BY_USER truncated ==================";
410
411 echo "================== Step 16 ==================";
412 --vertical_results
413 call dump_thread();
414 execute dump_memory_account;
415 execute dump_memory_user;
416 execute dump_memory_host;
417 execute dump_memory_global;
418 --horizontal_results
419 execute dump_accounts;
420 execute dump_users;
421 execute dump_hosts;
422
423 truncate performance_schema.memory_summary_by_host_by_event_name;
424
425 echo "================== MEMORY_BY_HOST truncated ==================";
426
427 echo "================== Step 17 ==================";
428 --vertical_results
429 call dump_thread();
430 execute dump_memory_account;
431 execute dump_memory_user;
432 execute dump_memory_host;
433 execute dump_memory_global;
434 --horizontal_results
435 execute dump_accounts;
436 execute dump_users;
437 execute dump_hosts;
438
439 truncate performance_schema.memory_summary_global_by_event_name;
440
441 echo "================== MEMORY_GLOBAL truncated ==================";
442
443 echo "================== Step 18 ==================";
444 --vertical_results
445 call dump_thread();
446 execute dump_memory_account;
447 execute dump_memory_user;
448 execute dump_memory_host;
449 execute dump_memory_global;
450 --horizontal_results
451 execute dump_accounts;
452 execute dump_users;
453 execute dump_hosts;
454
455 truncate performance_schema.accounts;
456
457 echo "================== ACCOUNTS truncated ==================";
458
459 echo "================== Step 19 ==================";
460 --vertical_results
461 call dump_thread();
462 execute dump_memory_account;
463 execute dump_memory_user;
464 execute dump_memory_host;
465 execute dump_memory_global;
466 --horizontal_results
467 execute dump_accounts;
468 execute dump_users;
469 execute dump_hosts;
470
471 truncate performance_schema.users;
472
473 echo "================== USERS truncated ==================";
474
475 echo "================== Step 20 ==================";
476 --vertical_results
477 call dump_thread();
478 execute dump_memory_account;
479 execute dump_memory_user;
480 execute dump_memory_host;
481 execute dump_memory_global;
482 --horizontal_results
483 execute dump_accounts;
484 execute dump_users;
485 execute dump_hosts;
486
487 truncate performance_schema.hosts;
488
489 echo "================== HOSTS truncated ==================";
490
491 echo "================== Step 21 ==================";
492 --vertical_results
493 call dump_thread();
494 execute dump_memory_account;
495 execute dump_memory_user;
496 execute dump_memory_host;
497 execute dump_memory_global;
498 --horizontal_results
499 execute dump_accounts;
500 execute dump_users;
501 execute dump_hosts;
502