Skip to content

Commit

Permalink
HPCC-31545 Thread pool wait time reporting
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Kelly <[email protected]>
  • Loading branch information
mckellyln committed Mar 28, 2024
1 parent ca74c00 commit 9aade6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions system/jlib/jthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,16 @@ class CThreadPool: public CThreadPoolBase, implements IThreadPool, public CInter
PooledThreadHandle _start(void *param,const char *name, bool noBlock, unsigned timeout=0)
{
CCycleTimer startTimer;
bool timedout = defaultmax && !availsem.wait(noBlock ? 0 : (timeout>0?timeout:delay));
bool waited = false;
bool timedout = false;
if (defaultmax)
{
waited = !availsem.wait(0);
if (noBlock)
timedout = waited;
else if (waited)
timedout = !availsem.wait(timeout>0?timeout:delay);
}
PooledThreadHandle ret;
{
CriticalBlock block(crit);
Expand All @@ -1023,7 +1032,7 @@ class CThreadPool: public CThreadPoolBase, implements IThreadPool, public CInter
if (traceStartDelayPeriod)
{
++startsInPeriod;
if (timedout)
if (waited)
{
startDelayInPeriod += startTimer.elapsedCycles();
if (overAllTimer.elapsedCycles() >= queryOneSecCycles()*traceStartDelayPeriod) // check avg. delay per minute
Expand Down Expand Up @@ -2683,4 +2692,4 @@ void PerfTracer::dostop()
#else
UNIMPLEMENTED;
#endif
}
}
2 changes: 1 addition & 1 deletion thorlcr/slave/slavmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ class CKJService : public CSimpleInterfaceOf<IKJService>, implements IThreaded,
{
Owned<CProcessorFactory> factory = new CProcessorFactory(*this);
processorPool.setown(createThreadPool("KJService processor pool", factory, this, keyLookupMaxProcessThreads, 10000));
processorPool->setStartDelayTracing(60000);
processorPool->setStartDelayTracing(60);
}
public:
IMPLEMENT_IINTERFACE_USING(CSimpleInterfaceOf<IKJService>);
Expand Down

0 comments on commit 9aade6b

Please sign in to comment.