30 #define MEMORY_CONTEXT_IDENT_DISPLAY_SIZE 1024
49 const char **
const ident)
58 if (
ident && strcmp(*
name,
"dynahash") == 0)
94 HTAB *context_id_lookup)
96 #define PG_GET_BACKEND_MEMORY_CONTEXTS_COLS 11
129 memset(nulls, 0,
sizeof(nulls));
140 int idlen = strlen(
ident);
150 memcpy(clipped_ident,
ident, idlen);
151 clipped_ident[idlen] =
'\0';
159 const char *parent_name,
171 case T_AllocSetContext:
174 case T_GenerationContext:
212 HTAB *context_id_lookup;
218 context_id_lookup =
hash_create(
"pg_get_backend_memory_contexts",
316 (
errmsg(
"PID %d is not a PostgreSQL server process", pid)));
325 (
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 void get_memory_context_name_and_ident(MemoryContext context, const char **const name, const char **const ident)
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)