HPCC-10414 Add general statistics to the workunit

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
HPCC-10414 Clean up various issues with new stats code

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Merge pull request #5168 from ghalliday/issue10414

HPCC-10414 Add general statistics to the workunit

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>