Fix duration in multi-threaded mode.

This commit is contained in:
Joseph Cloutier
2022-03-25 17:24:43 -04:00
parent f5676afa58
commit 05322f0dfa
2 changed files with 9 additions and 4 deletions

View File

@@ -338,7 +338,7 @@ class ThreadPool extends WorkOutput
}
while (!Std.isOfType(job, ThreadEvent));
output.resetJobProgress();
output.resetJobProgress(timestamp());
}
if (job.event == EXIT)
@@ -377,7 +377,7 @@ class ThreadPool extends WorkOutput
else if(Std.isOfType(interruption, ThreadEvent))
{
job = interruption;
output.resetJobProgress();
output.resetJobProgress(timestamp());
}
else
{
@@ -390,7 +390,7 @@ class ThreadPool extends WorkOutput
}
#end
private inline function timestamp():Float
private static inline function timestamp():Float
{
#if sys
return Sys.cpuTime();

View File

@@ -166,9 +166,14 @@ class WorkOutput
}
}
private inline function resetJobProgress():Void
/**
@param now `WorkOutput` won't compile if it includes any references to
`haxe.Timer`, so the child class must supply the current time instead.
**/
private inline function resetJobProgress(now:Float):Void
{
__jobComplete.value = false;
__jobStartTime.value = now;
workIterations.value = 0;
}