Commit 1383ec9e authored by Joanne Hugé's avatar Joanne Hugé

Optimize histogram measures add

parent dfd7f72d
...@@ -73,7 +73,7 @@ class MeasureSetHandler: ...@@ -73,7 +73,7 @@ class MeasureSetHandler:
mid = self.measure_sets[mtype]['ids'][0] mid = self.measure_sets[mtype]['ids'][0]
print(" Deleting {}{}...".format(mtype, mid)) print(" Deleting {}{}...".format(mtype, mid))
self.remove_measure_set(mtype, mid) self.remove_measure_set(mtype, mid)
print("Removed all measures".format(mtype, mid)) print("Removed all measures")
def generate_graphs(self): def generate_graphs(self):
...@@ -206,6 +206,7 @@ class MeasureSet: ...@@ -206,6 +206,7 @@ class MeasureSet:
'board': 'Board name', 'board': 'Board name',
'boot_p': 'Boot Parameters', 'boot_p': 'Boot Parameters',
'delta': 'ETF qdisc delta', 'delta': 'ETF qdisc delta',
'load': 'Device and processor load',
} }
def __init__(self): def __init__(self):
...@@ -217,6 +218,8 @@ class MeasureSet: ...@@ -217,6 +218,8 @@ class MeasureSet:
self.metadata['i'] = "200us" self.metadata['i'] = "200us"
self.metadata['delta'] = "200us" self.metadata['delta'] = "200us"
self.metadata['prio'] = "200us" self.metadata['prio'] = "200us"
self.metadata['load'] = "ssh"
self.metadata['duration'] = "24h"
self.props = [] self.props = []
self.props_name = [] self.props_name = []
...@@ -286,12 +289,24 @@ class MeasureSet: ...@@ -286,12 +289,24 @@ class MeasureSet:
self.var = [] self.var = []
for prop in props: for prop in props:
chrono = MeasureSet.histogram_to_chronological(prop)
self.max.append(max(chrono))
self.min.append(min(chrono))
self.avg.append(statistics.mean(chrono))
self.var.append(statistics.variance(chrono))
enumerate_prop = list(enumerate(prop))
self.max.append(max(list(map(lambda x: x[0] if x[1] else 0, enumerate_prop))))
self.min.append(max(map(lambda x: x[0] if x[1] else 0, enumerate_prop)))
sum_prop = sum(prop)
avg = sum(map(lambda x: x[0]*x[1], enumerate_prop)) / sum_prop
var = 0
for x, p in enumerate_prop:
var += p * x**2
var /= sum_prop
var -= avg**2
self.avg.append(avg)
self.var.append(var)
def export_to_json(self, path): def export_to_json(self, path):
with open(path, 'w') as outfile: with open(path, 'w') as outfile:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment