---------------------------------------------------------------- * ExecSortInitializeDSM * * Initialize DSM space for sort statistics. * ---------------------------------------------------------------- */
| 527 | * ---------------------------------------------------------------- |
| 528 | */ |
| 529 | void |
| 530 | ExecSortInitializeDSM(SortState *node, ParallelContext *pcxt) |
| 531 | { |
| 532 | Size size; |
| 533 | |
| 534 | /* don't need this if not instrumenting or no workers */ |
| 535 | if (!node->ss.ps.instrument || pcxt->nworkers == 0) |
| 536 | return; |
| 537 | |
| 538 | size = offsetof(SharedSortInfo, sinstrument) |
| 539 | + pcxt->nworkers * sizeof(TuplesortInstrumentation); |
| 540 | node->shared_info = shm_toc_allocate(pcxt->toc, size); |
| 541 | /* ensure any unfilled slots will contain zeroes */ |
| 542 | memset(node->shared_info, 0, size); |
| 543 | node->shared_info->num_workers = pcxt->nworkers; |
| 544 | shm_toc_insert(pcxt->toc, node->ss.ps.plan->plan_node_id, |
| 545 | node->shared_info); |
| 546 | } |
| 547 | |
| 548 | /* ---------------------------------------------------------------- |
| 549 | * ExecSortInitializeWorker |
no test coverage detected