Commit c9293310 authored by Stanislav Bohm's avatar Stanislav Bohm
Browse files

ENH: rview: ctransfer chart improved

parent b28f71da
......@@ -241,25 +241,41 @@ class Report:
task_start_ts.pop(event.id)
return data
def get_ctransfer_data(self):
def get_ctransfer_data(self, intra):
SEND_START = loomcomm.Event.SEND_START
TASK_END = loomcomm.Event.TASK_END
intra = ([0], [0])
results = ([0], [0])
sizes = {}
label_groups, group_names = self.collect_labels()
symbols = self.symbols
group_names.append("SUM")
results = []
for name in group_names:
results.append(([0], [0], name))
total = results[-1]
for event in self.report_msg.events:
if event.type == TASK_END:
sizes[event.id] = event.size
elif event.type == SEND_START:
if event.target_worker_id == -1:
data = results
if (intra and event.target_worker_id == -1) or \
(not intra and event.target_worker_id != -1):
continue
task_id = event.id
total[0].append(event.time)
total[1].append(total[1][-1] + sizes[task_id])
task = self.report_msg.plan.tasks[task_id]
if task.label:
label = task.label
else:
data = intra
label = symbols[task.task_type]
group = label_groups[label]
data = results[group]
data[0].append(event.time)
data[1].append(data[1][-1] + sizes[event.id])
return intra, results
return results
def get_btime_data(self):
TASK_START = loomcomm.Event.TASK_START
......
......@@ -120,10 +120,28 @@ def show_trace(report):
def show_ctransfer(report):
intra, results = report.get_ctransfer_data()
plt.plot(intra[0], intra[1], label="Intra worker")
plt.plot(results[0], results[1], label="Results")
plt.legend(loc='upper left')
results1 = report.get_ctransfer_data(True)
results2 = report.get_ctransfer_data(False)
f, (c1, c2, c3) = plt.subplots(3, sharex=True)
assert f # silence nonused f
c1.set_title("Total transfers")
c1.plot(results1[-1][0], results1[-1][1], label="Intra")
c1.plot(results2[-1][0], results2[-1][1], label="Results")
c2.set_title("Intra transfers per label")
for data0, data1, label in results1[:-1]:
c2.plot(data0, data1, label=label)
c3.set_title("Result transfers per label")
for data0, data1, label in results2[:-1]:
c3.plot(data0, data1, label=label)
c1.legend(loc='upper left')
c2.legend(loc='upper left')
plt.show(block=True)
......
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