Finish a run cycle for a plan node */
| 183 | |
| 184 | /* Finish a run cycle for a plan node */ |
| 185 | void |
| 186 | InstrEndLoop(Instrumentation *instr) |
| 187 | { |
| 188 | double totaltime; |
| 189 | |
| 190 | /* Skip if nothing has happened, or already shut down */ |
| 191 | if (!instr->running) |
| 192 | return; |
| 193 | |
| 194 | if (!INSTR_TIME_IS_ZERO(instr->starttime)) |
| 195 | elog(ERROR, "InstrEndLoop called on running node"); |
| 196 | |
| 197 | /* Accumulate per-cycle statistics into totals */ |
| 198 | totaltime = INSTR_TIME_GET_DOUBLE(instr->counter); |
| 199 | |
| 200 | /* CDB: Report startup time from only the first cycle. */ |
| 201 | if (instr->nloops == 0) |
| 202 | instr->startup = instr->firsttuple; |
| 203 | |
| 204 | instr->total += totaltime; |
| 205 | instr->ntuples += instr->tuplecount; |
| 206 | instr->nloops += 1; |
| 207 | |
| 208 | /* Reset for next cycle (if any) */ |
| 209 | instr->running = false; |
| 210 | INSTR_TIME_SET_ZERO(instr->starttime); |
| 211 | INSTR_TIME_SET_ZERO(instr->counter); |
| 212 | instr->firsttuple = 0; |
| 213 | instr->tuplecount = 0; |
| 214 | } |
| 215 | |
| 216 | /* aggregate instrumentation information */ |
| 217 | void |
no outgoing calls
no test coverage detected