PostgreSQL Source Code git master
|
#include "postgres.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "access/twophase.h"
#include "catalog/pg_authid_d.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/acl.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/hsearch.h"
#include "utils/memutils.h"
#include "utils/wait_event_types.h"
Go to the source code of this file.
Macros | |
#define | MEMORY_CONTEXT_IDENT_DISPLAY_SIZE 1024 |
#define | PG_GET_BACKEND_MEMORY_CONTEXTS_COLS 10 |
#define | MEMSTATS_WAIT_TIMEOUT 100 |
#define | PG_GET_PROCESS_MEMORY_CONTEXTS_COLS 12 |
Functions | |
static Datum | int_list_to_array (const List *list) |
static void | PutMemoryContextsStatsTupleStore (Tuplestorestate *tupstore, TupleDesc tupdesc, MemoryContext context, HTAB *context_id_lookup) |
const char * | ContextTypeToString (NodeTag type) |
Datum | pg_get_backend_memory_contexts (PG_FUNCTION_ARGS) |
Datum | pg_log_backend_memory_contexts (PG_FUNCTION_ARGS) |
Datum | pg_get_process_memory_contexts (PG_FUNCTION_ARGS) |
Size | MemoryContextReportingShmemSize (void) |
void | MemoryContextReportingShmemInit (void) |
Variables | |
struct MemoryStatsBackendState * | memCxtState = NULL |
struct MemoryStatsCtl * | memCxtArea = NULL |
#define MEMORY_CONTEXT_IDENT_DISPLAY_SIZE 1024 |
Definition at line 36 of file mcxtfuncs.c.
#define MEMSTATS_WAIT_TIMEOUT 100 |
Definition at line 354 of file mcxtfuncs.c.
#define PG_GET_BACKEND_MEMORY_CONTEXTS_COLS 10 |
#define PG_GET_PROCESS_MEMORY_CONTEXTS_COLS 12 |
const char * ContextTypeToString | ( | NodeTag | type | ) |
Definition at line 165 of file mcxtfuncs.c.
References type.
Referenced by pg_get_process_memory_contexts(), and PutMemoryContextsStatsTupleStore().
Definition at line 45 of file mcxtfuncs.c.
References construct_array_builtin(), foreach_current_index, foreach_int, i, Int32GetDatum(), sort-test::list, list_length(), palloc(), and PointerGetDatum().
Referenced by PutMemoryContextsStatsTupleStore().
void MemoryContextReportingShmemInit | ( | void | ) |
Definition at line 637 of file mcxtfuncs.c.
References ConditionVariableInit(), DSA_HANDLE_INVALID, i, InvalidDsaPointer, MemoryStatsCtl::lw_lock, LWLockInitialize(), LWTRANCHE_MEMORY_CONTEXT_REPORTING_PROC, LWTRANCHE_MEMORY_CONTEXT_REPORTING_STATE, MaxBackends, memCxtArea, memCxtState, MemoryStatsCtl::memstats_dsa_handle, MemoryStatsBackendState::memstats_dsa_pointer, NUM_AUXILIARY_PROCS, and ShmemInitStruct().
Referenced by CreateOrAttachShmemStructs().
Size MemoryContextReportingShmemSize | ( | void | ) |
Definition at line 619 of file mcxtfuncs.c.
References add_size(), MaxBackends, mul_size(), and NUM_AUXILIARY_PROCS.
Referenced by CalculateShmemSize().
Datum pg_get_backend_memory_contexts | ( | PG_FUNCTION_ARGS | ) |
Definition at line 195 of file mcxtfuncs.c.
References Assert(), MemoryStatsContextId::context_id, ctl, cur, CurrentMemoryContext, foreach_ptr, HASH_BLOBS, HASH_CONTEXT, hash_create(), hash_destroy(), HASH_ELEM, HASH_ENTER, hash_search(), InitMaterializedSRF(), lappend(), list_make1, PutMemoryContextsStatsTupleStore(), ReturnSetInfo::setDesc, ReturnSetInfo::setResult, and TopMemoryContext.
Datum pg_get_process_memory_contexts | ( | PG_FUNCTION_ARGS | ) |
Definition at line 356 of file mcxtfuncs.c.
References Assert(), AuxiliaryPidGetProc(), BackendPidGetProc(), ConditionVariableCancelSleep(), ConditionVariableTimedSleep(), construct_array_builtin(), ContextTypeToString(), CStringGetTextDatum, CurrentMemoryContext, dsa_attach(), dsa_get_address(), DSA_HANDLE_INVALID, dsa_pin_mapping(), DsaPointerIsValid, ereport, errmsg(), GetCurrentTimestamp(), GetNumberFromPGProc, i, ident, InitMaterializedSRF(), Int32GetDatum(), Int64GetDatum(), INVALID_PROC_NUMBER, j, LW_EXCLUSIVE, MemoryStatsCtl::lw_lock, LWLockAcquire(), LWLockRelease(), memCxtArea, memCxtState, MemoryContextSwitchTo(), MemoryStatsDsaArea, MemoryStatsCtl::memstats_dsa_handle, name, palloc(), path_length(), PG_GET_PROCESS_MEMORY_CONTEXTS_COLS, PG_GETARG_BOOL, PG_GETARG_FLOAT8, PG_GETARG_INT32, PG_RETURN_NULL, PointerGetDatum(), PROCSIG_GET_MEMORY_CONTEXT, SendProcSignal(), ReturnSetInfo::setDesc, ReturnSetInfo::setResult, MemoryStatsBackendState::summary, TimestampDifferenceMilliseconds(), TimestampTzGetDatum(), TopMemoryContext, MemoryStatsBackendState::total_stats, tuplestore_putvalues(), type, values, and WARNING.
Datum pg_log_backend_memory_contexts | ( | PG_FUNCTION_ARGS | ) |
Definition at line 276 of file mcxtfuncs.c.
References AuxiliaryPidGetProc(), BackendPidGetProc(), ereport, errmsg(), GetNumberFromPGProc, INVALID_PROC_NUMBER, PG_GETARG_INT32, PG_RETURN_BOOL, PROCSIG_LOG_MEMORY_CONTEXT, SendProcSignal(), and WARNING.
|
static |
Definition at line 67 of file mcxtfuncs.c.
References Assert(), MemoryStatsContextId::context_id, ContextTypeToString(), CStringGetTextDatum, cur, elog, ERROR, HASH_FIND, hash_search(), MemoryContextData::ident, ident, Int32GetDatum(), Int64GetDatum(), int_list_to_array(), lcons_int(), list_free(), list_length(), MEMORY_CONTEXT_IDENT_DISPLAY_SIZE, MemoryContextIsValid, MemoryContextData::methods, name, MemoryContextData::name, NIL, PG_GET_BACKEND_MEMORY_CONTEXTS_COLS, pg_mbcliplen(), stat, MemoryContextMethods::stats, tuplestore_putvalues(), type, and values.
Referenced by pg_get_backend_memory_contexts().
struct MemoryStatsCtl* memCxtArea = NULL |
Definition at line 38 of file mcxtfuncs.c.
Referenced by AtProcExit_memstats_cleanup(), MemoryContextReportingShmemInit(), pg_get_process_memory_contexts(), and ProcessGetMemoryContextInterrupt().
struct MemoryStatsBackendState* memCxtState = NULL |
Definition at line 37 of file mcxtfuncs.c.
Referenced by AtProcExit_memstats_cleanup(), end_memorycontext_reporting(), free_memorycontextstate_dsa(), MemoryContextReportingShmemInit(), pg_get_process_memory_contexts(), and ProcessGetMemoryContextInterrupt().