diff options
Diffstat (limited to 'parse')
-rw-r--r-- | parse/ft.py | 12 | ||||
-rw-r--r-- | parse/sched.py | 8 | ||||
-rw-r--r-- | parse/tuple_table.py | 5 |
3 files changed, 17 insertions, 8 deletions
diff --git a/parse/ft.py b/parse/ft.py index 127e49f..c915978 100644 --- a/parse/ft.py +++ b/parse/ft.py | |||
@@ -6,7 +6,10 @@ import subprocess | |||
6 | 6 | ||
7 | from point import Measurement,Type | 7 | from point import Measurement,Type |
8 | 8 | ||
9 | def get_ft_output(data_dir, out_dir): | 9 | def get_ft_output(data_dir, out_dir, force=False): |
10 | """ | ||
11 | Create and return files containing sorted and analyzed overhead data | ||
12 | """ | ||
10 | bin_file = conf.FILES['ft_data'] + "$" | 13 | bin_file = conf.FILES['ft_data'] + "$" |
11 | bins = [f for f in os.listdir(data_dir) if re.match(bin_file, f)] | 14 | bins = [f for f in os.listdir(data_dir) if re.match(bin_file, f)] |
12 | 15 | ||
@@ -14,8 +17,11 @@ def get_ft_output(data_dir, out_dir): | |||
14 | output_file = "{}/out-ft".format(out_dir) | 17 | output_file = "{}/out-ft".format(out_dir) |
15 | 18 | ||
16 | if os.path.isfile(output_file): | 19 | if os.path.isfile(output_file): |
17 | print("ft-output already exists for %s" % data_dir) | 20 | if force: |
18 | return output_file | 21 | os.remove(output_file) |
22 | else: | ||
23 | print("ft-output already exists for %s" % data_dir) | ||
24 | return output_file | ||
19 | 25 | ||
20 | if len(bins) != 0: | 26 | if len(bins) != 0: |
21 | err_file = open("%s/err-ft" % out_dir, 'w') | 27 | err_file = open("%s/err-ft" % out_dir, 'w') |
diff --git a/parse/sched.py b/parse/sched.py index 300c569..a65f001 100644 --- a/parse/sched.py +++ b/parse/sched.py | |||
@@ -50,7 +50,7 @@ class LeveledArray(object): | |||
50 | name = "%s%s" % ("%s-" % level if level else "", self.name) | 50 | name = "%s%s" % ("%s-" % level if level else "", self.name) |
51 | result[name] = Measurement(name).from_array(arr) | 51 | result[name] = Measurement(name).from_array(arr) |
52 | 52 | ||
53 | def get_st_output(data_dir, out_dir): | 53 | def get_st_output(data_dir, out_dir, force=False): |
54 | """ | 54 | """ |
55 | Create and return files containing unpacked sched data | 55 | Create and return files containing unpacked sched data |
56 | """ | 56 | """ |
@@ -60,7 +60,11 @@ def get_st_output(data_dir, out_dir): | |||
60 | output_file = "%s/out-st" % out_dir | 60 | output_file = "%s/out-st" % out_dir |
61 | 61 | ||
62 | if os.path.isfile(output_file): | 62 | if os.path.isfile(output_file): |
63 | return output_file | 63 | if force: |
64 | os.remove(output_file) | ||
65 | else: | ||
66 | print("st-output already exists for %s" % data_dir) | ||
67 | return output_file | ||
64 | 68 | ||
65 | if len(bins) != 0: | 69 | if len(bins) != 0: |
66 | cmd_arr = [conf.BINS['st_show']] | 70 | cmd_arr = [conf.BINS['st_show']] |
diff --git a/parse/tuple_table.py b/parse/tuple_table.py index e6f0cc5..5e98d87 100644 --- a/parse/tuple_table.py +++ b/parse/tuple_table.py | |||
@@ -24,7 +24,7 @@ class ColMap(object): | |||
24 | if added < len(kv): | 24 | if added < len(kv): |
25 | raise Exception("column map '%s' missed field in map '%s'" % | 25 | raise Exception("column map '%s' missed field in map '%s'" % |
26 | (self.col_list, kv)) | 26 | (self.col_list, kv)) |
27 | 27 | ||
28 | return key | 28 | return key |
29 | 29 | ||
30 | def __contains__(self, col): | 30 | def __contains__(self, col): |
@@ -58,7 +58,7 @@ class TupleTable(object): | |||
58 | key = self.col_map.get_key(kv) | 58 | key = self.col_map.get_key(kv) |
59 | return self.table[key] | 59 | return self.table[key] |
60 | 60 | ||
61 | def __reduce(self): | 61 | def reduce(self): |
62 | if self.reduced: | 62 | if self.reduced: |
63 | raise Exception("cannot reduce twice!") | 63 | raise Exception("cannot reduce twice!") |
64 | self.reduced = True | 64 | self.reduced = True |
@@ -67,7 +67,6 @@ class TupleTable(object): | |||
67 | 67 | ||
68 | def write_result(self, out_dir): | 68 | def write_result(self, out_dir): |
69 | dir_map = DirMap(out_dir) | 69 | dir_map = DirMap(out_dir) |
70 | self.__reduce() | ||
71 | for key, point in self.table.iteritems(): | 70 | for key, point in self.table.iteritems(): |
72 | kv = self.col_map.get_map(key) | 71 | kv = self.col_map.get_map(key) |
73 | 72 | ||