* cdbexplain_showExecStatsBegin * Called by qDisp process to create a CdbExplain_ShowStatCtx structure * in which to accumulate overall statistics for a query. * * 'querystarttime' is the timestamp of the start of the query, in a * platform-dependent format. * * Note this function is called before ExecutorStart(), so there is no EState * or SliceTable yet. */
| 1485 | * or SliceTable yet. |
| 1486 | */ |
| 1487 | struct CdbExplain_ShowStatCtx * |
| 1488 | cdbexplain_showExecStatsBegin(struct QueryDesc *queryDesc, |
| 1489 | instr_time querystarttime) |
| 1490 | { |
| 1491 | CdbExplain_ShowStatCtx *ctx; |
| 1492 | int nslice; |
| 1493 | |
| 1494 | Assert(Gp_role != GP_ROLE_EXECUTE); |
| 1495 | |
| 1496 | /* Allocate and zero the ShowStatCtx */ |
| 1497 | ctx = (CdbExplain_ShowStatCtx *) palloc0(sizeof(*ctx)); |
| 1498 | |
| 1499 | ctx->querystarttime = querystarttime; |
| 1500 | |
| 1501 | /* Determine number of slices. (SliceTable hasn't been built yet.) */ |
| 1502 | nslice = queryDesc->plannedstmt->numSlices; |
| 1503 | |
| 1504 | /* Allocate and zero the SliceSummary array. */ |
| 1505 | ctx->nslice = nslice; |
| 1506 | ctx->slices = (CdbExplain_SliceSummary *) palloc0(nslice * sizeof(ctx->slices[0])); |
| 1507 | |
| 1508 | /* Allocate a buffer in which we can collect any extra message text. */ |
| 1509 | initStringInfoOfSize(&ctx->extratextbuf, 4000); |
| 1510 | |
| 1511 | return ctx; |
| 1512 | } /* cdbexplain_showExecStatsBegin */ |
| 1513 | |
| 1514 | /* |
| 1515 | * cdbexplain_showStatCtxFree |
no test coverage detected