PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
wait_event_funcs.c File Reference
#include "postgres.h"
#include "funcapi.h"
#include "utils/builtins.h"
#include "utils/wait_event.h"
#include "wait_event_funcs_data.c"
Include dependency graph for wait_event_funcs.c:

Go to the source code of this file.

Macros

#define PG_GET_WAIT_EVENTS_COLS   3
 

Functions

Datum pg_get_wait_events (PG_FUNCTION_ARGS)
 

Variables

struct {
   const char *   type
 
   const char *   name
 
   const char *   description
 
waitEventData []
 

Macro Definition Documentation

◆ PG_GET_WAIT_EVENTS_COLS

#define PG_GET_WAIT_EVENTS_COLS   3

Function Documentation

◆ pg_get_wait_events()

Datum pg_get_wait_events ( PG_FUNCTION_ARGS  )

Definition at line 46 of file wait_event_funcs.c.

47{
48#define PG_GET_WAIT_EVENTS_COLS 3
49 ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
50 char **waiteventnames;
51 int nbwaitevents;
52
53 /* Build tuplestore to hold the result rows */
54 InitMaterializedSRF(fcinfo, 0);
55
56 /* Iterate over the list of wait events */
57 for (int idx = 0; waitEventData[idx].type != NULL; idx++)
58 {
60 bool nulls[PG_GET_WAIT_EVENTS_COLS] = {0};
61
65
66 tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);
67 }
68
69 /* Handle custom wait events for extensions */
71 &nbwaitevents);
72
73 for (int idx = 0; idx < nbwaitevents; idx++)
74 {
77 bool nulls[PG_GET_WAIT_EVENTS_COLS] = {0};
78
79
80 values[0] = CStringGetTextDatum("Extension");
81 values[1] = CStringGetTextDatum(waiteventnames[idx]);
82
85 "Waiting for custom wait event \"%s\" defined by extension module",
86 waiteventnames[idx]);
87
89
90 tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);
91 }
92
93 /* Likewise for injection points */
95 &nbwaitevents);
96
97 for (int idx = 0; idx < nbwaitevents; idx++)
98 {
101 bool nulls[PG_GET_WAIT_EVENTS_COLS] = {0};
102
103
104 values[0] = CStringGetTextDatum("InjectionPoint");
105 values[1] = CStringGetTextDatum(waiteventnames[idx]);
106
109 "Waiting for injection point \"%s\"",
110 waiteventnames[idx]);
111
112 values[2] = CStringGetTextDatum(buf.data);
113
114 tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);
115 }
116
117 return (Datum) 0;
118}
Datum idx(PG_FUNCTION_ARGS)
Definition: _int_op.c:259
static Datum values[MAXATTR]
Definition: bootstrap.c:151
#define CStringGetTextDatum(s)
Definition: builtins.h:97
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
Definition: funcapi.c:76
static char * buf
Definition: pg_test_fsync.c:72
uintptr_t Datum
Definition: postgres.h:64
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:94
void initStringInfo(StringInfo str)
Definition: stringinfo.c:56
TupleDesc setDesc
Definition: execnodes.h:343
Tuplestorestate * setResult
Definition: execnodes.h:342
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
Definition: tuplestore.c:784
char ** GetWaitEventCustomNames(uint32 classId, int *nwaitevents)
Definition: wait_event.c:306
#define PG_WAIT_INJECTIONPOINT
Definition: wait_event.h:27
#define PG_WAIT_EXTENSION
Definition: wait_event.h:23
static const struct @21 waitEventData[]
const char * description
const char * type
#define PG_GET_WAIT_EVENTS_COLS
const char * name

References appendStringInfo(), buf, CStringGetTextDatum, description, GetWaitEventCustomNames(), idx(), InitMaterializedSRF(), initStringInfo(), name, PG_GET_WAIT_EVENTS_COLS, PG_WAIT_EXTENSION, PG_WAIT_INJECTIONPOINT, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, tuplestore_putvalues(), type, values, and waitEventData.

Variable Documentation

◆ description

◆ name

const char* name

Definition at line 28 of file wait_event_funcs.c.

Referenced by _jumbleVariableSetStmt(), _outA_Expr(), _pglstat64(), _pgstat64(), _readA_Expr(), _SPI_find_ENR_by_name(), aclparse(), add_bool_reloption(), add_descriptor(), add_enum_reloption(), add_int_reloption(), add_local_bool_reloption(), add_local_enum_reloption(), add_local_int_reloption(), add_local_real_reloption(), add_local_string_reloption(), add_parameter_name(), add_placeholder_variable(), add_real_reloption(), add_string_reloption(), add_to_names_hash(), AlignedAllocFree(), allocate_reloption(), AllocateFile(), AllocSetContextCreateInternal(), AlterEventTriggerOwner(), AlterForeignDataWrapperOwner(), AlterForeignServerOwner(), AlterObjectNamespace_internal(), AlterPublicationOwner(), AlterSchemaOwner(), AlterSubscriptionOwner(), AlterSystemSetConfigFile(), AlterTableGetRelOptionsLockLevel(), appendReloptionsArray(), assignable_custom_variable_name(), assignVariables(), ATExecAttachPartitionIdx(), ATExecDetachPartition(), ATExecDetachPartitionFinalize(), avlMergeValue(), BaseBackupAddTarget(), BeginInternalSubTransaction(), BootstrapModeMain(), BufFileCreateFileSet(), BufFileDeleteFileSet(), BufFileOpenFileSet(), buildACLCommands(), buildDefItem(), BuildOnConflictExcludedTargetlist(), BumpContextCreate(), check_duplicates_in_publist(), check_encoding_conversion_args(), check_file_excluded(), check_GUC_name_for_parameter_acl(), check_restricted_library_name(), check_slru_buffers(), check_testspec(), checkInsertTargets(), CheckMyDatabase(), choose_dsm_implementation(), ChooseExtendedStatisticNameAddition(), ChooseForeignKeyConstraintNameAddition(), ChooseIndexNameAddition(), ChooseTablespace(), close_file(), CommitTransactionCommandInternal(), compareVariableNames(), componentcheck(), convert_GUC_name_for_parameter_acl(), convertRegProcReference(), CopyGetAttnums(), create_logical_replication_slot(), create_physical_replication_slot(), createNewConnection(), CreatePortal(), CreateTriggerFiringOn(), cursor_to_xml(), cursor_to_xmlschema(), deallocate_one(), define_custom_variable(), DefineAggregate(), DefineAttr(), DefineCustomBoolVariable(), DefineCustomEnumVariable(), DefineCustomIntVariable(), DefineCustomRealVariable(), DefineCustomStringVariable(), DefineSavepoint(), deleteConnection(), DeleteVariable(), DescribeQuery(), descriptor_variable(), do_pset(), does_not_exist_skipping(), drop_descriptor(), dsm_impl_mmap(), dsm_impl_pin_segment(), dsm_impl_posix(), dsm_impl_sysv(), dsm_impl_unpin_segment(), dump_block(), dumpACL(), dumpComment(), dumpCommentExtended(), dumpSecLabel(), dupEvents(), eat(), eats(), ecpg_auto_prepare(), ecpg_find_desc(), ecpg_find_prepared_statement(), ecpg_prepared(), ecpg_register_prepared_stmt(), ecpg_result_by_descriptor(), ECPGallocate_desc(), ECPGconnect(), ECPGdeallocate(), ECPGdeallocate_desc(), ECPGdescribe(), ECPGdump_a_simple(), ECPGdump_a_struct(), ECPGdump_a_type(), ECPGmake_struct_member(), ECPGnumeric_lvalue(), ECPGprepare(), ECPGprepared_statement(), enum_in(), enum_recv(), ExecParallelHashJoinSetUpBatches(), expand_dynamic_library_name(), expandNSItemAttrs(), FigureColname(), FigureColnameInternal(), FigureIndexColname(), FilePath(), FileSetCreate(), FileSetDelete(), FileSetOpen(), FileSetSegmentName(), FillXLogStatsRow(), find_option(), find_provider(), find_simple(), find_struct(), find_struct_member(), find_variable(), findBuiltin(), findTargetlistEntrySQL92(), findWindowClause(), flatten_set_variable_args(), fmgr_lookupByName(), fmgr_security_definer(), fn(), generateJsonTablePathName(), GenerationContextCreate(), GenerationRealloc(), get_config_handle(), get_db_info(), get_ENR(), get_object_address_unqualified(), get_prompt(), get_reloptions(), get_replslot_index(), get_typedef(), GetConfigOption(), GetConfigOptionByName(), GetConfigOptionFlags(), GetConfigOptionResetString(), getConnectionByName(), GetNamedDSMSegment(), getopt_long(), GetPGVariable(), GetPGVariableResultDesc(), GetPortalByName(), gettype(), getVariable(), GetVariable(), guc_name_hash(), GUCArrayAdd(), GUCArrayDelete(), infile(), init_bool_reloption(), init_custom_variable(), init_enum_reloption(), init_int_reloption(), init_real_reloption(), init_string_reloption(), initialize_ntdll(), initialize_reloptions(), InitializeClientEncoding(), InitializeLWLocks(), InitManyTestResourceKind(), injection_error(), injection_notice(), injection_points_attach(), injection_points_cached(), injection_points_cleanup(), injection_points_detach(), injection_points_load(), injection_points_run(), injection_points_stats_numcalls(), injection_points_wakeup(), injection_wait(), InjectionPointAttach(), InjectionPointCached(), InjectionPointDetach(), InjectionPointLoad(), InjectionPointRun(), is_true_boolean_expression(), IsInjectionPointAttached(), IsReservedName(), IsReservedOriginName(), itsdir(), itssymlink(), JsonTableInitOpaque(), jspIsMutableWalker(), listAvailableScripts(), llvm_resolve_symbols(), llvm_split_symbol_name(), load_return_type(), looks_like_temp_rel_name(), lookup_descriptor(), lookup_prop_name(), lookupCreateVariable(), LookupPathOrColumnName(), lookupVariable(), main(), makeA_Expr(), makeAlterConfigCommand(), makeDefElem(), makeDefElemExtended(), makeFuncCall(), makeJsonTablePathSpec(), makeMultirangeConstructors(), MakeNewFileSetSegment(), makeObjectName(), makeRangeConstructors(), makeSimpleA_Expr(), map_xml_name_to_sql_identifier(), MemoryContextCreate(), MemoryContextStatsPrint(), merge_publications(), MergeAttributes(), MergeCheckConstraint(), mkdirs(), my_newCONSTSUB(), namecheck(), NameListToString(), namestrcmp(), namestrcpy(), new_variable(), output_deallocate_prepare_statement(), output_prepare_statement(), owningrel_does_not_exist_skipping(), parse_compress_algorithm(), parse_dispatch_option(), parse_filename_for_nontemp_relation(), parse_hba_auth_opt(), parse_sequence_type(), ParseLongOption(), parseQuery(), parseVariable(), ParseVariableBool(), ParseVariableNum(), PerformPortalClose(), pg_any_to_server(), pg_char_to_encoding(), pg_checksum_parse_type(), pg_config(), pg_create_logical_replication_slot(), pg_create_physical_replication_slot(), pg_digest(), pg_drop_replication_slot(), pg_fe_getusername(), pg_file_exists(), pg_get_functiondef(), pg_get_object_address(), pg_get_wait_events(), pg_hmac(), pg_import_system_collations(), pg_indexam_progress_phasename(), pg_load_tz(), pg_logging_init(), pg_logical_slot_get_changes_guts(), pg_open_tzfile(), pg_parameter_aclcheck(), pg_parameter_aclmask(), pg_replication_origin_advance(), pg_replication_origin_create(), pg_replication_origin_drop(), pg_replication_origin_oid(), pg_replication_origin_progress(), pg_replication_origin_session_setup(), pg_size_pretty(), pg_size_pretty_numeric(), pg_stat_get_slru(), pg_unicode_to_server(), pg_valid_client_encoding(), pg_valid_server_encoding(), pgp_get_cipher_code(), pgp_get_digest_code(), pgp_load_digest(), pgp_set_cipher_algo(), pgp_set_s2k_cipher_algo(), pgp_set_s2k_digest_algo(), pgstat_create_inj(), pgstat_create_transactional(), pgstat_drop_inj(), pgstat_fetch_stat_injentry(), pgstat_get_kind_from_str(), pgstat_get_slru_index(), pgstat_read_statsfile(), pgstat_register_kind(), pgstat_replslot_from_serialized_name_cb(), pgstat_replslot_to_serialized_name_cb(), pgstat_report_inj(), pgstat_reset_replslot(), pgstat_reset_slru(), pgstat_write_statsfile(), pgtls_verify_peer_name_matches_certificate_guts(), pgwin32_setenv(), pgwin32_unsetenv(), plpgsql_ns_additem(), plpgsql_ns_lookup_label(), PLy_create_exception(), PLy_generate_spi_exceptions(), PLy_procedure_munge_source(), PLy_traceback(), postmaster_child_launch(), PostmasterMain(), pp_require_safe(), pq_verify_peer_name_matches_certificate_name(), PQregisterEventProc(), pqSaveParameterStatus(), prepare_cert_name(), prepare_common(), printCrosstab(), process_postgres_switches(), process_startup_options(), ProcessGUCArray(), PsqlVarEnumError(), PutMemoryContextsStatsTupleStore(), putVariable(), putVariableInt(), putVariableValue(), px_find_cipher(), px_find_combo(), px_find_digest(), px_find_hmac(), px_resolve_alias(), quoteOneName(), reapply_stacked_values(), ReleaseSavepoint(), repairDependencyLoop(), replace_auto_config_value(), ReplicationSlotAcquire(), ReplicationSlotAlter(), ReplicationSlotCreate(), ReplicationSlotDrop(), ReplicationSlotName(), ReplicationSlotValidateName(), replorigin_drop_by_name(), report_invalid_encoding(), report_name_conflict(), report_namespace_conflict(), report_untranslatable_char(), ResourceOwnerCreate(), RestoreSlotFromDisk(), ri_ReportViolation(), RollbackToSavepoint(), run_permutation(), run_reindex_command(), scan_available_timezones(), schema_does_not_exist_skipping(), schema_to_xml(), schema_to_xml_and_xmlschema(), schema_to_xmlschema(), SearchNamedReplicationSlot(), sendDir(), seq_search_ascii(), seq_search_localized(), set_config_by_name(), set_config_option(), set_config_option_ext(), set_config_sourcefile(), set_config_with_handle(), SetConfigOption(), SetPGVariable(), SetVariable(), SetVariableBool(), SetVariableHooks(), ShmemInitHash(), ShmemInitStruct(), show_item(), ShowGUCConfigOption(), SimpleLruInit(), skipfile(), SlabContextCreate(), SPI_cursor_find(), SPI_cursor_open(), SPI_cursor_open_internal(), SPI_cursor_open_with_args(), SPI_cursor_open_with_paramlist(), SPI_cursor_parse_open(), SPI_unregister_relation(), sqlda_variable(), StandbySlotsHaveCaughtup(), StoreIndexTuple(), strlist_to_textarray(), sts_filename(), sts_initialize(), sts_parallel_scan_next(), sts_puttuple(), substitute_libpath_macro(), tarOpen(), TransformGUCArray(), TSConfigIsVisibleExt(), TSDictionaryIsVisibleExt(), TSParserIsVisibleExt(), TSTemplateIsVisibleExt(), type_in_list_does_not_exist_skipping(), TypeCreate(), TypeShellMake(), tzload(), tzloadbody(), tzparse(), unregister_ENR(), uuid_generate_v3(), uuid_generate_v5(), valid_custom_variable_name(), valid_variable_name(), validate_option_array_item(), validate_sync_standby_slots(), ValidateOperatorReference(), validOperatorName(), variable_is_guc_list_quote(), VariableHasHook(), worker_spi_main(), writezone(), X509_NAME_field_to_text(), X509_NAME_to_cstring(), XLogDumpStatsRow(), and XmlTableSetNamespace().

◆ type

const char* type

Definition at line 27 of file wait_event_funcs.c.

Referenced by _equalList(), _getObjectDescription(), _jumbleNode(), _readBlockHeader(), accesstype_to_string(), addtt(), agg_args_support_sendreceive(), allocate_reloption(), AutoVacuumRequestWork(), bqarr_in(), brin_page_init(), brin_page_type(), build_mss(), build_tuple_value_details(), buildACLCommands(), buildDefaultACLCommands(), cannotCastJsonbValue(), check_foreign_key(), CheckAndReportConflict(), cloneouts(), colorcomplement(), CreateStatistics(), cryptohash_internal(), datum_to_jsonb_internal(), DecodeDate(), DecodeDateTime(), DecodeInterval(), DecodePosixTimezone(), DecodeSpecial(), DecodeTimeOnly(), DecodeTimezoneName(), DecodeUnits(), DefineAttr(), dependency_degree(), dumpACL(), dumpComment(), dumpCommentExtended(), dumpDefaultACL(), dumpSecLabel(), ean2isn(), ean2string(), ecpg_do_prologue(), ecpg_dynamic_type(), ecpg_dynamic_type_DDT(), ecpg_get_data(), ecpg_is_type_an_array(), ECPGdescribe(), ECPGdump_a_simple(), ECPGdump_a_struct(), ECPGdump_a_type(), ECPGfree_type(), ECPGget_desc(), ECPGis_noind_null(), ECPGmake_array_type(), ECPGmake_simple_type(), ECPGmake_struct_member(), ECPGmake_struct_type(), ECPGset_noind_null(), ECPGstruct_member_dup(), emit_audit_message(), emit_tap_output(), emit_tap_output_v(), EmitProcSignalBarrier(), enable_timeouts(), errcode_apply_conflict(), errdetail_apply_conflict(), evalStandardFunc(), exprCollation(), exprSetCollation(), exprType(), extract_date(), extract_jsp_bool_expr(), fillTypeDesc(), FindAffixes(), findarc(), findoprnd(), findoprnd_recurse(), fmtfloat(), fmtint(), ForwardSyncRequest(), get_command_type(), get_docrep(), get_dtype(), get_parallel_object_list(), get_th(), get_typdefault(), get_type(), getScalar(), gettype(), getTypeBinaryInputInfo(), getTypeBinaryOutputInfo(), getTypeInputInfo(), getTypeOutputInfo(), GetVirtualXIDsDelayingChkpt(), gin_bool_consistent(), gin_extract_tsquery(), ginint4_queryextract(), hash_page_type(), HaveVirtualXIDsDelayingChkpt(), hladdword(), hlparsetext(), info_cb(), init_compress(), init_custom_variable(), init_litdata_packet(), interval_part_common(), interval_trunc(), isDataGram(), IsPreferredType(), isSimpleNode(), iterate_jsonb_values(), json_typeof(), jsonb_agg_transfn_worker(), jsonb_object_agg_transfn_worker(), jsonb_strip_nulls(), JsonbToCStringWorker(), JsonbType(), jspOperationName(), LexizeAddLemm(), libpq_traverse_files(), logicalrep_write_prepare_common(), main(), make_jsp_expr_node(), make_jsp_expr_node_args(), make_jsp_expr_node_binary(), makeAlterConfigCommand(), makeJsonConstructorExpr(), makeJsonFormat(), makepol(), map_sql_value_to_xml_value(), mkANode(), mmerror(), ndistinct_for_combination(), new_list(), new_variable(), NIAddAffix(), NIImportOOAffixes(), nodeRead(), NonFiniteIntervalPart(), NonFiniteTimestampTzPart(), outzone(), parse(), parse_compressed_data(), parse_jsonb_index_flags(), parse_literal_data(), parse_ooaffentry(), parse_sane_timezone(), parseAclItem(), parsebranch(), parseqatom(), parsetext(), pg_checksum_init(), pg_checksum_parse_type(), pg_checksum_type_name(), pg_cryptohash_create(), pg_decrypt(), pg_decrypt_iv(), pg_encrypt(), pg_encrypt_iv(), pg_event_trigger_ddl_commands(), pg_get_object_address(), pg_get_wait_events(), pg_GSS_error_int(), pg_hmac_create(), pg_log(), pg_log_v(), pg_prewarm(), pgstat_report_subscription_conflict(), PGTYPEStimestamp_defmt_scan(), pgwin32_socket(), PLy_subtransaction_exit(), PQsendTypedCommand(), pqTraceOutputNR(), prepare_column_cache(), prepareCommandsInPipeline(), process_directory_recursively(), process_source_file(), process_target_file(), ProcessProcSignalBarrier(), prs_setup_firstcall(), psql_scan_slash_option(), pushquery(), pushval_asis(), PutMemoryContextsStatsTupleStore(), radius_add_attribute(), rainbow(), RegisterSyncRequest(), reindex_one_database(), RememberSyncRequest(), RemovePgTempFilesInDir(), report_status(), ReportApplyConflict(), roles_is_member_of(), rtypalign(), rtypmsize(), run_reindex_command(), scan_for_existing_tablespaces(), sqlda_common_total_size(), sqlda_dynamic_type(), StartChildProcess(), statext_is_kind_built(), storeObjectDescription(), str_numth(), string2ean(), suff_search(), test_null(), testprs_getlexeme(), time_part_common(), timestamp_part_common(), timestamp_trunc(), timestamp_zone(), timestamptz_part_common(), timestamptz_trunc_internal(), timestamptz_zone(), timetz_part_common(), timetz_zone(), transform_jsonb_string_values(), TypeCategory(), typeidTypeRelid(), typeOrDomainTypeRelid(), verify_brin_page(), vmmerror(), writezone(), and XLogWalRcvProcessMsg().

◆ 

const struct { ... } waitEventData[]
Initial value:
=
{
{NULL, NULL, NULL}
}

Referenced by pg_get_wait_events().