From 36a1d6ef801fe2ade27e173b23bb13fe29213d11 Mon Sep 17 00:00:00 2001 From: Andrea Bastoni Date: Tue, 23 Mar 2010 14:58:21 -0400 Subject: Change format from [hard|soft]_pm.. to pm... - Requested plot type (default hard rt) is specified through option --type - Add overhead type in csv files as a comment - Fix wrong compacting (columns shuffling) - Minor fixes --- compact_pm_ovd.py | 11 ++++------- plot_pm.py | 26 ++++++++++++++++---------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/compact_pm_ovd.py b/compact_pm_ovd.py index 0a25e0c..3b646ca 100755 --- a/compact_pm_ovd.py +++ b/compact_pm_ovd.py @@ -18,11 +18,7 @@ def build_name(dirname, conf, wss_list): if dirname == '': dirname = '.' outname = dirname + '/' - if 'hard' in conf: - outname += 'hard' - else: - outname += 'soft' - outname += '_pm_plugin=' + conf['plugin'] + '_dist=' + conf['dist'] + outname += 'pm_plugin=' + conf['plugin'] + '_dist=' + conf['dist'] # atm we use only uniform for PM (we also use only light, but...) if 'light' in conf: outname += '_light' @@ -64,8 +60,7 @@ class WSSCompactor(): self.wss_list.sort() outname = build_name(dirname, conf, self.wss_list) csvf = open(outname, 'w') - csvf.write('# preemption and migration overhead for ' + \ - conf['plugin'] + '\n') + csvf.write('# ' + conf['plugin'] + ' ' + conf['ovd'] + '\n') wstr = '# tssize, ' for wss in self.wss_list: @@ -82,6 +77,8 @@ class WSSCompactor(): for value in self.ovhead_table[str(key)]: if float(value) > 0: wstr += value + ', ' + else: + wstr += '0.00000, ' wstr = wstr[0:-2] csvf.write(wstr + '\n') diff --git a/plot_pm.py b/plot_pm.py index 2fb04c5..9190d8e 100755 --- a/plot_pm.py +++ b/plot_pm.py @@ -24,9 +24,10 @@ output WHEN using --all'), defaults = { 'sharedL3' : False, 'alloh' : False, + 'type' : 'hard', 'format' : 'show', 'xrange' : (74.5, 250.5), - 'yrange' : (0, 4300.05), + 'yrange' : (0, 4350.05), 'xticks' : (0, 10), 'yticks' : (0, 100), 'title' : None, @@ -167,12 +168,16 @@ class PmPlotter(defapp.App): title = overhead_heading(conf, sharedL3=self.options.sharedL3) title += ' ; ' + scenario_heading(conf, want_period=True) plugin = conf['plugin'] + if 'soft' in conf: + name = 'soft_' + name + else: + name = 'hard_' + name wsslist = conf['wss'].split(',') graphs = [] wsspos = 2 + if 'soft' in conf: + wsspos += 1 for i in wsslist: - if 'soft' in conf: - wsspos += 1 label = plugin + ' WSS=' + i graphs.append((tmpfile, 1, wsspos, label)) wsspos += 2 @@ -189,21 +194,21 @@ class PmPlotter(defapp.App): self.title += ' ; ' wsslist = conf['wss'].split(',') wsspos = 2 + if 'soft' in conf: + wsspos += 1 for i in wsslist: - if 'soft' in conf: - wsspos += 1 label = conf['plugin'] + ' ' + conf['ovd'] + ' WSS=' + i self.graphs_list.append((tmpfile, 1, wsspos, label)) wsspos += 2 - def plot_graph_list(self, name='blob', conf='hard'): + def plot_graph_list(self, type, name='blob'): self.title = self.title[0:-3] if self.options.paper and self.options.format == 'pdf': - self.plot_paper(self.graphs_list, self.title, name, conf) + self.plot_paper(self.graphs_list, self.title, name, type) elif self.options.wide and self.options.format == 'pdf': - self.plot_wide(self.graphs_list, self.title, name, conf) + self.plot_wide(self.graphs_list, self.title, name, type) else: - self.plot(self.graphs_list, self.title, name, conf) + self.plot(self.graphs_list, self.title, name, type) # delete temporary data files for tmp in self.tmpfile_list: @@ -220,6 +225,7 @@ class PmPlotter(defapp.App): tmpfile = get_data_tmpfile(datafile) if tmpfile: if 'pm' in conf: + conf[self.options.type] = None if self.options.alloh: self.add_to_graph_list(tmpfile.name, name, conf) else: @@ -244,7 +250,7 @@ class PmPlotter(defapp.App): if self.options.alloh: # also clean up tmp data files - self.plot_graph_list(self.options.name, self.options.type) + self.plot_graph_list(self.options.type, self.options.name) if __name__ == "__main__": PmPlotter().launch() -- cgit v1.2.2