diff options
-rwxr-xr-x | pm_data_analysis/pm_data_analyzer.py | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/pm_data_analysis/pm_data_analyzer.py b/pm_data_analysis/pm_data_analyzer.py index cc6e0a5..ca4267a 100755 --- a/pm_data_analysis/pm_data_analyzer.py +++ b/pm_data_analysis/pm_data_analyzer.py | |||
@@ -67,7 +67,7 @@ defaults = { | |||
67 | 'read_valid': False, | 67 | 'read_valid': False, |
68 | 'verbose' : False, | 68 | 'verbose' : False, |
69 | 'debug' : False, | 69 | 'debug' : False, |
70 | 'cpufrequ' : 0, | 70 | 'cpufreq' : 0, |
71 | } | 71 | } |
72 | 72 | ||
73 | # from Bjoern's simple-gnuplot-wrapper | 73 | # from Bjoern's simple-gnuplot-wrapper |
@@ -104,6 +104,7 @@ class Analyzer(defapp.App): | |||
104 | defapp.App.__init__(self, options, defaults, no_std_opts=True) | 104 | defapp.App.__init__(self, options, defaults, no_std_opts=True) |
105 | self.last_conf = {} | 105 | self.last_conf = {} |
106 | self.valid_ovds_list = {} | 106 | self.valid_ovds_list = {} |
107 | self.min_sample_tss = {} | ||
107 | self.lsamples = {} | 108 | self.lsamples = {} |
108 | if self.options.npreempt: | 109 | if self.options.npreempt: |
109 | self.lsamples['preemption'] = self.options.npreempt | 110 | self.lsamples['preemption'] = self.options.npreempt |
@@ -189,18 +190,18 @@ class Analyzer(defapp.App): | |||
189 | count_sample[i[1]] = len(i[0]) | 190 | count_sample[i[1]] = len(i[0]) |
190 | 191 | ||
191 | if self.options.autocap: | 192 | if self.options.autocap: |
192 | if 'min' in self.valid_ovds_list: | 193 | if self.min_sample_tss == {}: |
194 | self.min_sample_tss = { | ||
195 | 'preemption':count_sample['preemption'], | ||
196 | 'onchip':count_sample['onchip'], | ||
197 | 'offchip':count_sample['offchip'], | ||
198 | 'l2cache':count_sample['l2cache']} | ||
199 | else: | ||
193 | # it is normally sufficient to check num samples for | 200 | # it is normally sufficient to check num samples for |
194 | # preemptions to get tss with min num samples in wss | 201 | # preemptions to get tss with min num samples in wss |
195 | if self.valid_ovds_list['min']['preemption'] > \ | 202 | if self.min_sample_tss['preemption'] > \ |
196 | count_sample['preemption']: | 203 | count_sample['preemption']: |
197 | self.valid_ovds_list['min'] = { | 204 | self.min_sample_tss = { |
198 | 'preemption':count_sample['preemption'], | ||
199 | 'onchip':count_sample['onchip'], | ||
200 | 'offchip':count_sample['offchip'], | ||
201 | 'l2cache':count_sample['l2cache']} | ||
202 | else: | ||
203 | self.valid_ovds_list['min'] = { | ||
204 | 'preemption':count_sample['preemption'], | 205 | 'preemption':count_sample['preemption'], |
205 | 'onchip':count_sample['onchip'], | 206 | 'onchip':count_sample['onchip'], |
206 | 'offchip':count_sample['offchip'], | 207 | 'offchip':count_sample['offchip'], |
@@ -226,11 +227,13 @@ class Analyzer(defapp.App): | |||
226 | csvbname = dname + '/pm_plugin=' + conf['plugin'] + \ | 227 | csvbname = dname + '/pm_plugin=' + conf['plugin'] + \ |
227 | '_dist=uni_light_wss=' + conf['wss'] | 228 | '_dist=uni_light_wss=' + conf['wss'] |
228 | 229 | ||
229 | for tss,vohs in self.valid_ovds_list.iteritems(): | 230 | for tss in sorted(self.valid_ovds_list.keys(), key=int): |
230 | if tss == 'min': | 231 | if tss == 'min': |
231 | # do not analyze fake 'min' tss | 232 | # do not analyze fake 'min' tss |
232 | continue | 233 | continue |
233 | 234 | ||
235 | vohs = self.valid_ovds_list[tss] | ||
236 | |||
234 | if self.options.verbose: | 237 | if self.options.verbose: |
235 | print "\n(WSS = %(0)s, TSS = %(1)s)" % {"0":conf['wss'], \ | 238 | print "\n(WSS = %(0)s, TSS = %(1)s)" % {"0":conf['wss'], \ |
236 | "1":tss} | 239 | "1":tss} |
@@ -258,7 +261,7 @@ class Analyzer(defapp.App): | |||
258 | "1":nsamples} | 261 | "1":nsamples} |
259 | vector = i[0][0:nsamples] | 262 | vector = i[0][0:nsamples] |
260 | elif self.options.autocap: # we can also autocompute the cap | 263 | elif self.options.autocap: # we can also autocompute the cap |
261 | nsamples = self.valid_ovds_list['min'][i[1]] | 264 | nsamples = self.min_sample_tss[i[1]] |
262 | if self.options.verbose: | 265 | if self.options.verbose: |
263 | print "Computing %(0)s stat only on %(1)d samples" % \ | 266 | print "Computing %(0)s stat only on %(1)d samples" % \ |
264 | {"0":i[1], "1":nsamples} | 267 | {"0":i[1], "1":nsamples} |
@@ -333,10 +336,9 @@ class Analyzer(defapp.App): | |||
333 | # this is the first file of a new set of WSS, | 336 | # this is the first file of a new set of WSS, |
334 | # and it is also the last file of the list | 337 | # and it is also the last file of the list |
335 | self.analyze_data(dname, self.last_conf) | 338 | self.analyze_data(dname, self.last_conf) |
336 | # delete previously used dictionary | 339 | # reinit dictionaries |
337 | del self.valid_ovds_list | ||
338 | # reinit dictionary | ||
339 | self.valid_ovds_list = {} | 340 | self.valid_ovds_list = {} |
341 | self.min_sample_tss = {} | ||
340 | # analyze this file | 342 | # analyze this file |
341 | self.process_datafile(datafile, dname, fname, conf) | 343 | self.process_datafile(datafile, dname, fname, conf) |
342 | self.analyze_data(dname, conf) | 344 | self.analyze_data(dname, conf) |
@@ -357,10 +359,9 @@ class Analyzer(defapp.App): | |||
357 | # this is the first file of a new set of WSS, | 359 | # this is the first file of a new set of WSS, |
358 | # analyze tss for previous wss | 360 | # analyze tss for previous wss |
359 | self.analyze_data(dname, self.last_conf) | 361 | self.analyze_data(dname, self.last_conf) |
360 | # delete previously used dictionary | ||
361 | del self.valid_ovds_list | ||
362 | # reinit dictionary | 362 | # reinit dictionary |
363 | self.valid_ovds_list = {} | 363 | self.valid_ovds_list = {} |
364 | self.min_sample_tss = {} | ||
364 | 365 | ||
365 | # add tss to valid ovds list for this wss | 366 | # add tss to valid ovds list for this wss |
366 | self.process_datafile(datafile, dname, fname, conf) | 367 | self.process_datafile(datafile, dname, fname, conf) |