30 #define MEMORY_CONTEXT_IDENT_DISPLAY_SIZE 1024
72 HTAB *context_id_lookup)
74 #define PG_GET_BACKEND_MEMORY_CONTEXTS_COLS 10
107 memset(nulls, 0,
sizeof(nulls));
116 if (
ident && strcmp(
name,
"dynahash") == 0)
129 int idlen = strlen(
ident);
139 memcpy(clipped_ident,
ident, idlen);
140 clipped_ident[idlen] =
'\0';
148 case T_AllocSetContext:
151 case T_GenerationContext:
189 HTAB *context_id_lookup;
195 context_id_lookup =
hash_create(
"pg_get_backend_memory_contexts",
293 (
errmsg(
"PID %d is not a PostgreSQL server process", pid)));
302 (
errmsg(
"could not send signal to process %d: %m", pid)));
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define Assert(condition)
void hash_destroy(HTAB *hashp)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
Datum Int64GetDatum(int64 X)
#define PG_GETARG_INT32(n)
#define PG_RETURN_BOOL(x)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
List * lcons_int(int datum, List *list)
List * lappend(List *list, void *datum)
void list_free(List *list)
int pg_mbcliplen(const char *mbstr, int len, int limit)
MemoryContext TopMemoryContext
MemoryContext CurrentMemoryContext
struct MemoryContextId MemoryContextId
static Datum int_list_to_array(const List *list)
static void PutMemoryContextsStatsTupleStore(Tuplestorestate *tupstore, TupleDesc tupdesc, MemoryContext context, HTAB *context_id_lookup)
Datum pg_log_backend_memory_contexts(PG_FUNCTION_ARGS)
#define PG_GET_BACKEND_MEMORY_CONTEXTS_COLS
#define MEMORY_CONTEXT_IDENT_DISPLAY_SIZE
Datum pg_get_backend_memory_contexts(PG_FUNCTION_ARGS)
#define MemoryContextIsValid(context)
static int list_length(const List *l)
#define foreach_current_index(var_or_cell)
#define foreach_ptr(type, var, lst)
#define foreach_int(var, lst)
static Datum PointerGetDatum(const void *X)
static Datum Int32GetDatum(int32 X)
#define GetNumberFromPGProc(proc)
PGPROC * BackendPidGetProc(int pid)
#define INVALID_PROC_NUMBER
int SendProcSignal(pid_t pid, ProcSignalReason reason, ProcNumber procNumber)
@ PROCSIG_LOG_MEMORY_CONTEXT
PGPROC * AuxiliaryPidGetProc(int pid)
Tuplestorestate * setResult
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)