diff --git a/qgate_perf/parallel_probe.py b/qgate_perf/parallel_probe.py index 919f9bc..d16eedc 100644 --- a/qgate_perf/parallel_probe.py +++ b/qgate_perf/parallel_probe.py @@ -2,6 +2,7 @@ import time import os, sys, math import json + from qgate_perf.file_format import FileFormat from qgate_perf.run_setup import RunSetup @@ -23,10 +24,13 @@ def __init__(self, run_setup: RunSetup, exception=None): self.standard_deviation=0 self.pid = os.getpid() self.exception = exception - self.track_time={} self.track_time[FileFormat.PRF_DETAIL_TIME_INIT]=datetime.datetime.utcnow() + # setup default values 1/1/1970 for keys 'TIME_START' and 'TIME_END' + self.track_time[FileFormat.PRF_DETAIL_TIME_START]=datetime.datetime(1970,1,1) + self.track_time[FileFormat.PRF_DETAIL_TIME_END]=datetime.datetime(1970,1,1) + if run_setup: # init incremental calculation of standard deviation self.stddev = self.StandardDeviation(ddof=0) @@ -90,12 +94,13 @@ def _wait_for_others(self, when_start, tollerance=0.1): def ToString(self): """ Provider view to return value """ + if self.exception is None: out={ FileFormat.PRF_TYPE: FileFormat.PRF_DETAIL_TYPE, FileFormat.PRF_DETAIL_PROCESSID: self.pid, FileFormat.PRF_DETAIL_CALLS: self.counter, - FileFormat.PRF_DETAIL_AVRG: self.total_duration / self.counter, + FileFormat.PRF_DETAIL_AVRG: math.nan if self.counter == 0 else self.total_duration / self.counter, FileFormat.PRF_DETAIL_MIN: self.min_duration, FileFormat.PRF_DETAIL_MAX: self.max_duration, FileFormat.PRF_DETAIL_STDEV: self.standard_deviation,