-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathpg_stat_kcache.h
69 lines (62 loc) · 2.12 KB
/
pg_stat_kcache.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef PGSK_H_
#define PGSK_H_
#define PG_STAT_KCACHE_COLS_V2_0 7
#define PG_STAT_KCACHE_COLS_V2_1 15
#define PG_STAT_KCACHE_COLS_V2_2 28
#define PG_STAT_KCACHE_COLS_V2_3 29
#define PG_STAT_KCACHE_COLS 29 /* maximum of above */
/* ru_inblock block size is 512 bytes with Linux
* see http://lkml.indiana.edu/hypermail/linux/kernel/0703.2/0937.html
*/
#define RUSAGE_BLOCK_SIZE 512 /* Size of a block for getrusage() */
/*
* Current getrusage counters.
*
* For platform without getrusage support, we rely on postgres implementation
* defined in rusagestub.h, which only supports user and system time.
*
* Note that the following counters are not maintained on GNU/Linux:
* - ru_nswap
* - ru_msgsnd
* - ru_msgrcv
* - ru_nsignals
*/
typedef struct pgskCounters
{
double usage; /* usage factor */
/* These fields are always used */
float8 utime; /* CPU user time */
float8 stime; /* CPU system time */
#ifdef HAVE_GETRUSAGE
/* These fields are only used for platform with HAVE_GETRUSAGE defined */
int64 minflts; /* page reclaims (soft page faults) */
int64 majflts; /* page faults (hard page faults) */
int64 nswaps; /* swaps */
int64 reads; /* Physical block reads */
int64 writes; /* Physical block writes */
int64 msgsnds; /* IPC messages sent */
int64 msgrcvs; /* IPC messages received */
int64 nsignals; /* signals received */
int64 nvcsws; /* voluntary context witches */
int64 nivcsws; /* unvoluntary context witches */
#endif
} pgskCounters;
typedef enum pgskStoreKind
{
/*
* PGSS_PLAN and PGSS_EXEC must be respectively 0 and 1 as they're used to
* reference the underlying values in the arrays in the Counters struct,
* and this order is required in pg_stat_statements_internal().
*/
PGSK_PLAN = 0,
PGSK_EXEC,
PGSK_NUMKIND /* Must be last value of this enum */
} pgskStoreKind;
/* Hook for extensions to use pgskCounters right after calculation. */
typedef void (*pgsk_counters_hook_type) (
pgskCounters *counters,
const char *query_string,
int level,
pgskStoreKind kind);
extern PGDLLIMPORT pgsk_counters_hook_type pgsk_counters_hook;
#endif