Commit 00039840 authored by Joanne Hugé's avatar Joanne Hugé

WIP

parent 6a1b2c3f
...@@ -77,34 +77,53 @@ class MeasureSetHandler: ...@@ -77,34 +77,53 @@ class MeasureSetHandler:
def generate_graphs(self): def generate_graphs(self):
colors = ['red', 'blue', 'green'] # List of colors to use to superimpose the different plots
colors = ['red', 'blue', 'green', 'purple', 'yellow']
# For each type of measure set
for mtype in self.measure_sets: for mtype in self.measure_sets:
# List all the measures of this type
measures = [] measures = []
for mid in self.measure_sets[mtype]['ids']: for mid in self.measure_sets[mtype]['ids']:
measures.append(self.get_measure_set("{}{}".format(mtype, mid))) measures.append(self.get_measure_set("{}{}".format(mtype, mid)))
if len(measures) == 0: if len(measures) == 0:
continue continue
# Get the type and number of properties, which are all identical for
# measures of the same type
props_type = measures[0].props_type
nb_props = len(measures[0].props) nb_props = len(measures[0].props)
# For each property draw a graph
for i in range(nb_props): for i in range(nb_props):
prop_name = measures[0].props_names[i]
# Superimpose all the different measures of the same type and property type
for j, mid in enumerate(self.measure_sets[mtype]['ids']): for j, mid in enumerate(self.measure_sets[mtype]['ids']):
measure = self.get_measure_set("{}{}".format(mtype, mid)) measure = self.get_measure_set("{}{}".format(mtype, mid))
graph_name = "{}{}".format(mtype, mid) graph_name = "{}{}".format(mtype, mid)
measure.generate_histogram(i, colors[j]) if props_type == 'histogram':
measure.generate_histogram(i, colors[j])
else:
measure.generate_chrono_graph(i, colors[j])
fig, ax = plt.gcf(), plt.gca() fig, ax = plt.gcf(), plt.gca()
ax.set_xlabel('Latency (us)')
ax.set_ylabel('Number of latency samples')
ax.set_title('{}, {} histogram'.format(mtype, measures[0].props_names[i]))
# Set meta graph information
if props_type == 'histogram':
ax.set_xlabel('Latency (us)')
ax.set_ylabel('Number of latency samples')
ax.set_title('{}, {} histogram'.format(mtype, prop_name))
else:
ax.set_xlabel('Time (us)')
ax.set_ylabel(prop_name)
ax.set_title('{}, {} graph'.format(mtype, prop_name))
fig.set_size_inches(11.0, 5.5) fig.set_size_inches(11.0, 5.5)
plt.savefig("{}/{}{}.png".format(MeasureSetHandler.graphs_dir, mtype, measures[0].props_names[i])) # Save the graph
plt.savefig("{}/{}{}.png".format(MeasureSetHandler.graphs_dir, mtype, props_name))
def generate_report(self, include_graphs=True): def generate_report(self, include_graphs=True):
...@@ -351,6 +370,11 @@ class MeasureSet: ...@@ -351,6 +370,11 @@ class MeasureSet:
if self.props[i][j] > 0 and height < min_height: if self.props[i][j] > 0 and height < min_height:
patch.set_height(min_height) patch.set_height(min_height)
def generate_chrono_graph(self, i, color):
prop = self.props[i]
x = [i for i in range(len(prop))]
plt.plot(x, prop, color=color)
def generate_table(self, headers=True, values=True, metadata_mask=[], props_lens=[]): def generate_table(self, headers=True, values=True, metadata_mask=[], props_lens=[]):
if headers == False and values == False: if headers == False and values == False:
......
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