From 05da44afb031ceefc3e6e97d3c34b5b3a05472a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=2E=20Brandenburg?= Date: Wed, 9 Jun 2010 15:16:41 -0400 Subject: add --experiment option for override --- plot.py | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'plot.py') diff --git a/plot.py b/plot.py index f1b073c..baff939 100755 --- a/plot.py +++ b/plot.py @@ -15,6 +15,9 @@ options = [ choices=FORMATS, help='output format'), o(None, '--save-script', action='store_true', dest='save_script'), + o('-e', '--experiment', action='store', dest='experiment', + help="override auto-detection of experiment"), + # formatting options # These may or may not be supported by a particular experiment plotter. o(None, '--paper', action='store_true', dest='paper'), @@ -27,6 +30,7 @@ options = [ defaults = { # output options 'format' : 'show', + 'experiment' : None, 'save_script' : False, # formatting options @@ -490,25 +494,29 @@ class SchedPlotter(defapp.App): except IOError: tmpfile = None if tmpfile: - if 'spec' in conf: - self.plot_spec(tmpfile.name, name, conf) - elif 'spec2' in conf: - self.plot_spec2(tmpfile.name, name, conf) - elif 'spec3' in conf: - self.plot_spec3(tmpfile.name, name, conf) - elif 'spec4' in conf: - self.plot_spec4(tmpfile.name, name, conf) - elif 'irq' in conf: - self.plot_irq(tmpfile.name, name, conf) - elif 'rtss08' in conf: - self.plot_rtss08(tmpfile.name, name, conf) - elif 'rtss09' in conf: - if self.options.split: - self.plot_rtss09_split(tmpfile.name, name, conf) - else: - self.plot_rtss09(tmpfile.name, name, conf) - elif 'ospert10' in conf: - self.plot_ospert10(tmpfile.name, name, conf) + plotters = { + 'spec' : self.plot_spec, + 'spec2' : self.plot_spec2, + 'spec3' : self.plot_spec3, + 'spec4' : self.plot_spec4, + 'irq' : self.plot_irq, + 'rtss08' : self.plot_rtss08, + 'rtss09' : self.plot_rtss09_split if self.options.split else self.plot_rtss09, + 'ospert10' : self.plot_ospert10, + } + + if self.options.experiment: + # override provided + plot_type = self.options.experiment + else: + # no type provided, try each plotter + for plot_type in plotters: + if plot_type in conf: + break + if not plot_type in conf: + plot_type = 'unknown' + if plot_type in plotters: + plotters[plot_type](tmpfile.name, name, conf) else: self.err("Skipped '%s'; unkown experiment type." % bname) -- cgit v1.2.2