|
18 | 18 | #include "replication/conflict.h"
|
19 | 19 | #include "utils/backend_progress.h" /* for backward compatibility */
|
20 | 20 | #include "utils/backend_status.h" /* for backward compatibility */
|
| 21 | +#include "utils/pgstat_kind.h" |
21 | 22 | #include "utils/relcache.h"
|
22 | 23 | #include "utils/wait_event.h" /* for backward compatibility */
|
23 | 24 |
|
|
33 | 34 | /* Default directory to store temporary statistics data in */
|
34 | 35 | #define PG_STAT_TMP_DIR "pg_stat_tmp"
|
35 | 36 |
|
36 |
| -/* The types of statistics entries */ |
37 |
| -#define PgStat_Kind uint32 |
38 |
| - |
39 |
| -/* Range of IDs allowed, for built-in and custom kinds */ |
40 |
| -#define PGSTAT_KIND_MIN 1 /* Minimum ID allowed */ |
41 |
| -#define PGSTAT_KIND_MAX 256 /* Maximum ID allowed */ |
42 |
| - |
43 |
| -/* use 0 for INVALID, to catch zero-initialized data */ |
44 |
| -#define PGSTAT_KIND_INVALID 0 |
45 |
| - |
46 |
| -/* stats for variable-numbered objects */ |
47 |
| -#define PGSTAT_KIND_DATABASE 1 /* database-wide statistics */ |
48 |
| -#define PGSTAT_KIND_RELATION 2 /* per-table statistics */ |
49 |
| -#define PGSTAT_KIND_FUNCTION 3 /* per-function statistics */ |
50 |
| -#define PGSTAT_KIND_REPLSLOT 4 /* per-slot statistics */ |
51 |
| -#define PGSTAT_KIND_SUBSCRIPTION 5 /* per-subscription statistics */ |
52 |
| -#define PGSTAT_KIND_BACKEND 6 /* per-backend statistics */ |
53 |
| - |
54 |
| -/* stats for fixed-numbered objects */ |
55 |
| -#define PGSTAT_KIND_ARCHIVER 7 |
56 |
| -#define PGSTAT_KIND_BGWRITER 8 |
57 |
| -#define PGSTAT_KIND_CHECKPOINTER 9 |
58 |
| -#define PGSTAT_KIND_IO 10 |
59 |
| -#define PGSTAT_KIND_SLRU 11 |
60 |
| -#define PGSTAT_KIND_WAL 12 |
61 |
| - |
62 |
| -#define PGSTAT_KIND_BUILTIN_MIN PGSTAT_KIND_DATABASE |
63 |
| -#define PGSTAT_KIND_BUILTIN_MAX PGSTAT_KIND_WAL |
64 |
| -#define PGSTAT_KIND_BUILTIN_SIZE (PGSTAT_KIND_BUILTIN_MAX + 1) |
65 |
| - |
66 |
| -/* Custom stats kinds */ |
67 |
| - |
68 |
| -/* Range of IDs allowed for custom stats kinds */ |
69 |
| -#define PGSTAT_KIND_CUSTOM_MIN 128 |
70 |
| -#define PGSTAT_KIND_CUSTOM_MAX PGSTAT_KIND_MAX |
71 |
| -#define PGSTAT_KIND_CUSTOM_SIZE (PGSTAT_KIND_CUSTOM_MAX - PGSTAT_KIND_CUSTOM_MIN + 1) |
72 |
| - |
73 |
| -/* |
74 |
| - * PgStat_Kind to use for extensions that require an ID, but are still in |
75 |
| - * development and have not reserved their own unique kind ID yet. See: |
76 |
| - * https://wiki.postgresql.org/wiki/CustomCumulativeStats |
77 |
| - */ |
78 |
| -#define PGSTAT_KIND_EXPERIMENTAL 128 |
79 |
| - |
80 |
| -static inline bool |
81 |
| -pgstat_is_kind_builtin(PgStat_Kind kind) |
82 |
| -{ |
83 |
| - return kind >= PGSTAT_KIND_BUILTIN_MIN && kind <= PGSTAT_KIND_BUILTIN_MAX; |
84 |
| -} |
85 |
| - |
86 |
| -static inline bool |
87 |
| -pgstat_is_kind_custom(PgStat_Kind kind) |
88 |
| -{ |
89 |
| - return kind >= PGSTAT_KIND_CUSTOM_MIN && kind <= PGSTAT_KIND_CUSTOM_MAX; |
90 |
| -} |
91 |
| - |
92 | 37 | /* Values for track_functions GUC variable --- order is significant! */
|
93 | 38 | typedef enum TrackFunctionsLevel
|
94 | 39 | {
|
|
0 commit comments