util: update aggregator to handle x86 checkpoints.

Also, make update to understand some of the newer serialized variables
This commit is contained in:
Lisa Hsu 2011-03-19 21:12:55 -07:00
parent 611f052e96
commit 83664630ee

View file

@ -1,4 +1,5 @@
# Copyright (c) 2009 The Regents of The University of Michigan # Copyright (c) 2009 The Regents of The University of Michigan
# Copyright (c) 2011 Advanced Micro Devices, Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -84,22 +85,30 @@ def aggregate(options, args):
merged.set(newsec, "M5_pid", i) merged.set(newsec, "M5_pid", i)
items = config.items(sec) items = config.items(sec)
for item in items: if options.alpha:
if item[0] == "ppn": for item in items:
if config.getint(sec, "tag") != 0: if item[0] == "ppn":
merged.set(newsec, item[0], int(item[1]) + page_ptr) if config.getint(sec, "tag") != 0:
continue merged.set(newsec, item[0], int(item[1]) + page_ptr)
elif item[0] == "asn": continue
tmp = re.compile("(.*).Entry(\d+)").search(sec).groups() elif item[0] == "asn":
if config.has_option(tmp[0], "nlu"): tmp = re.compile("(.*).Entry(\d+)").search(sec).groups()
size = config.getint(tmp[0], "nlu") if config.has_option(tmp[0], "nlu"):
if int(tmp[1]) < size: size = config.getint(tmp[0], "nlu")
if int(tmp[1]) < size:
merged.set(newsec, item[0], i)
continue
else:
merged.set(newsec, item[0], i) merged.set(newsec, item[0], i)
continue continue
else: merged.set(newsec, item[0], item[1])
merged.set(newsec, item[0], i) else:a #x86
for item in items:
if item[0] == "paddr":
merged.set(newsec, item[0], int(item[1]) + (page_ptr << 12))
continue continue
merged.set(newsec, item[0], item[1]) merged.set(newsec, item[0], item[1])
elif sec == "system": elif sec == "system":
pass pass
elif sec == "Globals": elif sec == "Globals":
@ -117,17 +126,20 @@ def aggregate(options, args):
elif item[0] == "numevents": elif item[0] == "numevents":
merged.optionxform(str("numEvents")) merged.optionxform(str("numEvents"))
page_ptr = page_ptr + int(config.get("system", "page_ptr")) page_ptr = page_ptr + int(config.get("system", "pagePtr"))
### memory stuff ### memory stuff
f = open(cpts[i] + "/system.physmem.physmem", "rb") f = open(cpts[i] + "/system.physmem.physmem", "rb")
gf = gzip.GzipFile(fileobj=f, mode="rb") gf = gzip.GzipFile(fileobj=f, mode="rb")
pages = int(config.get("system", "page_ptr")) pages = int(config.get("system", "pagePtr"))
print "pages to be read: ", pages print "pages to be read: ", pages
x = 0 x = 0
while x < pages: while x < pages:
bytesRead = gf.read(1 << 13) if options.alpha:
bytesRead = gf.read(1 << 13)
else: #x86
bytesRead = gf.read(1 << 12)
merged_mem.write(bytesRead) merged_mem.write(bytesRead)
x += 1 x += 1
@ -135,22 +147,15 @@ def aggregate(options, args):
f.close() f.close()
merged.add_section("system") merged.add_section("system")
merged.set("system", "page_ptr", page_ptr) merged.set("system", "pagePtr", page_ptr)
merged.set("system", "nextPID", len(args))
print "WARNING: " print "WARNING: "
print "Make sure the simulation using this checkpoint has at least " print "Make sure the simulation using this checkpoint has at least ",
if page_ptr > (1<<20): if options.alpha:
print "8G ", print page_ptr, "x 8K of memory"
elif page_ptr > (1<<19): else: # assume x86
print "4G ", print page_ptr, "x 4K of memory"
elif page_ptr > (1<<18):
print "2G ",
elif page_ptr > (1<<17):
print "1G ",
elif page_ptr > (1<<16):
print "512KB ",
else:
print "this is a small sim, you're probably fine",
print "of memory."
merged.add_section("Globals") merged.add_section("Globals")
merged.set("Globals", "curTick", max_curtick) merged.set("Globals", "curTick", max_curtick)
@ -166,6 +171,10 @@ if __name__ == "__main__":
parser = optparse.OptionParser() parser = optparse.OptionParser()
parser.add_option("--prefix", type="string", default="agg") parser.add_option("--prefix", type="string", default="agg")
# If not alpha, then assume x86. Any other ISAs would need
# extra stuff in this script to appropriately parse their page tables
# and understand page sizes.
parser.add_option("--alpha", action="store_true")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()