From c015cea3413f825490b13e04e5c3d966772712f7 Mon Sep 17 00:00:00 2001 From: Leo Yan Date: Sun, 12 Jun 2016 14:48:27 +0800 Subject: [PATCH] libs/utils/trace_analysis: fix for image file name trace_analysis automatically saves image for method trace_analysis::plotTasks(), which conjunct task name for saving image file. But sometimes task name has special characters (like ':', '/'), so Linux cannot support these characters for file name. So this patch is to fix this failure to convert special characters to underline '_'. Signed-off-by: Leo Yan --- libs/utils/trace_analysis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/utils/trace_analysis.py b/libs/utils/trace_analysis.py index a708513d2..2a96f8de7 100644 --- a/libs/utils/trace_analysis.py +++ b/libs/utils/trace_analysis.py @@ -470,8 +470,8 @@ class TraceAnalysis(object): plot_id = plot_id + 1 # Save generated plots into datadir - figname = '{}/{}task_util_{}.png'.format( - self.plotsdir, self.prefix, task_name.replace('/', '_')) + task_name = re.sub('[:/]', '_', task_name) + figname = '{}/{}task_util_{}.png'.format(self.plotsdir, self.prefix, task_name) pl.savefig(figname, bbox_inches='tight') def plotEDiffTime(self, tasks=None, -- GitLab