本文整理汇总了Python中memory.Memory.print_section方法的典型用法代码示例。如果您正苦于以下问题:Python Memory.print_section方法的具体用法?Python Memory.print_section怎么用?Python Memory.print_section使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类memory.Memory
的用法示例。
在下文中一共展示了Memory.print_section方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write
# 需要导入模块: from memory import Memory [as 别名]
# 或者: from memory.Memory import print_section [as 别名]
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")
except IndexError:
print("\nERROR: out of bounds\n")
except:
print("\nERROR: incorrect syntax\n")