Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-32480 Capture "look ahead" timings for unordered concat (parallel funnel) #19164

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions thorlcr/activities/funnel/thfunnelslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,24 @@ class CParallelFunnel : implements IRowStream, public CSimpleInterface
unsigned numRows = 0;
try
{
funnel.activity.startInput(inputIndex);
{
LookAheadTimer timer(funnel.activity.getActivityTimerAccumulator(), funnel.activity.queryTimeActivities());
funnel.activity.startInput(inputIndex);
}
started = true;
inputStream = funnel.activity.queryInputStream(inputIndex);
while (!stopping)
{
numRows = 0;
for (;numRows < chunkSize; numRows++)
{
const void * row = inputStream->ungroupedNextRow();
if (!row)
break;
rows[numRows] = row;
LookAheadTimer timer(funnel.activity.getActivityTimerAccumulator(), funnel.activity.queryTimeActivities());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for efficiency should move this outside of the for loop.

for (;numRows < chunkSize; numRows++)
{
const void * row = inputStream->ungroupedNextRow();
if (!row)
break;
rows[numRows] = row;
}
}

if (numRows == 0) break;
Expand Down Expand Up @@ -141,13 +147,12 @@ class CParallelFunnel : implements IRowStream, public CSimpleInterface
Linked<IOutputRowSerializer> serializer;

void push(const void *row)
{
{
size32_t rowSize = thorRowMemoryFootprint(serializer, row);

bool waitForSpace = false;
// only allow a single writer at a time, so only a single thread is waiting on the semaphore - otherwise signal() takes a very long time
{

CriticalBlock b(crit); // will mean first 'push' could block on fullSem, others on this crit.
if (stopped)
{
Expand Down Expand Up @@ -376,7 +381,16 @@ class FunnelSlaveActivity : public CSlaveActivity

auto startInputNFunc = [&](unsigned i)
{
try { startInput(i); }
try
{
if (i == 0) // 1st input is started synchronously, so time already included in start() timing.
startInput(i);
else
{
LookAheadTimer timer(slaveTimerStats, timeActivities);
startInput(i);
}
}
catch (CATCHALL)
{
ActPrintLog("FUNNEL(%" ACTPF "d): Error staring input %d", container.queryId(), i);
Expand Down
Loading