Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 997afad

Browse files
committed
pgstat: introduce PgStat_Kind enum.
Will be used by following commits to generalize stats infrastructure. Kept separate to allow commits stand reasonably on their own. Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/20220404041516.cctrvpadhuriawlq@alap3.anarazel.de
1 parent 0d5c387 commit 997afad

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/include/pgstat.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,30 @@
3333
/* Default directory to store temporary statistics data in */
3434
#define PG_STAT_TMP_DIR "pg_stat_tmp"
3535

36+
/* The types of statistics entries */
37+
typedef enum PgStat_Kind
38+
{
39+
/* use 0 for INVALID, to catch zero-initialized data */
40+
PGSTAT_KIND_INVALID = 0,
41+
42+
/* stats for variable-numbered objects */
43+
PGSTAT_KIND_DATABASE, /* database-wide statistics */
44+
PGSTAT_KIND_RELATION, /* per-table statistics */
45+
PGSTAT_KIND_FUNCTION, /* per-function statistics */
46+
PGSTAT_KIND_REPLSLOT, /* per-slot statistics */
47+
PGSTAT_KIND_SUBSCRIPTION, /* per-subscription statistics */
48+
49+
/* stats for fixed-numbered objects */
50+
PGSTAT_KIND_ARCHIVER,
51+
PGSTAT_KIND_BGWRITER,
52+
PGSTAT_KIND_CHECKPOINTER,
53+
PGSTAT_KIND_SLRU,
54+
PGSTAT_KIND_WAL,
55+
} PgStat_Kind;
56+
57+
#define PGSTAT_KIND_FIRST_VALID PGSTAT_KIND_DATABASE
58+
#define PGSTAT_KIND_LAST PGSTAT_KIND_WAL
59+
#define PGSTAT_NUM_KINDS (PGSTAT_KIND_LAST + 1)
3660

3761
/* Values for track_functions GUC variable --- order is significant! */
3862
typedef enum TrackFunctionsLevel

src/tools/pgindent/typedefs.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,7 @@ PgStat_FunctionCallUsage
19421942
PgStat_FunctionCounts
19431943
PgStat_FunctionEntry
19441944
PgStat_GlobalStats
1945+
PgStat_Kind
19451946
PgStat_Msg
19461947
PgStat_MsgAnalyze
19471948
PgStat_MsgAnlAncestors

0 commit comments

Comments
 (0)