MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pfs_visitor.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 Foundation,
14  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15 
16 #include "my_global.h"
17 #include "my_sys.h"
18 #include "pfs_visitor.h"
19 #include "pfs_instr.h"
20 #include "pfs_instr_class.h"
21 #include "pfs_user.h"
22 #include "pfs_host.h"
23 #include "pfs_account.h"
24 
36 void PFS_connection_iterator::visit_global(bool with_hosts, bool with_users,
37  bool with_accounts, bool with_threads,
38  PFS_connection_visitor *visitor)
39 {
40  DBUG_ASSERT(visitor != NULL);
41 
42  visitor->visit_global();
43 
44  if (with_hosts)
45  {
46  PFS_host *pfs= host_array;
47  PFS_host *pfs_last= pfs + host_max;
48  for ( ; pfs < pfs_last; pfs++)
49  {
50  if (pfs->m_lock.is_populated())
51  visitor->visit_host(pfs);
52  }
53  }
54 
55  if (with_users)
56  {
57  PFS_user *pfs= user_array;
58  PFS_user *pfs_last= pfs + user_max;
59  for ( ; pfs < pfs_last; pfs++)
60  {
61  if (pfs->m_lock.is_populated())
62  visitor->visit_user(pfs);
63  }
64  }
65 
66  if (with_accounts)
67  {
68  PFS_account *pfs= account_array;
69  PFS_account *pfs_last= pfs + account_max;
70  for ( ; pfs < pfs_last; pfs++)
71  {
72  if (pfs->m_lock.is_populated())
73  visitor->visit_account(pfs);
74  }
75  }
76 
77  if (with_threads)
78  {
80  PFS_thread *pfs_last= pfs + thread_max;
81  for ( ; pfs < pfs_last; pfs++)
82  {
83  if (pfs->m_lock.is_populated())
84  visitor->visit_thread(pfs);
85  }
86  }
87 }
88 
90  bool with_accounts, bool with_threads,
91  PFS_connection_visitor *visitor)
92 {
93  DBUG_ASSERT(visitor != NULL);
94 
95  visitor->visit_host(host);
96 
97  if (with_accounts)
98  {
99  PFS_account *pfs= account_array;
100  PFS_account *pfs_last= pfs + account_max;
101  for ( ; pfs < pfs_last; pfs++)
102  {
103  if ((pfs->m_host == host) && pfs->m_lock.is_populated())
104  {
105  visitor->visit_account(pfs);
106  }
107  }
108  }
109 
110  if (with_threads)
111  {
112  PFS_thread *pfs= thread_array;
113  PFS_thread *pfs_last= pfs + thread_max;
114  for ( ; pfs < pfs_last; pfs++)
115  {
116  if (pfs->m_lock.is_populated())
117  {
118  PFS_account *safe_account= sanitize_account(pfs->m_account);
119  if ((safe_account != NULL) && (safe_account->m_host == host))
120  {
121  /*
122  If the thread belongs to a known user@host that belongs to this host,
123  process it.
124  */
125  visitor->visit_thread(pfs);
126  }
127  else if (pfs->m_host == host)
128  {
129  /*
130  If the thread belongs to a 'lost' user@host that belong to this host,
131  process it.
132  */
133  visitor->visit_thread(pfs);
134  }
135  }
136  }
137  }
138 }
139 
141  bool with_accounts, bool with_threads,
142  PFS_connection_visitor *visitor)
143 {
144  DBUG_ASSERT(visitor != NULL);
145 
146  visitor->visit_user(user);
147 
148  if (with_accounts)
149  {
150  PFS_account *pfs= account_array;
151  PFS_account *pfs_last= pfs + account_max;
152  for ( ; pfs < pfs_last; pfs++)
153  {
154  if ((pfs->m_user == user) && pfs->m_lock.is_populated())
155  {
156  visitor->visit_account(pfs);
157  }
158  }
159  }
160 
161  if (with_threads)
162  {
163  PFS_thread *pfs= thread_array;
164  PFS_thread *pfs_last= pfs + thread_max;
165  for ( ; pfs < pfs_last; pfs++)
166  {
167  if (pfs->m_lock.is_populated())
168  {
169  PFS_account *safe_account= sanitize_account(pfs->m_account);
170  if ((safe_account != NULL) && (safe_account->m_user == user))
171  {
172  /*
173  If the thread belongs to a known user@host that belongs to this user,
174  process it.
175  */
176  visitor->visit_thread(pfs);
177  }
178  else if (pfs->m_user == user)
179  {
180  /*
181  If the thread belongs to a 'lost' user@host that belong to this user,
182  process it.
183  */
184  visitor->visit_thread(pfs);
185  }
186  }
187  }
188  }
189 }
190 
192  bool with_threads,
193  PFS_connection_visitor *visitor)
194 {
195  DBUG_ASSERT(visitor != NULL);
196 
197  visitor->visit_account(account);
198 
199  if (with_threads)
200  {
201  PFS_thread *pfs= thread_array;
202  PFS_thread *pfs_last= pfs + thread_max;
203  for ( ; pfs < pfs_last; pfs++)
204  {
205  if ((pfs->m_account == account) && pfs->m_lock.is_populated())
206  {
207  visitor->visit_thread(pfs);
208  }
209  }
210  }
211 }
212 
213 void PFS_instance_iterator::visit_all(PFS_instance_visitor *visitor)
214 {
215  visit_all_mutex(visitor);
216  visit_all_rwlock(visitor);
217  visit_all_cond(visitor);
218  visit_all_file(visitor);
219 }
220 
221 void PFS_instance_iterator::visit_all_mutex(PFS_instance_visitor *visitor)
222 {
223  visit_all_mutex_classes(visitor);
224  visit_all_mutex_instances(visitor);
225 }
226 
227 void PFS_instance_iterator::visit_all_mutex_classes(PFS_instance_visitor *visitor)
228 {
229  PFS_mutex_class *pfs= mutex_class_array;
230  PFS_mutex_class *pfs_last= pfs + mutex_class_max;
231  for ( ; pfs < pfs_last; pfs++)
232  {
233  if (pfs->m_name_length != 0)
234  {
235  visitor->visit_mutex_class(pfs);
236  }
237  }
238 }
239 
240 void PFS_instance_iterator::visit_all_mutex_instances(PFS_instance_visitor *visitor)
241 {
242  PFS_mutex *pfs= mutex_array;
243  PFS_mutex *pfs_last= pfs + mutex_max;
244  for ( ; pfs < pfs_last; pfs++)
245  {
246  if (pfs->m_lock.is_populated())
247  {
248  visitor->visit_mutex(pfs);
249  }
250  }
251 }
252 
253 void PFS_instance_iterator::visit_all_rwlock(PFS_instance_visitor *visitor)
254 {
255  visit_all_rwlock_classes(visitor);
256  visit_all_rwlock_instances(visitor);
257 }
258 
259 void PFS_instance_iterator::visit_all_rwlock_classes(PFS_instance_visitor *visitor)
260 {
261  PFS_rwlock_class *pfs= rwlock_class_array;
262  PFS_rwlock_class *pfs_last= pfs + rwlock_class_max;
263  for ( ; pfs < pfs_last; pfs++)
264  {
265  if (pfs->m_name_length != 0)
266  {
267  visitor->visit_rwlock_class(pfs);
268  }
269  }
270 }
271 
272 void PFS_instance_iterator::visit_all_rwlock_instances(PFS_instance_visitor *visitor)
273 {
274  PFS_rwlock *pfs= rwlock_array;
275  PFS_rwlock *pfs_last= pfs + rwlock_max;
276  for ( ; pfs < pfs_last; pfs++)
277  {
278  if (pfs->m_lock.is_populated())
279  {
280  visitor->visit_rwlock(pfs);
281  }
282  }
283 }
284 
285 void PFS_instance_iterator::visit_all_cond(PFS_instance_visitor *visitor)
286 {
287  visit_all_cond_classes(visitor);
288  visit_all_cond_instances(visitor);
289 }
290 
291 void PFS_instance_iterator::visit_all_cond_classes(PFS_instance_visitor *visitor)
292 {
293  PFS_cond_class *pfs= cond_class_array;
294  PFS_cond_class *pfs_last= pfs + cond_class_max;
295  for ( ; pfs < pfs_last; pfs++)
296  {
297  if (pfs->m_name_length != 0)
298  {
299  visitor->visit_cond_class(pfs);
300  }
301  }
302 }
303 
304 void PFS_instance_iterator::visit_all_cond_instances(PFS_instance_visitor *visitor)
305 {
306  PFS_cond *pfs= cond_array;
307  PFS_cond *pfs_last= pfs + cond_max;
308  for ( ; pfs < pfs_last; pfs++)
309  {
310  if (pfs->m_lock.is_populated())
311  {
312  visitor->visit_cond(pfs);
313  }
314  }
315 }
316 
317 void PFS_instance_iterator::visit_all_file(PFS_instance_visitor *visitor)
318 {
319  visit_all_file_classes(visitor);
320  visit_all_file_instances(visitor);
321 }
322 
323 void PFS_instance_iterator::visit_all_file_classes(PFS_instance_visitor *visitor)
324 {
325  PFS_file_class *pfs= file_class_array;
326  PFS_file_class *pfs_last= pfs + file_class_max;
327  for ( ; pfs < pfs_last; pfs++)
328  {
329  if (pfs->m_name_length != 0)
330  {
331  visitor->visit_file_class(pfs);
332  }
333  }
334 }
335 
336 void PFS_instance_iterator::visit_all_file_instances(PFS_instance_visitor *visitor)
337 {
338  PFS_file *pfs= file_array;
339  PFS_file *pfs_last= pfs + file_max;
340  for ( ; pfs < pfs_last; pfs++)
341  {
342  if (pfs->m_lock.is_populated())
343  {
344  visitor->visit_file(pfs);
345  }
346  }
347 }
348 
352  PFS_instance_visitor *visitor)
353 {
354  DBUG_ASSERT(visitor != NULL);
355 
356  visitor->visit_mutex_class(klass);
357 
358  if (klass->is_singleton())
359  {
360  PFS_mutex *pfs= sanitize_mutex(klass->m_singleton);
361  if (likely(pfs != NULL))
362  {
363  if (likely(pfs->m_lock.is_populated()))
364  {
365  visitor->visit_mutex(pfs);
366  }
367  }
368  }
369  else
370  {
371  PFS_mutex *pfs= mutex_array;
372  PFS_mutex *pfs_last= pfs + mutex_max;
373  for ( ; pfs < pfs_last; pfs++)
374  {
375  if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
376  {
377  visitor->visit_mutex(pfs);
378  }
379  }
380  }
381 }
382 
384  PFS_instance_visitor *visitor)
385 {
386  DBUG_ASSERT(visitor != NULL);
387 
388  visitor->visit_rwlock_class(klass);
389 
390  if (klass->is_singleton())
391  {
392  PFS_rwlock *pfs= sanitize_rwlock(klass->m_singleton);
393  if (likely(pfs != NULL))
394  {
395  if (likely(pfs->m_lock.is_populated()))
396  {
397  visitor->visit_rwlock(pfs);
398  }
399  }
400  }
401  else
402  {
403  PFS_rwlock *pfs= rwlock_array;
404  PFS_rwlock *pfs_last= pfs + rwlock_max;
405  for ( ; pfs < pfs_last; pfs++)
406  {
407  if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
408  {
409  visitor->visit_rwlock(pfs);
410  }
411  }
412  }
413 }
414 
416  PFS_instance_visitor *visitor)
417 {
418  DBUG_ASSERT(visitor != NULL);
419 
420  visitor->visit_cond_class(klass);
421 
422  if (klass->is_singleton())
423  {
424  PFS_cond *pfs= sanitize_cond(klass->m_singleton);
425  if (likely(pfs != NULL))
426  {
427  if (likely(pfs->m_lock.is_populated()))
428  {
429  visitor->visit_cond(pfs);
430  }
431  }
432  }
433  else
434  {
435  PFS_cond *pfs= cond_array;
436  PFS_cond *pfs_last= pfs + cond_max;
437  for ( ; pfs < pfs_last; pfs++)
438  {
439  if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
440  {
441  visitor->visit_cond(pfs);
442  }
443  }
444  }
445 }
446 
448  PFS_instance_visitor *visitor)
449 {
450  DBUG_ASSERT(visitor != NULL);
451 
452  visitor->visit_file_class(klass);
453 
454  if (klass->is_singleton())
455  {
456  PFS_file *pfs= sanitize_file(klass->m_singleton);
457  if (likely(pfs != NULL))
458  {
459  if (likely(pfs->m_lock.is_populated()))
460  {
461  visitor->visit_file(pfs);
462  }
463  }
464  }
465  else
466  {
467  PFS_file *pfs= file_array;
468  PFS_file *pfs_last= pfs + file_max;
469  for ( ; pfs < pfs_last; pfs++)
470  {
471  if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
472  {
473  visitor->visit_file(pfs);
474  }
475  }
476  }
477 }
478 
482  PFS_instance_visitor *visitor)
483 {
484  DBUG_ASSERT(visitor != NULL);
485 
486  visitor->visit_socket_class(klass);
487 
488  if (klass->is_singleton())
489  {
490  PFS_socket *pfs= sanitize_socket(klass->m_singleton);
491  if (likely(pfs != NULL))
492  {
493  if (likely(pfs->m_lock.is_populated()))
494  {
495  visitor->visit_socket(pfs);
496  }
497  }
498  }
499  else
500  {
501  PFS_socket *pfs= socket_array;
502  PFS_socket *pfs_last= pfs + socket_max;
503  for ( ; pfs < pfs_last; pfs++)
504  {
505  if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
506  {
507  visitor->visit_socket(pfs);
508  }
509  }
510  }
511 }
512 
516  PFS_instance_visitor *visitor,
517  PFS_thread *thread,
518  bool visit_class)
519 {
520  DBUG_ASSERT(visitor != NULL);
521  DBUG_ASSERT(thread != NULL);
522 
523  if (visit_class)
524  visitor->visit_socket_class(klass);
525 
526  if (klass->is_singleton())
527  {
528  PFS_socket *pfs= sanitize_socket(klass->m_singleton);
529  if (likely(pfs != NULL))
530  {
531  if (unlikely(pfs->m_thread_owner == thread))
532  visitor->visit_socket(pfs);
533  }
534  }
535  else
536  {
537  /* Get current socket stats from each socket instance owned by this thread */
538  PFS_socket *pfs= socket_array;
539  PFS_socket *pfs_last= pfs + socket_max;
540 
541  for ( ; pfs < pfs_last; pfs++)
542  {
543  if (unlikely((pfs->m_class == klass) &&
544  (pfs->m_thread_owner == thread)))
545  {
546  visitor->visit_socket(pfs);
547  }
548  }
549  }
550 }
551 
555  PFS_instance_visitor *visitor,
556  PFS_thread *thread,
557  bool visit_class)
558 {
559  DBUG_ASSERT(visitor != NULL);
560  DBUG_ASSERT(klass != NULL);
561 
562  switch (klass->m_type)
563  {
564  case PFS_CLASS_SOCKET:
565  {
566  PFS_socket_class *socket_class= reinterpret_cast<PFS_socket_class*>(klass);
567  PFS_instance_iterator::visit_socket_instances(socket_class, visitor,
568  thread, visit_class);
569  }
570  break;
571  default:
572  break;
573  }
574 }
575 
578 {
579  visit_all_tables(visitor);
580 }
581 
583 {
584  DBUG_ASSERT(visitor != NULL);
585 
586  visitor->visit_global();
587 
588  /* For all the table shares ... */
591  for ( ; share < share_last; share++)
592  {
593  if (share->m_lock.is_populated())
594  {
595  visitor->visit_table_share(share);
596  }
597  }
598 
599  /* For all the table handles ... */
601  PFS_table *table_last= table_array + table_max;
602  for ( ; table < table_last; table++)
603  {
604  if (table->m_lock.is_populated())
605  {
606  visitor->visit_table(table);
607  }
608  }
609 }
610 
612  PFS_object_visitor *visitor)
613 {
614  DBUG_ASSERT(visitor != NULL);
615 
616  visitor->visit_table_share(share);
617 
618  /* For all the table handles ... */
620  PFS_table *table_last= table_array + table_max;
621  for ( ; table < table_last; table++)
622  {
623  if ((table->m_share == share) && table->m_lock.is_populated())
624  {
625  visitor->visit_table(table);
626  }
627  }
628 }
629 
631  uint index,
632  PFS_object_visitor *visitor)
633 {
634  DBUG_ASSERT(visitor != NULL);
635 
636  visitor->visit_table_share_index(share, index);
637 
638  /* For all the table handles ... */
640  PFS_table *table_last= table_array + table_max;
641  for ( ; table < table_last; table++)
642  {
643  if ((table->m_share == share) && table->m_lock.is_populated())
644  {
645  visitor->visit_table_index(table, index);
646  }
647  }
648 }
649 
654 {
655  m_index= klass->m_event_name_index;
656 }
657 
658 PFS_connection_wait_visitor::~PFS_connection_wait_visitor()
659 {}
660 
662 {
663  /*
664  This visitor is used only for idle instruments.
665  For waits, do not sum by connection but by instances,
666  it is more efficient.
667  */
669  m_stat.aggregate(& global_idle_stat);
670 }
671 
673 {
674  m_stat.aggregate(& pfs->m_instr_class_waits_stats[m_index]);
675 }
676 
678 {
679  m_stat.aggregate(& pfs->m_instr_class_waits_stats[m_index]);
680 }
681 
683 {
684  m_stat.aggregate(& pfs->m_instr_class_waits_stats[m_index]);
685 }
686 
688 {
689  m_stat.aggregate(& pfs->m_instr_class_waits_stats[m_index]);
690 }
691 
694 {}
695 
696 PFS_connection_all_wait_visitor::~PFS_connection_all_wait_visitor()
697 {}
698 
700 {
701  /* Sum by instances, not by connection */
702  DBUG_ASSERT(false);
703 }
704 
705 void PFS_connection_all_wait_visitor::visit_connection_slice(PFS_connection_slice *pfs)
706 {
708  PFS_single_stat *stat_last= stat + wait_class_max;
709  for ( ; stat < stat_last; stat++)
710  {
711  m_stat.aggregate(stat);
712  }
713 }
714 
716 {
717  visit_connection_slice(pfs);
718 }
719 
721 {
722  visit_connection_slice(pfs);
723 }
724 
726 {
727  visit_connection_slice(pfs);
728 }
729 
731 {
732  visit_connection_slice(pfs);
733 }
734 
736 {
737  m_index= klass->m_event_name_index;
738 }
739 
740 PFS_connection_stage_visitor::~PFS_connection_stage_visitor()
741 {}
742 
744 {
745  m_stat.aggregate(& global_instr_class_stages_array[m_index]);
746 }
747 
749 {
750  m_stat.aggregate(& pfs->m_instr_class_stages_stats[m_index]);
751 }
752 
754 {
755  m_stat.aggregate(& pfs->m_instr_class_stages_stats[m_index]);
756 }
757 
759 {
760  m_stat.aggregate(& pfs->m_instr_class_stages_stats[m_index]);
761 }
762 
764 {
765  m_stat.aggregate(& pfs->m_instr_class_stages_stats[m_index]);
766 }
767 
770 {
771  m_index= klass->m_event_name_index;
772 }
773 
774 PFS_connection_statement_visitor::~PFS_connection_statement_visitor()
775 {}
776 
778 {
779  m_stat.aggregate(& global_instr_class_statements_array[m_index]);
780 }
781 
783 {
784  m_stat.aggregate(& pfs->m_instr_class_statements_stats[m_index]);
785 }
786 
788 {
789  m_stat.aggregate(& pfs->m_instr_class_statements_stats[m_index]);
790 }
791 
793 {
794  m_stat.aggregate(& pfs->m_instr_class_statements_stats[m_index]);
795 }
796 
798 {
799  m_stat.aggregate(& pfs->m_instr_class_statements_stats[m_index]);
800 }
801 
805 {}
806 
807 PFS_connection_all_statement_visitor::~PFS_connection_all_statement_visitor()
808 {}
809 
811 {
812  PFS_statement_stat *stat= global_instr_class_statements_array;
813  PFS_statement_stat *stat_last= stat + statement_class_max;
814  for ( ; stat < stat_last; stat++)
815  {
816  m_stat.aggregate(stat);
817  }
818 }
819 
820 void PFS_connection_all_statement_visitor::visit_connection_slice(PFS_connection_slice *pfs)
821 {
823  PFS_statement_stat *stat_last= stat + statement_class_max;
824  for ( ; stat < stat_last; stat++)
825  {
826  m_stat.aggregate(stat);
827  }
828 }
829 
831 {
832  visit_connection_slice(pfs);
833 }
834 
836 {
837  visit_connection_slice(pfs);
838 }
839 
841 {
842  visit_connection_slice(pfs);
843 }
844 
846 {
847  visit_connection_slice(pfs);
848 }
849 
851 {}
852 
853 PFS_connection_stat_visitor::~PFS_connection_stat_visitor()
854 {}
855 
857 {}
858 
860 {
861  m_stat.aggregate_disconnected(pfs->m_disconnected_count);
862 }
863 
865 {
866  m_stat.aggregate_disconnected(pfs->m_disconnected_count);
867 }
868 
870 {
871  m_stat.aggregate_disconnected(pfs->m_disconnected_count);
872 }
873 
875 {
876  m_stat.aggregate_active(1);
877 }
878 
879 PFS_instance_wait_visitor::PFS_instance_wait_visitor()
880 {
881 }
882 
883 PFS_instance_wait_visitor::~PFS_instance_wait_visitor()
884 {}
885 
887 {
888  m_stat.aggregate(&pfs->m_mutex_stat.m_wait_stat);
889 }
890 
892 {
893  m_stat.aggregate(&pfs->m_rwlock_stat.m_wait_stat);
894 }
895 
897 {
898  m_stat.aggregate(&pfs->m_cond_stat.m_wait_stat);
899 }
900 
902 {
903  pfs->m_file_stat.m_io_stat.sum_waits(&m_stat);
904 }
905 
907 {
908  pfs->m_socket_stat.m_io_stat.sum_waits(&m_stat);
909 }
910 
912 {
913  m_stat.aggregate(& pfs->m_mutex_stat.m_wait_stat);
914 }
915 
917 {
918  m_stat.aggregate(& pfs->m_rwlock_stat.m_wait_stat);
919 }
920 
922 {
923  m_stat.aggregate(& pfs->m_cond_stat.m_wait_stat);
924 }
925 
927 {
928  /* Combine per-operation file wait stats before aggregating */
929  PFS_single_stat stat;
930  pfs->m_file_stat.m_io_stat.sum_waits(&stat);
931  m_stat.aggregate(&stat);
932 }
933 
935 {
936  /* Combine per-operation socket wait stats before aggregating */
937  PFS_single_stat stat;
938  pfs->m_socket_stat.m_io_stat.sum_waits(&stat);
939  m_stat.aggregate(&stat);
940 }
941 
945 {}
946 
947 PFS_object_wait_visitor::~PFS_object_wait_visitor()
948 {}
949 
951 {
954 }
955 
957 {
958  uint safe_key_count= sanitize_index_count(pfs->m_key_count);
959  pfs->m_table_stat.sum(& m_stat, safe_key_count);
960 }
961 
963 {
964  PFS_table_share *table_share= sanitize_table_share(pfs->m_share);
965  if (table_share != NULL)
966  {
967  uint safe_key_count= sanitize_index_count(table_share->m_key_count);
968  pfs->m_table_stat.sum(& m_stat, safe_key_count);
969  }
970 }
971 
972 PFS_table_io_wait_visitor::PFS_table_io_wait_visitor()
973 {}
974 
975 PFS_table_io_wait_visitor::~PFS_table_io_wait_visitor()
976 {}
977 
979 {
981 }
982 
984 {
985  PFS_table_io_stat io_stat;
986  uint safe_key_count= sanitize_index_count(pfs->m_key_count);
987  uint index;
988 
989  /* Aggregate index stats */
990  for (index= 0; index < safe_key_count; index++)
991  io_stat.aggregate(& pfs->m_table_stat.m_index_stat[index]);
992 
993  /* Aggregate global stats */
994  io_stat.aggregate(& pfs->m_table_stat.m_index_stat[MAX_INDEXES]);
995 
996  io_stat.sum(& m_stat);
997 }
998 
1000 {
1001  PFS_table_share *safe_share= sanitize_table_share(pfs->m_share);
1002 
1003  if (likely(safe_share != NULL))
1004  {
1005  PFS_table_io_stat io_stat;
1006  uint safe_key_count= sanitize_index_count(safe_share->m_key_count);
1007  uint index;
1008 
1009  /* Aggregate index stats */
1010  for (index= 0; index < safe_key_count; index++)
1011  io_stat.aggregate(& pfs->m_table_stat.m_index_stat[index]);
1012 
1013  /* Aggregate global stats */
1014  io_stat.aggregate(& pfs->m_table_stat.m_index_stat[MAX_INDEXES]);
1015 
1016  io_stat.sum(& m_stat);
1017  }
1018 }
1019 
1023 {}
1024 
1025 PFS_table_io_stat_visitor::~PFS_table_io_stat_visitor()
1026 {}
1027 
1029 {
1030  uint safe_key_count= sanitize_index_count(pfs->m_key_count);
1031  uint index;
1032 
1033  /* Aggregate index stats */
1034  for (index= 0; index < safe_key_count; index++)
1035  m_stat.aggregate(& pfs->m_table_stat.m_index_stat[index]);
1036 
1037  /* Aggregate global stats */
1038  m_stat.aggregate(& pfs->m_table_stat.m_index_stat[MAX_INDEXES]);
1039 }
1040 
1042 {
1043  PFS_table_share *safe_share= sanitize_table_share(pfs->m_share);
1044 
1045  if (likely(safe_share != NULL))
1046  {
1047  uint safe_key_count= sanitize_index_count(safe_share->m_key_count);
1048  uint index;
1049 
1050  /* Aggregate index stats */
1051  for (index= 0; index < safe_key_count; index++)
1052  m_stat.aggregate(& pfs->m_table_stat.m_index_stat[index]);
1053 
1054  /* Aggregate global stats */
1055  m_stat.aggregate(& pfs->m_table_stat.m_index_stat[MAX_INDEXES]);
1056  }
1057 }
1058 
1062 {}
1063 
1064 PFS_index_io_stat_visitor::~PFS_index_io_stat_visitor()
1065 {}
1066 
1068 {
1069  m_stat.aggregate(& pfs->m_table_stat.m_index_stat[index]);
1070 }
1071 
1073 {
1074  m_stat.aggregate(& pfs->m_table_stat.m_index_stat[index]);
1075 }
1076 
1080 {}
1081 
1082 PFS_table_lock_wait_visitor::~PFS_table_lock_wait_visitor()
1083 {}
1084 
1086 {
1088 }
1089 
1091 {
1092  pfs->m_table_stat.sum_lock(& m_stat);
1093 }
1094 
1096 {
1097  pfs->m_table_stat.sum_lock(& m_stat);
1098 }
1099 
1103 {}
1104 
1105 PFS_table_lock_stat_visitor::~PFS_table_lock_stat_visitor()
1106 {}
1107 
1109 {
1110  m_stat.aggregate(& pfs->m_table_stat.m_lock_stat);
1111 }
1112 
1114 {
1115  m_stat.aggregate(& pfs->m_table_stat.m_lock_stat);
1116 }
1117 
1118 PFS_instance_socket_io_stat_visitor::PFS_instance_socket_io_stat_visitor()
1119 {}
1120 
1121 PFS_instance_socket_io_stat_visitor::~PFS_instance_socket_io_stat_visitor()
1122 {}
1123 
1125 {
1126  /* Aggregate wait times, event counts and byte counts */
1127  m_socket_io_stat.aggregate(&pfs->m_socket_stat.m_io_stat);
1128 }
1129 
1131 {
1132  /* Aggregate wait times, event counts and byte counts */
1133  m_socket_io_stat.aggregate(&pfs->m_socket_stat.m_io_stat);
1134 }
1135 
1136 
1137 PFS_instance_file_io_stat_visitor::PFS_instance_file_io_stat_visitor()
1138 {}
1139 
1140 PFS_instance_file_io_stat_visitor::~PFS_instance_file_io_stat_visitor()
1141 {}
1142 
1144 {
1145  /* Aggregate wait times, event counts and byte counts */
1146  m_file_io_stat.aggregate(&pfs->m_file_stat.m_io_stat);
1147 }
1148 
1150 {
1151  /* Aggregate wait times, event counts and byte counts */
1152  m_file_io_stat.aggregate(&pfs->m_file_stat.m_io_stat);
1153 }