Skip to content

Commit

Permalink
HPCC-32329 Dfuserver crash calculating progress percentage
Browse files Browse the repository at this point in the history
Signed-off-by: M Kelly <[email protected]>
  • Loading branch information
mckellyln authored and ghalliday committed Jul 30, 2024
1 parent b29c45c commit 714fcd4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions dali/ft/daftprogress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,22 @@ void DaftProgress::onProgress(unsigned __int64 sizeDone, unsigned __int64 totalS
unsigned secsLeft = (unsigned)(timeLeft * cycleToNanoScale /1000000000);
char temp[20];
formatTime(temp, secsLeft);
displayProgress((unsigned)(sizeDone*100/totalSize), secsLeft, temp,
sizeDone/scale,totalSize/scale,scaleUnit,
(unsigned)(msGone ? (sizeDone-startSize)/msGone : 0),

unsigned percentDone = (unsigned)(totalSize ? (sizeDone*100/totalSize) : 100);

unsigned __int64 kbPerSecond = (sizeDone-startSize) / 1024;
if (msGone) // if took no time, leave as max total kb.
kbPerSecond = (kbPerSecond * 1000) / msGone;

displayProgress(percentDone, secsLeft, temp,
sizeDone/scale, totalSize/scale, scaleUnit,
(unsigned)kbPerSecond,
(unsigned)(recentTimeDelta ? recentSizeDelta / recentTimeDelta : 0), numNodes, numReads, numWrites);

if (sizeDone == totalSize)
{
formatTime(temp, (unsigned)(msGone/1000));
displaySummary(temp, (unsigned)((totalSize - startSize)/msGone));
displaySummary(temp, (unsigned)kbPerSecond);
}
}
}
Expand Down

0 comments on commit 714fcd4

Please sign in to comment.