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

Function InstrStopNodeSync

src/backend/executor/instrument.c:109–149  ·  view source on GitHub ↗

Exit from a plan node */

Source from the content-addressed store, hash-verified

107
108/* Exit from a plan node */
109static void
110InstrStopNodeSync(Instrumentation *instr, uint64 nTuples)
111{
112 instr_time endtime;
113 instr_time starttime;
114
115 starttime = instr->starttime;
116
117 /* count the returned tuples */
118 instr->tuplecount += nTuples;
119
120 /* let's update the time only if the timer was requested */
121 if (instr->need_timer)
122 {
123 if (INSTR_TIME_IS_ZERO(instr->starttime))
124 elog(ERROR, "InstrStopNode called without start");
125
126 INSTR_TIME_SET_CURRENT_COARSE(endtime);
127 INSTR_TIME_ACCUM_DIFF(instr->counter, endtime, instr->starttime);
128
129 INSTR_TIME_SET_ZERO(instr->starttime);
130 }
131
132 /* Add delta of buffer usage since entry to node's totals */
133 if (instr->need_bufusage)
134 BufferUsageAccumDiff(&instr->bufusage,
135 &pgBufferUsage, &instr->bufusage_start);
136
137 if (instr->need_walusage)
138 WalUsageAccumDiff(&instr->walusage,
139 &pgWalUsage, &instr->walusage_start);
140
141 /* Is this the first tuple of this cycle? */
142 if (!instr->running)
143 {
144 instr->running = true;
145 instr->firsttuple = INSTR_TIME_GET_DOUBLE(instr->counter);
146 /* CDB: save this start time as the first start */
147 instr->firststart = starttime;
148 }
149}
150
151static void
152InstrStopNodeAsync(Instrumentation *instr, uint64 nTuples)

Callers 2

InstrStopNodeAsyncFunction · 0.85
InstrStopNodeFunction · 0.85

Calls 2

BufferUsageAccumDiffFunction · 0.85
WalUsageAccumDiffFunction · 0.85

Tested by

no test coverage detected