MySQL 8.0.29
Source Code Documentation
pfs_stat.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
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, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef PFS_STAT_H
24#define PFS_STAT_H
25
26#include <assert.h>
27#include <algorithm>
28#include <atomic>
29
30#include "my_sys.h"
31#include "my_systime.h"
32#include "sql/sql_const.h"
35/* memcpy */
36#include "string.h"
37
39
40/**
41 @file storage/perfschema/pfs_stat.h
42 Statistics (declarations).
43*/
44
45/**
46 @addtogroup performance_schema_buffers
47 @{
48*/
49
50/** Single statistic. */
52 /** Count of values. */
54 /** Sum of values. */
56 /** Minimum value. */
58 /** Maximum value. */
60
62 m_count = 0;
63 m_sum = 0;
64 m_min = ULLONG_MAX;
65 m_max = 0;
66 }
67
68 inline void reset(void) {
69 m_count = 0;
70 m_sum = 0;
71 m_min = ULLONG_MAX;
72 m_max = 0;
73 }
74
75 inline bool has_timed_stats() const { return (m_min <= m_max); }
76
77 inline void aggregate(const PFS_single_stat *stat) {
78 if (stat->m_count != 0) {
79 m_count += stat->m_count;
80 m_sum += stat->m_sum;
81 if (unlikely(m_min > stat->m_min)) {
82 m_min = stat->m_min;
83 }
84 if (unlikely(m_max < stat->m_max)) {
85 m_max = stat->m_max;
86 }
87 }
88 }
89
90 inline void aggregate_no_check(const PFS_single_stat *stat) {
91 m_count += stat->m_count;
92 m_sum += stat->m_sum;
93 if (unlikely(m_min > stat->m_min)) {
94 m_min = stat->m_min;
95 }
96 if (unlikely(m_max < stat->m_max)) {
97 m_max = stat->m_max;
98 }
99 }
100
101 inline void aggregate_counted() { m_count++; }
102
104
105 inline void aggregate_value(ulonglong value) {
106 m_count++;
107 m_sum += value;
108 if (unlikely(m_min > value)) {
109 m_min = value;
110 }
111 if (unlikely(m_max < value)) {
112 m_max = value;
113 }
114 }
115
117 m_count += count;
118 m_sum += value;
119 if (unlikely(m_min > value)) {
120 m_min = value;
121 }
122 if (unlikely(m_max < value)) {
123 m_max = value;
124 }
125 }
126};
127
128/** Combined statistic. */
130 /** Byte count statistics */
132
133 /** Aggregate wait stats, event count and byte count */
134 inline void aggregate(const PFS_byte_stat *stat) {
135 if (stat->m_count != 0) {
137 m_bytes += stat->m_bytes;
138 }
139 }
140
141 /** Aggregate wait stats, event count and byte count */
142 inline void aggregate_no_check(const PFS_byte_stat *stat) {
144 m_bytes += stat->m_bytes;
145 }
146
147 /** Aggregate individual wait time, event count and byte count */
148 inline void aggregate(ulonglong wait, ulonglong bytes) {
150 m_bytes += bytes;
151 }
152
153 /** Aggregate wait stats and event count */
154 inline void aggregate_waits(const PFS_byte_stat *stat) {
156 }
157
158 /** Aggregate event count and byte count */
160
161 /** Aggregate event count and byte count */
162 inline void aggregate_counted(ulonglong bytes) {
164 m_bytes += bytes;
165 }
166
168
169 inline void reset(void) {
171 m_bytes = 0;
172 }
173};
174
175/** Statistics for mutex usage. */
177 /** Wait statistics. */
179#ifdef PFS_LATER
180 /**
181 Lock statistics.
182 This statistic is not exposed in user visible tables yet.
183 */
184 PFS_single_stat m_lock_stat;
185#endif
186
187 inline void aggregate(const PFS_mutex_stat *stat) {
189#ifdef PFS_LATER
190 m_lock_stat.aggregate(&stat->m_lock_stat);
191#endif
192 }
193
194 inline void reset(void) {
196#ifdef PFS_LATER
197 m_lock_stat.reset();
198#endif
199 }
200};
201
202/** Statistics for rwlock usage. */
204 /** Wait statistics. */
206#ifdef PFS_LATER
207 /**
208 RWLock read lock usage statistics.
209 This statistic is not exposed in user visible tables yet.
210 */
211 PFS_single_stat m_read_lock_stat;
212 /**
213 RWLock write lock usage statistics.
214 This statistic is not exposed in user visible tables yet.
215 */
216 PFS_single_stat m_write_lock_stat;
217#endif
218
219 inline void aggregate(const PFS_rwlock_stat *stat) {
221#ifdef PFS_LATER
222 m_read_lock_stat.aggregate(&stat->m_read_lock_stat);
223 m_write_lock_stat.aggregate(&stat->m_write_lock_stat);
224#endif
225 }
226
227 inline void reset(void) {
229#ifdef PFS_LATER
230 m_read_lock_stat.reset();
231 m_write_lock_stat.reset();
232#endif
233 }
234};
235
236/** Statistics for conditions usage. */
238 /** Wait statistics. */
240#ifdef PFS_LATER
241 /**
242 Number of times a condition was signalled.
243 This statistic is not exposed in user visible tables yet.
244 */
245 ulonglong m_signal_count;
246 /**
247 Number of times a condition was broadcast.
248 This statistic is not exposed in user visible tables yet.
249 */
250 ulonglong m_broadcast_count;
251#endif
252
253 inline void aggregate(const PFS_cond_stat *stat) {
255#ifdef PFS_LATER
256 m_signal_count += stat->m_signal_count;
257 m_broadcast_count += stat->m_broadcast_count;
258#endif
259 }
260
261 inline void reset(void) {
263#ifdef PFS_LATER
264 m_signal_count = 0;
265 m_broadcast_count = 0;
266#endif
267 }
268};
269
270/** Statistics for FILE I/O. Used for both waits and byte counts. */
272 /** READ statistics */
274 /** WRITE statistics */
276 /** Miscellaneous statistics */
278
279 inline void reset(void) {
280 m_read.reset();
281 m_write.reset();
282 m_misc.reset();
283 }
284
285 inline void aggregate(const PFS_file_io_stat *stat) {
286 m_read.aggregate(&stat->m_read);
287 m_write.aggregate(&stat->m_write);
288 m_misc.aggregate(&stat->m_misc);
289 }
290
291 /* Sum waits and byte counts */
292 inline void sum(PFS_byte_stat *stat) {
293 stat->aggregate(&m_read);
294 stat->aggregate(&m_write);
295 stat->aggregate(&m_misc);
296 }
297
298 /* Sum waits only */
299 inline void sum_waits(PFS_single_stat *stat) {
300 stat->aggregate(&m_read);
301 stat->aggregate(&m_write);
302 stat->aggregate(&m_misc);
303 }
304};
305
306/** Statistics for FILE usage. */
308 /** Number of current open handles. */
310 /** File I/O statistics. */
312
313 inline void aggregate(const PFS_file_stat *stat) {
315 }
316
317 /** Reset file statistics. */
318 inline void reset(void) { m_io_stat.reset(); }
319};
320
321/** Statistics for stage usage. */
324
325 inline void reset(void) { m_timer1_stat.reset(); }
326
328
329 inline void aggregate_value(ulonglong value) {
331 }
332
333 inline void aggregate(const PFS_stage_stat *stat) {
335 }
336};
337
338/** Statistics for stored program usage. */
341
342 inline void reset(void) { m_timer1_stat.reset(); }
343
345
346 inline void aggregate_value(ulonglong value) {
348 }
349
350 inline void aggregate(const PFS_stage_stat *stat) {
352 }
353};
354
355/** Statistics for prepared statement usage. */
358
359 inline void reset(void) { m_timer1_stat.reset(); }
360
362
363 inline void aggregate_value(ulonglong value) {
365 }
366
367 inline void aggregate(PFS_stage_stat *stat) {
369 }
370};
371
372/**
373 Statistics for statement usage.
374*/
396 /**
397 CPU TIME.
398 Expressed in STORAGE units (nanoseconds).
399 */
402
403 void reset() { new (this) PFS_statement_stat(); }
404
406
409 }
410
411 void aggregate(const PFS_statement_stat *stat) {
412 if (stat->m_timer1_stat.m_count != 0) {
414
418 m_lock_time += stat->m_lock_time;
419 m_rows_sent += stat->m_rows_sent;
429 m_sort_range += stat->m_sort_range;
430 m_sort_rows += stat->m_sort_rows;
431 m_sort_scan += stat->m_sort_scan;
434 m_cpu_time += stat->m_cpu_time;
436 }
437 }
438};
439
440/** Statistics for transaction usage. */
444
448
453 }
454
457 }
458
459 inline void reset(void) {
465 }
466
467 inline void aggregate(const PFS_transaction_stat *stat) {
473 }
474};
475
476/** Statistics for a server error. */
480 /** First and last seen timestamps.*/
483
485 m_count = 0;
486 m_handled_count = 0;
487 m_first_seen = 0;
488 m_last_seen = 0;
489 }
490
491 ulonglong count(void) { return m_count; }
492
493 inline void reset() {
494 m_count = 0;
495 m_handled_count = 0;
496 m_first_seen = 0;
497 m_last_seen = 0;
498 }
499
500 inline void aggregate_count(int error_operation) {
502 if (m_first_seen == 0) {
504 }
505
506 switch (error_operation) {
508 m_count++;
509 break;
512 m_count--;
513 break;
514 default:
515 /* It must not be reached. */
516 assert(0);
517 break;
518 }
519 }
520
521 inline void aggregate(const PFS_error_single_stat *stat) {
522 if (stat->m_count == 0 && stat->m_handled_count == 0) {
523 return;
524 }
525
526 m_count += stat->m_count;
528
529 if (m_first_seen == 0 || stat->m_first_seen < m_first_seen) {
531 }
532 if (stat->m_last_seen > m_last_seen) {
533 m_last_seen = stat->m_last_seen;
534 }
535 }
536};
537
538/** Statistics for all server errors. */
540 /** The number of errors, including +1 for the NULL row. */
543
545
546 const PFS_error_single_stat *get_stat(uint error_index) const {
547 return &m_stat[error_index];
548 }
549
551 ulonglong total = 0;
552 for (uint i = 0; i < m_max_errors; i++) {
553 total += m_stat[i].count();
554 }
555 return total;
556 }
557
558 ulonglong count(uint error_index) { return m_stat[error_index].count(); }
559
560 inline void init(PFS_builtin_memory_class *memory_class, size_t max_errors) {
561 if (max_errors == 0) {
562 return;
563 }
564
565 m_max_errors = max_errors;
566 /* Allocate memory for errors' stats. The NULL row is already included. */
567 m_stat = PFS_MALLOC_ARRAY(memory_class, m_max_errors,
568 sizeof(PFS_error_single_stat),
570 reset();
571 }
572
573 inline void cleanup(PFS_builtin_memory_class *memory_class) {
574 if (m_stat == nullptr) {
575 return;
576 }
577
579 m_stat);
580 m_stat = nullptr;
581 }
582
583 inline void reset() {
584 if (m_stat == nullptr) {
585 return;
586 }
587
588 for (uint i = 0; i < m_max_errors; i++) {
589 m_stat[i].reset();
590 }
591 }
592
593 inline void aggregate_count(int error_index, int error_operation) {
594 if (m_stat == nullptr) {
595 return;
596 }
597
598 PFS_error_single_stat *stat = &m_stat[error_index];
599 stat->aggregate_count(error_operation);
600 }
601
602 inline void aggregate(const PFS_error_single_stat *stat, uint error_index) {
603 if (m_stat == nullptr) {
604 return;
605 }
606
607 assert(error_index < m_max_errors);
608 m_stat[error_index].aggregate(stat);
609 }
610
611 inline void aggregate(const PFS_error_stat *stat) {
612 if (m_stat == nullptr) {
613 return;
614 }
615
616 /*
617 Sizes can be different, for example when aggregating
618 per session statistics into global statistics.
619 */
620 size_t common_max = std::min(m_max_errors, stat->m_max_errors);
621 for (uint i = 0; i < common_max; i++) {
622 m_stat[i].aggregate(&stat->m_stat[i]);
623 }
624 }
625};
626
627/** Single table I/O statistic. */
630 /** FETCH statistics */
632 /** INSERT statistics */
634 /** UPDATE statistics */
636 /** DELETE statistics */
638
640
641 inline void reset(void) {
642 m_has_data = false;
643 m_fetch.reset();
644 m_insert.reset();
645 m_update.reset();
646 m_delete.reset();
647 }
648
649 inline void aggregate(const PFS_table_io_stat *stat) {
650 if (stat->m_has_data) {
651 m_has_data = true;
652 m_fetch.aggregate(&stat->m_fetch);
656 }
657 }
658
659 inline void sum(PFS_single_stat *result) {
660 if (m_has_data) {
661 result->aggregate(&m_fetch);
662 result->aggregate(&m_insert);
663 result->aggregate(&m_update);
664 result->aggregate(&m_delete);
665 }
666 }
667};
668
670 /* Locks from enum thr_lock */
679
680 /* Locks for handler::ha_external_lock() */
683
684 PFS_TL_NONE = 99
686
687#define COUNT_PFS_TL_LOCK_TYPE 10
688
689/** Statistics for table locks. */
692
693 inline void reset(void) {
696 for (; pfs < pfs_last; pfs++) {
697 pfs->reset();
698 }
699 }
700
701 inline void aggregate(const PFS_table_lock_stat *stat) {
704 const PFS_single_stat *pfs_from = &stat->m_stat[0];
705 for (; pfs < pfs_last; pfs++, pfs_from++) {
706 pfs->aggregate(pfs_from);
707 }
708 }
709
710 inline void sum(PFS_single_stat *result) {
713 for (; pfs < pfs_last; pfs++) {
714 result->aggregate(pfs);
715 }
716 }
717};
718
719/** Statistics for TABLE usage. */
721 /**
722 Statistics, per index.
723 Each index stat is in [0, MAX_INDEXES-1],
724 stats when using no index are in [MAX_INDEXES].
725 */
727
728 /**
729 Statistics, per lock type.
730 */
732
733 /** Reset table I/O statistic. */
734 inline void reset_io(void) {
736 PFS_table_io_stat *stat_last = &m_index_stat[MAX_INDEXES + 1];
737 for (; stat < stat_last; stat++) {
738 stat->reset();
739 }
740 }
741
742 /** Reset table lock statistic. */
743 inline void reset_lock(void) { m_lock_stat.reset(); }
744
745 /** Reset table statistic. */
746 inline void reset(void) {
747 reset_io();
748 reset_lock();
749 }
750
751 inline void fast_reset_io(void) {
753 }
754
755 inline void fast_reset_lock(void) {
757 }
758
759 inline void fast_reset(void) {
760 memcpy(this, &g_reset_template, sizeof(*this));
761 }
762
763 inline void aggregate_io(const PFS_table_stat *stat, uint key_count) {
764 PFS_table_io_stat *to_stat;
765 PFS_table_io_stat *to_stat_last;
766 const PFS_table_io_stat *from_stat;
767
768 assert(key_count <= MAX_INDEXES);
769
770 /* Aggregate stats for each index, if any */
771 to_stat = &m_index_stat[0];
772 to_stat_last = to_stat + key_count;
773 from_stat = &stat->m_index_stat[0];
774 for (; to_stat < to_stat_last; from_stat++, to_stat++) {
775 to_stat->aggregate(from_stat);
776 }
777
778 /* Aggregate stats for the table */
779 to_stat = &m_index_stat[MAX_INDEXES];
780 from_stat = &stat->m_index_stat[MAX_INDEXES];
781 to_stat->aggregate(from_stat);
782 }
783
784 inline void aggregate_lock(const PFS_table_stat *stat) {
786 }
787
788 inline void aggregate(const PFS_table_stat *stat, uint key_count) {
789 aggregate_io(stat, key_count);
790 aggregate_lock(stat);
791 }
792
793 inline void sum_io(PFS_single_stat *result, uint key_count) {
794 PFS_table_io_stat *stat;
795 PFS_table_io_stat *stat_last;
796
797 assert(key_count <= MAX_INDEXES);
798
799 /* Sum stats for each index, if any */
800 stat = &m_index_stat[0];
801 stat_last = stat + key_count;
802 for (; stat < stat_last; stat++) {
803 stat->sum(result);
804 }
805
806 /* Sum stats for the table */
808 }
809
811
812 inline void sum(PFS_single_stat *result, uint key_count) {
813 sum_io(result, key_count);
815 }
816
818};
819
820/** Statistics for SOCKET I/O. Used for both waits and byte counts. */
822 /** READ statistics */
824 /** WRITE statistics */
826 /** Miscellaneous statistics */
828
829 inline void reset(void) {
830 m_read.reset();
831 m_write.reset();
832 m_misc.reset();
833 }
834
835 inline void aggregate(const PFS_socket_io_stat *stat) {
836 m_read.aggregate(&stat->m_read);
837 m_write.aggregate(&stat->m_write);
838 m_misc.aggregate(&stat->m_misc);
839 }
840
841 /* Sum waits and byte counts */
842 inline void sum(PFS_byte_stat *stat) {
843 stat->aggregate(&m_read);
844 stat->aggregate(&m_write);
845 stat->aggregate(&m_misc);
846 }
847
848 /* Sum waits only */
849 inline void sum_waits(PFS_single_stat *stat) {
850 stat->aggregate(&m_read);
851 stat->aggregate(&m_write);
852 stat->aggregate(&m_misc);
853 }
854};
855
856/** Statistics for SOCKET usage. */
858 /** Socket timing and byte count statistics per operation */
860
861 /** Reset socket statistics. */
862 inline void reset(void) { m_io_stat.reset(); }
863};
864
868};
869
873};
874
875/**
876 Memory statistics.
877 Conceptually, the following statistics are maintained:
878 - CURRENT_COUNT_USED,
879 - LOW_COUNT_USED,
880 - HIGH_COUNT_USED
881 - CURRENT_SIZE_USED,
882 - LOW_SIZE_USED,
883 - HIGH_SIZE_USED
884 Now, the implementation keeps different counters,
885 which are easier (less overhead) to maintain while
886 collecting statistics.
887 Invariants are as follows:
888 CURRENT_COUNT_USED = @c m_alloc_count - @c m_free_count
889 LOW_COUNT_USED + @c m_free_count_capacity = CURRENT_COUNT_USED
890 CURRENT_COUNT_USED + @c m_alloc_count_capacity = HIGH_COUNT_USED
891 CURRENT_SIZE_USED = @c m_alloc_size - @c m_free_size
892 LOW_SIZE_USED + @c m_free_size_capacity = CURRENT_SIZE_USED
893 CURRENT_SIZE_USED + @c m_alloc_size_capacity = HIGH_SIZE_USED
894*/
896 bool m_used;
897
902
907
908 void reset(void);
909
910 void rebase(void);
911
914
917};
918
920 std::atomic<bool> m_used;
921
922 std::atomic<size_t> m_alloc_count;
923 std::atomic<size_t> m_free_count;
924 std::atomic<size_t> m_alloc_size;
925 std::atomic<size_t> m_free_size;
926
927 std::atomic<size_t> m_alloc_count_capacity;
928 std::atomic<size_t> m_free_count_capacity;
929 std::atomic<size_t> m_alloc_size_capacity;
930 std::atomic<size_t> m_free_size_capacity;
931
932 void reset();
933
934 void rebase();
935
936 void count_builtin_alloc(size_t size);
937
938 void count_builtin_free(size_t size);
939
940 inline void count_global_alloc(size_t size) { count_builtin_alloc(size); }
941
942 inline void count_global_free(size_t size) { count_builtin_free(size); }
943
946
949
950 /**
951 Expand the high water marks.
952 @param [in] delta High watermark increments to apply
953 @param [in] delta_buffer Working buffer
954 @return High watermark increments to carry to the parent if any, or
955nullptr.
956 */
958 const PFS_memory_stat_alloc_delta *delta,
959 PFS_memory_stat_alloc_delta *delta_buffer);
960
961 /**
962 Expand the low water marks.
963 @param [in] delta Low watermark decrements to apply
964 @param [in] delta_buffer Working buffer
965 @return Low watermark decrements to carry to the parent if any, or
966nullptr.
967 */
969 const PFS_memory_stat_free_delta *delta,
970 PFS_memory_stat_free_delta *delta_buffer);
971};
972
978
983
986
991
992 void reset(void);
993
994 void normalize(bool global);
995};
996
999
1002
1005 PFS_memory_shared_stat *stat2);
1006
1009 PFS_memory_shared_stat *stat2);
1010
1011/**
1012 Aggregate thread memory statistics to the parent bucket.
1013 Also, reassign net memory contributed by this thread
1014 to the global bucket.
1015 This is necessary to balance globally allocations done by one
1016 thread with deallocations done by another thread.
1017*/
1020 PFS_memory_shared_stat *global);
1021
1025 PFS_memory_shared_stat *global);
1026
1029
1032
1035 PFS_memory_shared_stat *stat2);
1036
1039
1042
1043/** Connections statistics. */
1046
1049
1050 inline void aggregate_active(ulonglong active) {
1051 m_current_connections += active;
1052 m_total_connections += active;
1053 }
1054
1055 inline void aggregate_disconnected(ulonglong disconnected) {
1056 m_total_connections += disconnected;
1057 }
1058};
1059
1060/** @} */
1061#endif
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
#define MY_ZEROFILL
Definition: my_sys.h:135
void count_builtin_free(size_t size)
Definition: pfs_stat.cc:200
void normalize(bool global)
Definition: pfs_stat.cc:401
void memory_monitoring_aggregate(const PFS_memory_safe_stat *from, PFS_memory_monitoring_stat *stat)
Definition: pfs_stat.cc:956
void rebase(void)
Definition: pfs_stat.cc:49
PFS_memory_stat_alloc_delta * apply_alloc_delta(const PFS_memory_stat_alloc_delta *delta, PFS_memory_stat_alloc_delta *delta_buffer)
Definition: pfs_stat.cc:295
PFS_memory_stat_free_delta * count_free(size_t size, PFS_memory_stat_free_delta *delta)
Definition: pfs_stat.cc:262
void reset(void)
Definition: pfs_stat.cc:381
void memory_partial_aggregate(PFS_memory_safe_stat *from, PFS_memory_shared_stat *stat)
Definition: pfs_stat.cc:432
PFS_TL_LOCK_TYPE
Definition: pfs_stat.h:669
PFS_memory_stat_alloc_delta * count_alloc(size_t size, PFS_memory_stat_alloc_delta *delta)
Definition: pfs_stat.cc:70
void memory_full_aggregate(const PFS_memory_safe_stat *from, PFS_memory_shared_stat *stat)
Definition: pfs_stat.cc:873
PFS_memory_stat_free_delta * apply_free_delta(const PFS_memory_stat_free_delta *delta, PFS_memory_stat_free_delta *delta_buffer)
Definition: pfs_stat.cc:338
void count_builtin_alloc(size_t size)
Definition: pfs_stat.cc:171
void reset(void)
Definition: pfs_stat.cc:35
void rebase()
Definition: pfs_stat.cc:150
#define COUNT_PFS_TL_LOCK_TYPE
Definition: pfs_stat.h:687
PFS_memory_stat_free_delta * count_free(size_t size, PFS_memory_stat_free_delta *delta)
Definition: pfs_stat.cc:103
void memory_full_aggregate_with_reassign(const PFS_memory_safe_stat *from, PFS_memory_shared_stat *stat, PFS_memory_shared_stat *global)
Aggregate thread memory statistics to the parent bucket.
Definition: pfs_stat.cc:664
PFS_memory_stat_alloc_delta * count_alloc(size_t size, PFS_memory_stat_alloc_delta *delta)
Definition: pfs_stat.cc:229
void reset()
Definition: pfs_stat.cc:136
@ PFS_TL_READ_EXTERNAL
Definition: pfs_stat.h:681
@ PFS_TL_READ_NO_INSERT
Definition: pfs_stat.h:674
@ PFS_TL_WRITE_LOW_PRIORITY
Definition: pfs_stat.h:677
@ PFS_TL_READ
Definition: pfs_stat.h:671
@ PFS_TL_WRITE_EXTERNAL
Definition: pfs_stat.h:682
@ PFS_TL_READ_HIGH_PRIORITY
Definition: pfs_stat.h:673
@ PFS_TL_WRITE_ALLOW_WRITE
Definition: pfs_stat.h:675
@ PFS_TL_WRITE
Definition: pfs_stat.h:678
@ PFS_TL_NONE
Definition: pfs_stat.h:684
@ PFS_TL_READ_WITH_SHARED_LOCKS
Definition: pfs_stat.h:672
@ PFS_TL_WRITE_CONCURRENT_INSERT
Definition: pfs_stat.h:676
@ PSI_ERROR_OPERATION_HANDLED
Definition: psi_error_bits.h:37
@ PSI_ERROR_OPERATION_RAISED
Definition: psi_error_bits.h:36
#define MAX_INDEXES
Definition: config.h:209
constexpr bool unlikely(bool expr)
Definition: my_compiler.h:55
unsigned long long int ulonglong
Definition: my_inttypes.h:55
#define MYF(v)
Definition: my_inttypes.h:96
Common header for many mysys elements.
Defines for getting and processing the current system type programmatically.
unsigned long long int my_micro_time()
Return time in microseconds.
Definition: my_systime.h:181
static int count
Definition: myisam_ftdump.cc:42
Type total(const Shards< COUNT > &shards) noexcept
Get the total value of all shards.
Definition: ut0counter.h:332
stdx::expected< size_t, std::error_code > wait(int epfd, epoll_event *fd_events, size_t num_fd_events, std::chrono::milliseconds timeout)
Definition: linux_epoll.h:82
server error instrument data structures (declarations).
Miscellaneous global dependencies (declarations).
#define PFS_MALLOC_ARRAY(k, n, s, T, f)
Helper, to allocate an array of structures.
Definition: pfs_global.h:120
#define PFS_FREE_ARRAY(k, n, s, p)
Helper, to free an array of structures.
Definition: pfs_global.h:137
File containing constants that can be used throughout the server.
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:65
Definition: pfs_builtin_memory.h:38
Combined statistic.
Definition: pfs_stat.h:129
PFS_byte_stat()
Definition: pfs_stat.h:167
void reset(void)
Definition: pfs_stat.h:169
ulonglong m_bytes
Byte count statistics.
Definition: pfs_stat.h:131
void aggregate_waits(const PFS_byte_stat *stat)
Aggregate wait stats and event count.
Definition: pfs_stat.h:154
void aggregate_no_check(const PFS_byte_stat *stat)
Aggregate wait stats, event count and byte count.
Definition: pfs_stat.h:142
void aggregate_counted(ulonglong bytes)
Aggregate event count and byte count.
Definition: pfs_stat.h:162
void aggregate_counted()
Aggregate event count and byte count.
Definition: pfs_stat.h:159
void aggregate(ulonglong wait, ulonglong bytes)
Aggregate individual wait time, event count and byte count.
Definition: pfs_stat.h:148
void aggregate(const PFS_byte_stat *stat)
Aggregate wait stats, event count and byte count.
Definition: pfs_stat.h:134
Statistics for conditions usage.
Definition: pfs_stat.h:237
void aggregate(const PFS_cond_stat *stat)
Definition: pfs_stat.h:253
void reset(void)
Definition: pfs_stat.h:261
PFS_single_stat m_wait_stat
Wait statistics.
Definition: pfs_stat.h:239
Connections statistics.
Definition: pfs_stat.h:1044
PFS_connection_stat()
Definition: pfs_stat.h:1045
ulonglong m_current_connections
Definition: pfs_stat.h:1047
void aggregate_active(ulonglong active)
Definition: pfs_stat.h:1050
void aggregate_disconnected(ulonglong disconnected)
Definition: pfs_stat.h:1055
ulonglong m_total_connections
Definition: pfs_stat.h:1048
Statistics for a server error.
Definition: pfs_stat.h:477
ulonglong m_last_seen
Definition: pfs_stat.h:482
void aggregate_count(int error_operation)
Definition: pfs_stat.h:500
ulonglong m_count
Definition: pfs_stat.h:478
PFS_error_single_stat()
Definition: pfs_stat.h:484
ulonglong m_handled_count
Definition: pfs_stat.h:479
ulonglong count(void)
Definition: pfs_stat.h:491
ulonglong m_first_seen
First and last seen timestamps.
Definition: pfs_stat.h:481
void reset()
Definition: pfs_stat.h:493
void aggregate(const PFS_error_single_stat *stat)
Definition: pfs_stat.h:521
Statistics for all server errors.
Definition: pfs_stat.h:539
void aggregate(const PFS_error_stat *stat)
Definition: pfs_stat.h:611
const PFS_error_single_stat * get_stat(uint error_index) const
Definition: pfs_stat.h:546
ulonglong count(void)
Definition: pfs_stat.h:550
ulonglong count(uint error_index)
Definition: pfs_stat.h:558
void aggregate_count(int error_index, int error_operation)
Definition: pfs_stat.h:593
PFS_error_single_stat * m_stat
Definition: pfs_stat.h:542
PFS_error_stat()
Definition: pfs_stat.h:544
void init(PFS_builtin_memory_class *memory_class, size_t max_errors)
Definition: pfs_stat.h:560
void aggregate(const PFS_error_single_stat *stat, uint error_index)
Definition: pfs_stat.h:602
void reset()
Definition: pfs_stat.h:583
size_t m_max_errors
The number of errors, including +1 for the NULL row.
Definition: pfs_stat.h:541
void cleanup(PFS_builtin_memory_class *memory_class)
Definition: pfs_stat.h:573
Statistics for FILE I/O.
Definition: pfs_stat.h:271
void sum_waits(PFS_single_stat *stat)
Definition: pfs_stat.h:299
PFS_byte_stat m_read
READ statistics.
Definition: pfs_stat.h:273
void sum(PFS_byte_stat *stat)
Definition: pfs_stat.h:292
PFS_byte_stat m_write
WRITE statistics.
Definition: pfs_stat.h:275
void aggregate(const PFS_file_io_stat *stat)
Definition: pfs_stat.h:285
PFS_byte_stat m_misc
Miscellaneous statistics.
Definition: pfs_stat.h:277
void reset(void)
Definition: pfs_stat.h:279
Statistics for FILE usage.
Definition: pfs_stat.h:307
ulong m_open_count
Number of current open handles.
Definition: pfs_stat.h:309
void reset(void)
Reset file statistics.
Definition: pfs_stat.h:318
PFS_file_io_stat m_io_stat
File I/O statistics.
Definition: pfs_stat.h:311
void aggregate(const PFS_file_stat *stat)
Definition: pfs_stat.h:313
Definition: pfs_stat.h:973
size_t m_alloc_count
Definition: pfs_stat.h:974
size_t m_free_count_capacity
Definition: pfs_stat.h:980
size_t m_free_size
Definition: pfs_stat.h:977
size_t m_free_count
Definition: pfs_stat.h:975
size_t m_missing_free_size_capacity
Definition: pfs_stat.h:985
ssize_t m_high_size_used
Definition: pfs_stat.h:990
size_t m_alloc_count_capacity
Definition: pfs_stat.h:979
size_t m_alloc_size
Definition: pfs_stat.h:976
size_t m_missing_free_count_capacity
Definition: pfs_stat.h:984
size_t m_alloc_size_capacity
Definition: pfs_stat.h:981
size_t m_free_size_capacity
Definition: pfs_stat.h:982
ssize_t m_low_count_used
Definition: pfs_stat.h:987
ssize_t m_low_size_used
Definition: pfs_stat.h:989
ssize_t m_high_count_used
Definition: pfs_stat.h:988
Memory statistics.
Definition: pfs_stat.h:895
size_t m_free_count
Definition: pfs_stat.h:899
size_t m_free_size_capacity
Definition: pfs_stat.h:906
size_t m_alloc_count_capacity
Definition: pfs_stat.h:903
size_t m_alloc_size
Definition: pfs_stat.h:900
size_t m_free_count_capacity
Definition: pfs_stat.h:904
bool m_used
Definition: pfs_stat.h:896
size_t m_alloc_count
Definition: pfs_stat.h:898
size_t m_alloc_size_capacity
Definition: pfs_stat.h:905
size_t m_free_size
Definition: pfs_stat.h:901
Definition: pfs_stat.h:919
std::atomic< size_t > m_free_size_capacity
Definition: pfs_stat.h:930
std::atomic< size_t > m_free_count
Definition: pfs_stat.h:923
std::atomic< size_t > m_free_count_capacity
Definition: pfs_stat.h:928
std::atomic< size_t > m_free_size
Definition: pfs_stat.h:925
void count_global_free(size_t size)
Definition: pfs_stat.h:942
std::atomic< size_t > m_alloc_count_capacity
Definition: pfs_stat.h:927
void count_global_alloc(size_t size)
Definition: pfs_stat.h:940
std::atomic< size_t > m_alloc_size
Definition: pfs_stat.h:924
std::atomic< size_t > m_alloc_count
Definition: pfs_stat.h:922
std::atomic< bool > m_used
Definition: pfs_stat.h:920
std::atomic< size_t > m_alloc_size_capacity
Definition: pfs_stat.h:929
Definition: pfs_stat.h:865
size_t m_alloc_count_delta
Definition: pfs_stat.h:866
size_t m_alloc_size_delta
Definition: pfs_stat.h:867
Definition: pfs_stat.h:870
size_t m_free_size_delta
Definition: pfs_stat.h:872
size_t m_free_count_delta
Definition: pfs_stat.h:871
Statistics for mutex usage.
Definition: pfs_stat.h:176
PFS_single_stat m_wait_stat
Wait statistics.
Definition: pfs_stat.h:178
void reset(void)
Definition: pfs_stat.h:194
void aggregate(const PFS_mutex_stat *stat)
Definition: pfs_stat.h:187
Statistics for prepared statement usage.
Definition: pfs_stat.h:356
void reset(void)
Definition: pfs_stat.h:359
PFS_single_stat m_timer1_stat
Definition: pfs_stat.h:357
void aggregate_value(ulonglong value)
Definition: pfs_stat.h:363
void aggregate_counted()
Definition: pfs_stat.h:361
void aggregate(PFS_stage_stat *stat)
Definition: pfs_stat.h:367
Statistics for rwlock usage.
Definition: pfs_stat.h:203
void aggregate(const PFS_rwlock_stat *stat)
Definition: pfs_stat.h:219
PFS_single_stat m_wait_stat
Wait statistics.
Definition: pfs_stat.h:205
void reset(void)
Definition: pfs_stat.h:227
Single statistic.
Definition: pfs_stat.h:51
void aggregate_counted()
Definition: pfs_stat.h:101
void aggregate_value(ulonglong value)
Definition: pfs_stat.h:105
void aggregate(const PFS_single_stat *stat)
Definition: pfs_stat.h:77
void aggregate_many_value(ulonglong value, ulonglong count)
Definition: pfs_stat.h:116
PFS_single_stat()
Definition: pfs_stat.h:61
ulonglong m_count
Count of values.
Definition: pfs_stat.h:53
ulonglong m_max
Maximum value.
Definition: pfs_stat.h:59
void aggregate_counted(ulonglong count)
Definition: pfs_stat.h:103
ulonglong m_min
Minimum value.
Definition: pfs_stat.h:57
void reset(void)
Definition: pfs_stat.h:68
bool has_timed_stats() const
Definition: pfs_stat.h:75
void aggregate_no_check(const PFS_single_stat *stat)
Definition: pfs_stat.h:90
ulonglong m_sum
Sum of values.
Definition: pfs_stat.h:55
Statistics for SOCKET I/O.
Definition: pfs_stat.h:821
void sum(PFS_byte_stat *stat)
Definition: pfs_stat.h:842
void aggregate(const PFS_socket_io_stat *stat)
Definition: pfs_stat.h:835
void sum_waits(PFS_single_stat *stat)
Definition: pfs_stat.h:849
PFS_byte_stat m_read
READ statistics.
Definition: pfs_stat.h:823
PFS_byte_stat m_misc
Miscellaneous statistics.
Definition: pfs_stat.h:827
PFS_byte_stat m_write
WRITE statistics.
Definition: pfs_stat.h:825
void reset(void)
Definition: pfs_stat.h:829
Statistics for SOCKET usage.
Definition: pfs_stat.h:857
PFS_socket_io_stat m_io_stat
Socket timing and byte count statistics per operation.
Definition: pfs_stat.h:859
void reset(void)
Reset socket statistics.
Definition: pfs_stat.h:862
Statistics for stored program usage.
Definition: pfs_stat.h:339
void aggregate_value(ulonglong value)
Definition: pfs_stat.h:346
PFS_single_stat m_timer1_stat
Definition: pfs_stat.h:340
void reset(void)
Definition: pfs_stat.h:342
void aggregate(const PFS_stage_stat *stat)
Definition: pfs_stat.h:350
void aggregate_counted()
Definition: pfs_stat.h:344
Statistics for stage usage.
Definition: pfs_stat.h:322
void aggregate(const PFS_stage_stat *stat)
Definition: pfs_stat.h:333
PFS_single_stat m_timer1_stat
Definition: pfs_stat.h:323
void aggregate_value(ulonglong value)
Definition: pfs_stat.h:329
void reset(void)
Definition: pfs_stat.h:325
void aggregate_counted()
Definition: pfs_stat.h:327
Statistics for statement usage.
Definition: pfs_stat.h:375
ulonglong m_sort_range
Definition: pfs_stat.h:391
void aggregate_value(ulonglong value)
Definition: pfs_stat.h:407
ulonglong m_select_range_check
Definition: pfs_stat.h:388
ulonglong m_select_scan
Definition: pfs_stat.h:389
ulonglong m_no_good_index_used
Definition: pfs_stat.h:395
ulonglong m_sort_rows
Definition: pfs_stat.h:392
ulonglong m_lock_time
Definition: pfs_stat.h:380
ulonglong m_created_tmp_disk_tables
Definition: pfs_stat.h:383
ulonglong m_select_range
Definition: pfs_stat.h:387
void aggregate_counted()
Definition: pfs_stat.h:405
void reset()
Definition: pfs_stat.h:403
ulonglong m_cpu_time
CPU TIME.
Definition: pfs_stat.h:400
ulonglong m_count_secondary
Definition: pfs_stat.h:401
ulonglong m_sort_scan
Definition: pfs_stat.h:393
ulonglong m_select_full_range_join
Definition: pfs_stat.h:386
ulonglong m_select_full_join
Definition: pfs_stat.h:385
ulonglong m_rows_examined
Definition: pfs_stat.h:382
ulonglong m_warning_count
Definition: pfs_stat.h:378
ulonglong m_rows_affected
Definition: pfs_stat.h:379
PFS_single_stat m_timer1_stat
Definition: pfs_stat.h:376
void aggregate(const PFS_statement_stat *stat)
Definition: pfs_stat.h:411
ulonglong m_created_tmp_tables
Definition: pfs_stat.h:384
ulonglong m_error_count
Definition: pfs_stat.h:377
ulonglong m_no_index_used
Definition: pfs_stat.h:394
ulonglong m_sort_merge_passes
Definition: pfs_stat.h:390
ulonglong m_rows_sent
Definition: pfs_stat.h:381
Single table I/O statistic.
Definition: pfs_stat.h:628
PFS_table_io_stat()
Definition: pfs_stat.h:639
void sum(PFS_single_stat *result)
Definition: pfs_stat.h:659
PFS_single_stat m_insert
INSERT statistics.
Definition: pfs_stat.h:633
bool m_has_data
Definition: pfs_stat.h:629
PFS_single_stat m_fetch
FETCH statistics.
Definition: pfs_stat.h:631
PFS_single_stat m_delete
DELETE statistics.
Definition: pfs_stat.h:637
PFS_single_stat m_update
UPDATE statistics.
Definition: pfs_stat.h:635
void reset(void)
Definition: pfs_stat.h:641
void aggregate(const PFS_table_io_stat *stat)
Definition: pfs_stat.h:649
Statistics for table locks.
Definition: pfs_stat.h:690
void sum(PFS_single_stat *result)
Definition: pfs_stat.h:710
void aggregate(const PFS_table_lock_stat *stat)
Definition: pfs_stat.h:701
PFS_single_stat m_stat[COUNT_PFS_TL_LOCK_TYPE]
Definition: pfs_stat.h:691
void reset(void)
Definition: pfs_stat.h:693
Statistics for TABLE usage.
Definition: pfs_stat.h:720
void reset_lock(void)
Reset table lock statistic.
Definition: pfs_stat.h:743
void aggregate_lock(const PFS_table_stat *stat)
Definition: pfs_stat.h:784
void reset(void)
Reset table statistic.
Definition: pfs_stat.h:746
void fast_reset_io(void)
Definition: pfs_stat.h:751
void aggregate_io(const PFS_table_stat *stat, uint key_count)
Definition: pfs_stat.h:763
PFS_table_lock_stat m_lock_stat
Statistics, per lock type.
Definition: pfs_stat.h:731
PFS_table_io_stat m_index_stat[MAX_INDEXES+1]
Statistics, per index.
Definition: pfs_stat.h:726
void reset_io(void)
Reset table I/O statistic.
Definition: pfs_stat.h:734
void fast_reset_lock(void)
Definition: pfs_stat.h:755
static struct PFS_table_stat g_reset_template
Definition: pfs_stat.h:817
void sum(PFS_single_stat *result, uint key_count)
Definition: pfs_stat.h:812
void sum_io(PFS_single_stat *result, uint key_count)
Definition: pfs_stat.h:793
void aggregate(const PFS_table_stat *stat, uint key_count)
Definition: pfs_stat.h:788
void sum_lock(PFS_single_stat *result)
Definition: pfs_stat.h:810
void fast_reset(void)
Definition: pfs_stat.h:759
Statistics for transaction usage.
Definition: pfs_stat.h:441
ulonglong m_release_savepoint_count
Definition: pfs_stat.h:447
ulonglong m_savepoint_count
Definition: pfs_stat.h:445
ulonglong count(void)
Definition: pfs_stat.h:455
PFS_transaction_stat()
Definition: pfs_stat.h:449
PFS_single_stat m_read_write_stat
Definition: pfs_stat.h:442
PFS_single_stat m_read_only_stat
Definition: pfs_stat.h:443
void reset(void)
Definition: pfs_stat.h:459
ulonglong m_rollback_to_savepoint_count
Definition: pfs_stat.h:446
void aggregate(const PFS_transaction_stat *stat)
Definition: pfs_stat.h:467
Definition: result.h:29
unsigned int uint
Definition: uca-dump.cc:29