Skip to content

Commit

Permalink
Merge pull request #10 from george0st/changes
Browse files Browse the repository at this point in the history
Changes
  • Loading branch information
george0st authored Oct 13, 2023
2 parents 5d71b96 + 252a8d8 commit 3a1e15e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions qgate_perf/parallel_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3a1e15e

Please sign in to comment.