MCPcopy Create free account
hub / github.com/apache/cloudberry / InstrAlloc

Function InstrAlloc

src/backend/executor/instrument.c:54–80  ·  view source on GitHub ↗

Allocate new instrumentation structure(s) */

Source from the content-addressed store, hash-verified

52
53/* Allocate new instrumentation structure(s) */
54Instrumentation *
55InstrAlloc(int n, int instrument_options, bool async_mode)
56{
57 Instrumentation *instr;
58
59 /* initialize all fields to zeroes, then modify as needed */
60 instr = palloc0(n * sizeof(Instrumentation));
61 if (instrument_options & (INSTRUMENT_BUFFERS | INSTRUMENT_TIMER | INSTRUMENT_WAL | INSTRUMENT_CDB))
62 {
63 bool need_buffers = (instrument_options & INSTRUMENT_BUFFERS) != 0;
64 bool need_wal = (instrument_options & INSTRUMENT_WAL) != 0;
65 bool need_timer = (instrument_options & INSTRUMENT_TIMER) != 0;
66 bool need_cdb = (instrument_options & INSTRUMENT_CDB) != 0;
67 int i;
68
69 for (i = 0; i < n; i++)
70 {
71 instr[i].need_bufusage = need_buffers;
72 instr[i].need_walusage = need_wal;
73 instr[i].need_timer = need_timer;
74 instr[i].need_cdb = need_cdb;
75 instr[i].async_mode = async_mode;
76 }
77 }
78
79 return instr;
80}
81
82/* Initialize a pre-allocated instrumentation structure. */
83void

Callers 4

pgss_ExecutorStartFunction · 0.85
explain_ExecutorStartFunction · 0.85
InitResultRelInfoFunction · 0.85
GpInstrAllocFunction · 0.85

Calls 1

palloc0Function · 0.50

Tested by

no test coverage detected