本文整理汇总了Python中cache.Cache.setCache方法的典型用法代码示例。如果您正苦于以下问题:Python Cache.setCache方法的具体用法?Python Cache.setCache怎么用?Python Cache.setCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cache.Cache
的用法示例。
在下文中一共展示了Cache.setCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Misses
# 需要导入模块: from cache import Cache [as 别名]
# 或者: from cache.Cache import setCache [as 别名]
miss = Misses()
hit = 0
print vetor
for i in range (len(vetor)):
endereco = vetor[i]
indice = (endereco >> nbits_offset) & (nsets - 1)
tag = endereco >> (nbits_offset + nbtis_indice)
print endereco, "- ",
if (not checkAllValidade(cache, indice, assoc)):
miss.incMissCompulsorio()
bloco = chooseBloco(cache, indice, assoc)
print bloco, " ", tag, " ",
cache.setCache(tag, indice, bloco) #Mudar
print "Miss compulsório"
else:
if (checkAllTag(cache, indice, assoc, tag)):
hit += 1
print "Hit"
else:
bloco = chooseBloco(cache, indice, assoc)
print bloco, " ", tag, " ",
if (assoc == nsets):
miss.incMissCapacidade()
print "Miss Capacidade"
else:
miss.incMissConflito()
print "Miss Conflito"