Exit from a plan node */
| 107 | |
| 108 | /* Exit from a plan node */ |
| 109 | static void |
| 110 | InstrStopNodeSync(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 | |
| 151 | static void |
| 152 | InstrStopNodeAsync(Instrumentation *instr, uint64 nTuples) |
no test coverage detected