From aeb6e2e3ec920f8590f36bdb33c03c2968ab5dde Mon Sep 17 00:00:00 2001 From: Lisa Hsu Date: Thu, 3 Jun 2010 10:34:40 -0700 Subject: [PATCH] utils: checkpoint aggregator: some physmem files are too big to read at once, break it up into reading one page at a time. Also, avoid redoing a aggregating a checkpoint that's already done. --HG-- rename : util/checkpoint-aggregator.py => util/checkpoint_aggregator.py --- ...aggregator.py => checkpoint_aggregator.py} | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) rename util/{checkpoint-aggregator.py => checkpoint_aggregator.py} (93%) diff --git a/util/checkpoint-aggregator.py b/util/checkpoint_aggregator.py similarity index 93% rename from util/checkpoint-aggregator.py rename to util/checkpoint_aggregator.py index 6e40db01e..acfbca0d0 100755 --- a/util/checkpoint-aggregator.py +++ b/util/checkpoint_aggregator.py @@ -56,12 +56,15 @@ def aggregate(options, args): sys.exit(1) dirname = "-".join([options.prefix, "cpt"]) - print dirname agg_name = "-".join(args) print agg_name fullpath = os.path.join("..", dirname, "cpt." + agg_name + ".10000") if not os.path.isdir(fullpath): os.system("mkdir -p " + fullpath) + elif os.path.isfile(fullpath + "/system.physmem.physmem"): + if os.path.isfile(fullpath + "/m5.cpt"): + print fullpath, " already done" + return myfile = open(fullpath + "/system.physmem.physmem", "wb+") merged_mem = gzip.GzipFile(fileobj=myfile, mode="wb") @@ -69,6 +72,7 @@ def aggregate(options, args): max_curtick = 0 when = 0 for (i, arg) in enumerate(args): + print arg config = myCP() config.readfp(open(cpts[i] + "/m5.cpt")) @@ -105,7 +109,6 @@ def aggregate(options, args): when = config.getint("system.cpu.tickEvent", "_when") else: if i == 0: - print sec merged.add_section(sec) for item in config.items(sec): merged.set(sec, item[0], item[1]) @@ -119,11 +122,14 @@ def aggregate(options, args): ### memory stuff f = open(cpts[i] + "/system.physmem.physmem", "rb") gf = gzip.GzipFile(fileobj=f, mode="rb") - bytes = int(config.get("system", "page_ptr")) << 13 - print "bytes to be read: ", bytes - - bytesRead = gf.read(int(config.get("system", "page_ptr")) << 13) - merged_mem.write(bytesRead) + pages = int(config.get("system", "page_ptr")) + print "pages to be read: ", pages + + x = 0 + while x < pages: + bytesRead = gf.read(1 << 13) + merged_mem.write(bytesRead) + x += 1 gf.close() f.close() -- 2.30.2