summaryrefslogtreecommitdiffstats
path: root/src/include/access/xlogstats.h
blob: 89410ce92b8e96608718d23940f49557bc6d2d0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*-------------------------------------------------------------------------
 *
 * xlogstats.h
 *		Definitions for WAL Statitstics
 *
 * Copyright (c) 2022-2023, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
 *		src/include/access/xlogstats.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef XLOGSTATS_H
#define XLOGSTATS_H

#include "access/rmgr.h"
#include "access/xlogreader.h"

#define MAX_XLINFO_TYPES 16

typedef struct XLogRecStats
{
	uint64		count;
	uint64		rec_len;
	uint64		fpi_len;
} XLogRecStats;

typedef struct XLogStats
{
	uint64		count;
#ifdef FRONTEND
	XLogRecPtr	startptr;
	XLogRecPtr	endptr;
#endif
	XLogRecStats rmgr_stats[RM_MAX_ID + 1];
	XLogRecStats record_stats[RM_MAX_ID + 1][MAX_XLINFO_TYPES];
} XLogStats;

extern void XLogRecGetLen(XLogReaderState *record, uint32 *rec_len,
						  uint32 *fpi_len);
extern void XLogRecStoreStats(XLogStats *stats, XLogReaderState *record);

#endif							/* XLOGSTATS_H */