aboutsummaryrefslogtreecommitdiffstats
path: root/pm_data_analysis/pm_data_analyzer.py
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-03-25 23:55:41 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-03-25 23:55:41 -0400
commit0955215f93b077978f58e337c54114518710c062 (patch)
tree529b9dc83d5cd571c2fa5a27a6dd9a4ee00e7eb8 /pm_data_analysis/pm_data_analyzer.py
parent0f485a727aa71ef2d4f7674282cb406b09e7d28d (diff)
Autocompute cap on number of samples used in statistics
Diffstat (limited to 'pm_data_analysis/pm_data_analyzer.py')
-rwxr-xr-xpm_data_analysis/pm_data_analyzer.py35
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 \
43to NOFFCHIP"), 43to 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:
100class Analyzer(defapp.App): 102class 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