def format_config(name, lid): caches = {'L1-I': 'l1_icache', 'L1-D': 'l1_dcache', 'L2': 'l2_cache', 'L3': 'l3_cache', 'L4': 'l4_cache'} if name in caches: value = sniper_config.get_config(config, 'perf_model/%s/cache_size' % caches[name], lid) return sniper_lib.format_size(1024 * long(value), digits = 0) elif name == 'dram-cache': value = sniper_config.get_config(config, 'perf_model/dram/cache/cache_size', lid) return sniper_lib.format_size(1024 * long(value), digits = 0) else: return ''
def format_config(name, lid): caches = { 'L1-I': 'l1_icache', 'L1-D': 'l1_dcache', 'L2': 'l2_cache', 'L3': 'l3_cache', 'L4': 'l4_cache' } if name in caches: value = sniper_config.get_config( config, 'perf_model/%s/cache_size' % caches[name], lid) return sniper_lib.format_size(1024 * long(value), digits=0) elif name == 'dram-cache': value = sniper_config.get_config( config, 'perf_model/dram/cache/cache_size', lid) return sniper_lib.format_size(1024 * long(value), digits=0) else: return ''
def write(self, obj): sites_sorted = sorted(self.sites.items(), key = lambda (k, v): v.totalloads + v.totalstores, reverse = True) site_names = dict([ (stack, '#%d' % (idx+1)) for idx, (stack, site) in enumerate(sites_sorted) ]) totalloads = sum(self.hitwhere_load_global.values()) totalstores = sum(self.hitwhere_store_global.values()) for stack, site in sites_sorted: print >> obj, 'Site %s:' % site_names[stack] print >> obj, '\tCall stack:' for eip in site.stack: print >> obj, '\t\t%s' % (self.functions[eip] if eip in self.functions else '(unknown)') print >> obj, '\tAllocations: %d' % site.numallocations print >> obj, '\tTotal allocated: %s (%s average)' % (sniper_lib.format_size(site.totalallocated), sniper_lib.format_size(site.totalallocated / site.numallocations)) print >> obj, '\tHit-where:' print >> obj, '\t\t%-15s: %s' % ('Loads', format_abs_ratio(site.totalloads, totalloads)), print >> obj, '\t%-15s: %s' % ('Stores', format_abs_ratio(site.totalstores, totalstores)) for hitwhere in self.hitwheres: if site.hitwhereload.get(hitwhere) or site.hitwherestore.get(hitwhere): cnt = site.hitwhereload[hitwhere] print >> obj, '\t\t %-15s: %s' % (hitwhere, format_abs_ratio(cnt, site.totalloads)), cnt = site.hitwherestore[hitwhere] print >> obj, '\t %-15s: %s' % (hitwhere, format_abs_ratio(cnt, site.totalstores)) print >> obj, '\tEvicts:' evicts = {} for _stack, _site in self.sites.items(): for _siteid, _cnt in _site.evictedby.items(): if self.siteids.get(_siteid) == stack: evicts[_stack] = evicts.get(_stack, 0) + _cnt evicts = sorted(evicts.items(), key = lambda (_stack, _cnt): _cnt, reverse = True) for _stack, cnt in evicts[:10]: name = site_names.get(_stack, 'other') if _stack != stack else 'self' print >> obj, '\t\t%-15s: %12d' % (name, cnt) print >> obj, '\tEvicted-by:' evicts = {} for siteid, cnt in site.evictedby.items(): _stack = self.siteids[siteid] if siteid != '0' else 'other' evicts[_stack] = evicts.get(_stack, 0) + cnt evicts = sorted(evicts.items(), key = lambda (stack, cnt): cnt, reverse = True) for _stack, cnt in evicts[:10]: name = site_names.get(_stack, 'other') if _stack != stack else 'self' print >> obj, '\t\t%-15s: %12d' % (name, cnt) print >> obj print >> obj, 'By hit-where:' for hitwhere in self.hitwheres: if self.hitwhere_load_global[hitwhere] + self.hitwhere_store_global[hitwhere]: totalloadhere = self.hitwhere_load_global[hitwhere] totalstorehere = self.hitwhere_store_global[hitwhere] print >> obj, '\t%s:' % hitwhere print >> obj, '\t\t%-15s: %s' % ('Loads', format_abs_ratio(totalloadhere, totalloads)), print >> obj, '\t%-15s: %s' % ('Stores', format_abs_ratio(totalstorehere, totalstores)) for stack, site in sorted(self.sites.items(), key = lambda (k, v): v.hitwhereload.get(hitwhere, 0) + v.hitwherestore.get(hitwhere, 0), reverse = True): if site.hitwhereload.get(hitwhere) > .001 * totalloadhere or site.hitwherestore.get(hitwhere) > .001 * totalstorehere: print >> obj, '\t\t %-15s: %s' % (site_names[stack], format_abs_ratio(site.hitwhereload.get(hitwhere), totalloadhere)), print >> obj, '\t %-15s: %s' % (site_names[stack], format_abs_ratio(site.hitwherestore.get(hitwhere), totalstorehere)) if self.hitwhere_load_unknown.get(hitwhere) > .001 * totalloadhere or self.hitwhere_store_unknown.get(hitwhere) > .001 * totalstorehere: print >> obj, '\t\t %-15s: %s' % ('other', format_abs_ratio(self.hitwhere_load_unknown.get(hitwhere), totalloadhere)), print >> obj, '\t %-15s: %s' % ('other', format_abs_ratio(self.hitwhere_store_unknown.get(hitwhere), totalstorehere))