diff options
Diffstat (limited to 'pm_data_analysis/pm_data_analyzer.py')
-rwxr-xr-x | pm_data_analysis/pm_data_analyzer.py | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/pm_data_analysis/pm_data_analyzer.py b/pm_data_analysis/pm_data_analyzer.py index f6730de..63baa27 100755 --- a/pm_data_analysis/pm_data_analyzer.py +++ b/pm_data_analysis/pm_data_analyzer.py | |||
@@ -41,6 +41,8 @@ to NONCHIP"), | |||
41 | o(None, "--limit-offchip", dest="noffchip", action="store", type="int", | 41 | o(None, "--limit-offchip", dest="noffchip", action="store", type="int", |
42 | help="Limit the number of offchip sample used in statistics \ | 42 | help="Limit the number of offchip sample used in statistics \ |
43 | to NOFFCHIP"), | 43 | to NOFFCHIP"), |
44 | o("-a", "--autocap", dest="autocap", action="store_true", | ||
45 | help="Autodetect the minimum number of samples to use for statistics"), | ||
44 | o("-r", "--read-valid-data", dest="read_valid", action="store_true", | 46 | o("-r", "--read-valid-data", dest="read_valid", action="store_true", |
45 | help="read already processed data from file"), | 47 | help="read already processed data from file"), |
46 | o("-v", "--verbose", dest="verbose", action="store_true"), | 48 | o("-v", "--verbose", dest="verbose", action="store_true"), |
@@ -100,6 +102,7 @@ class Overhead: | |||
100 | class Analyzer(defapp.App): | 102 | class Analyzer(defapp.App): |
101 | def __init__(self): | 103 | def __init__(self): |
102 | defapp.App.__init__(self, options, defaults, no_std_opts=True) | 104 | defapp.App.__init__(self, options, defaults, no_std_opts=True) |
105 | self.min_sample_wss = {} | ||
103 | self.lsamples = {} | 106 | self.lsamples = {} |
104 | if self.options.npreempt: | 107 | if self.options.npreempt: |
105 | self.lsamples['preemption'] = self.options.npreempt | 108 | self.lsamples['preemption'] = self.options.npreempt |
@@ -172,9 +175,30 @@ class Analyzer(defapp.App): | |||
172 | for i in self.valid_ovds: | 175 | for i in self.valid_ovds: |
173 | print "samples(%(0)s) = %(1)d" % {"0":i[1], "1":len(i[0])} | 176 | print "samples(%(0)s) = %(1)d" % {"0":i[1], "1":len(i[0])} |
174 | 177 | ||
175 | if self.options.verbose: | 178 | count_sample = {} |
179 | if self.options.autocap or self.options.verbose: | ||
176 | for i in self.valid_ovds: | 180 | for i in self.valid_ovds: |
177 | print "samples(%(0)s) = %(1)d" % {"0":i[1], "1":len(i[0])} | 181 | if self.options.verbose: |
182 | print "samples(%(0)s) = %(1)d" % {"0":i[1], "1":len(i[0])} | ||
183 | count_sample[i[1]] = len(i[0]) | ||
184 | |||
185 | if self.options.autocap: | ||
186 | if conf['wss'] in self.min_sample_wss: | ||
187 | # it is normally sufficient to check num samples for | ||
188 | # preemptions to get tss with min num samples in wss | ||
189 | if self.min_sample_wss[conf['wss']]['preemption'] > \ | ||
190 | count_sample['preemption']: | ||
191 | self.min_sample_wss[conf['wss']] = {'tss':conf['tss'], | ||
192 | 'preemption':count_sample['preemption'], | ||
193 | 'onchip':count_sample['onchip'], | ||
194 | 'offchip':count_sample['offchip'], | ||
195 | 'l2cache':count_sample['l2cache']} | ||
196 | else: | ||
197 | self.min_sample_wss[conf['wss']] = {'tss':conf['tss'], | ||
198 | 'preemption':count_sample['preemption'], | ||
199 | 'onchip':count_sample['onchip'], | ||
200 | 'offchip':count_sample['offchip'], | ||
201 | 'l2cache':count_sample['l2cache']} | ||
178 | 202 | ||
179 | # serialize valid overheads | 203 | # serialize valid overheads |
180 | for i in self.valid_ovds: | 204 | for i in self.valid_ovds: |
@@ -220,8 +244,13 @@ class Analyzer(defapp.App): | |||
220 | print "Computing %(0)s stat only on %(1)d samples" % \ | 244 | print "Computing %(0)s stat only on %(1)d samples" % \ |
221 | {"0":i[1], | 245 | {"0":i[1], |
222 | "1":nsamples} | 246 | "1":nsamples} |
223 | |||
224 | vector = i[0][0:nsamples] | 247 | vector = i[0][0:nsamples] |
248 | elif self.options.autocap: # we can also autocompute the cap | ||
249 | nsamples = self.min_sample_wss[conf['wss']][i[1]] | ||
250 | if self.options.verbose: | ||
251 | print "Computing %(0)s stat only on %(1)d samples" % \ | ||
252 | {"0":i[1], "1":nsamples} | ||
253 | vector = i[0][0:nsamples] | ||
225 | else: | 254 | else: |
226 | vector = i[0] | 255 | vector = i[0] |
227 | 256 | ||