| | |
| | | #include "executor/executor.h" |
| | | #include "executor/spi.h" |
| | | #include "funcapi.h" |
| | | #include "lib/stringinfo.h" |
| | | #include "mb/pg_wchar.h" |
| | | #include "miscadmin.h" |
| | | #include "nodes/supportnodes.h" |
| | |
| | | |
| | | static void regress_lseg_construct(LSEG *lseg, Point *pt1, Point *pt2); |
| | | |
| | | typedef struct DbmsTraceDebugSnapshot |
| | | { |
| | | bool enabled; |
| | | int32 trace_mask; |
| | | int64 active_run_id; |
| | | int64 next_run_id; |
| | | int64 next_event_seq; |
| | | int32 trace_rows_count; |
| | | char last_event_type[16]; |
| | | } DbmsTraceDebugSnapshot; |
| | | |
| | | extern void dbms_trace_get_debug_snapshot(DbmsTraceDebugSnapshot *out); |
| | | |
| | | PG_MODULE_MAGIC_EXT( |
| | | .name = "regress", |
| | | .version = PG_VERSION |
| | |
| | | } |
| | | |
| | | PG_FUNCTION_INFO_V1(regress_setenv); |
| | | PG_FUNCTION_INFO_V1(regress_dbms_trace_snapshot); |
| | | |
| | | Datum |
| | | regress_setenv(PG_FUNCTION_ARGS) |
| | |
| | | PG_RETURN_VOID(); |
| | | } |
| | | |
| | | Datum |
| | | regress_dbms_trace_snapshot(PG_FUNCTION_ARGS) |
| | | { |
| | | DbmsTraceDebugSnapshot snap; |
| | | StringInfoData buf; |
| | | |
| | | dbms_trace_get_debug_snapshot(&snap); |
| | | |
| | | initStringInfo(&buf); |
| | | appendStringInfo(&buf, |
| | | "enabled=%s trace_mask=%d active_run_id=%lld next_run_id=%lld next_event_seq=%lld trace_rows_count=%d last_event_type=%s", |
| | | snap.enabled ? "true" : "false", |
| | | snap.trace_mask, |
| | | (long long) snap.active_run_id, |
| | | (long long) snap.next_run_id, |
| | | (long long) snap.next_event_seq, |
| | | snap.trace_rows_count, |
| | | snap.last_event_type[0] != '\0' ? snap.last_event_type : "none"); |
| | | |
| | | PG_RETURN_TEXT_P(cstring_to_text(buf.data)); |
| | | } |
| | | |
| | | /* Sleep until no process has a given PID. */ |
| | | PG_FUNCTION_INFO_V1(wait_pid); |
| | | |