From cb374bbcf0051284c9f1fe21dfab94a4d26628cc Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Thu, 27 Jul 2017 17:41:36 +0100 Subject: [PATCH] Don't plot the fake thread we just use its range to colour the background --- examples/plot_threadpool.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/plot_threadpool.py b/examples/plot_threadpool.py index a5881397c0..ddef9883c2 100755 --- a/examples/plot_threadpool.py +++ b/examples/plot_threadpool.py @@ -209,6 +209,18 @@ fig = pl.figure() ax = fig.add_subplot(1,1,1) ax.set_xlim(-delta_t * 0.01 / CPU_CLOCK, delta_t * 1.01 / CPU_CLOCK) ax.set_ylim(0, nthread) + +# Fake thread is used to colour the whole range, do that first. +tictocs = [] +colours = [] +j = 0 +for task in tasks[nthread-1]: + tictocs.append((task["tic"], task["toc"] - task["tic"])) + colours.append(task["colour"]) +ax.broken_barh(tictocs, [0,(nthread-1)], facecolors = colours, linewidth=0, alpha=0.15) + +# And we don't plot the fake thread. +nthread = nthread - 1 for i in range(nthread): # Collect ranges and colours into arrays. -- GitLab