Add more documentation
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
cb0a3ea1ba
commit
98db10f7a6
|
@ -58,6 +58,17 @@ class Observer:
|
|||
return (arrived, expected, ready, validated)
|
||||
|
||||
def getProgress(self, validators):
|
||||
"""Calculate current simulation progress with different metrics.
|
||||
|
||||
Returns:
|
||||
- missingSamples: overall number of sample instances missing in nodes.
|
||||
Sample are counted on both rows and columns, so intersections of interest are counted twice.
|
||||
- sampleProgress: previous expressed as progress ratio
|
||||
- nodeProgress: ratio of nodes having all segments interested in
|
||||
- validatorProgress: same as above, but vpn weighted average. I.e. it counts per validator,
|
||||
but counts a validator only if its support node's all validators see all interesting segments
|
||||
TODO: add real per validator progress counter
|
||||
"""
|
||||
arrived, expected, ready, validated = self.checkStatus(validators)
|
||||
missingSamples = expected - arrived
|
||||
sampleProgress = arrived / expected
|
||||
|
@ -68,6 +79,7 @@ class Observer:
|
|||
return missingSamples, sampleProgress, nodeProgress, validatorProgress
|
||||
|
||||
def getTrafficStats(self, validators):
|
||||
"""Summary statistics of traffic measurements in a timestep."""
|
||||
def maxOrNan(l):
|
||||
return np.max(l) if l else np.NaN
|
||||
def meanOrNan(l):
|
||||
|
|
|
@ -28,6 +28,7 @@ class Result:
|
|||
self.tta = -1
|
||||
|
||||
def addMetric(self, name, metric):
|
||||
"""Generic function to add a metric to the results."""
|
||||
self.metrics[name] = metric
|
||||
|
||||
def dump(self, execID):
|
||||
|
|
Loading…
Reference in New Issue