本文整理汇总了Python中cache.Cache.print_section方法的典型用法代码示例。如果您正苦于以下问题:Python Cache.print_section方法的具体用法?Python Cache.print_section怎么用?Python Cache.print_section使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cache.Cache
的用法示例。
在下文中一共展示了Cache.print_section方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from cache import Cache [as 别名]
# 或者: from cache.Cache import print_section [as 别名]
elif command == "randwrite" and len(params) == 1:
amount = int(params[0])
for i in range(amount):
address = random.randint(0, mem_size - 1)
byte = util.rand_byte()
write(address, byte, memory, cache)
print("\n" + str(amount) + " bytes written to memory\n")
elif command == "printcache" and len(params) == 2:
start = int(params[0])
amount = int(params[1])
cache.print_section(start, amount)
elif command == "printmem" and len(params) == 2:
start = int(params[0])
amount = int(params[1])
memory.print_section(start, amount)
elif command == "stats" and len(params) == 0:
ratio = (hits / ((hits + misses) if misses else 1)) * 100
print("\nHits: {0} | Misses: {1}".format(hits, misses))
print("Hit/Miss Ratio: {0:.2f}%".format(ratio) + "\n")
elif command != "quit":
print("\nERROR: invalid command\n")