Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r66209:9a191922b1d7
Date: 2013-08-19 11:59 +0200
http://bitbucket.org/pypy/pypy/changeset/9a191922b1d7/
Log: Use get_typeids_z
diff --git a/pypy/tool/gcdump.py b/pypy/tool/gcdump.py
--- a/pypy/tool/gcdump.py
+++ b/pypy/tool/gcdump.py
@@ -20,9 +20,13 @@
for obj in self.walk(a):
self.add_object_summary(obj[2], obj[3])
- def load_typeids(self, filename):
+ def load_typeids(self, filename_or_iter):
self.typeids = Stat.typeids.copy()
- for num, line in enumerate(open(filename)):
+ if isinstance(filename_or_iter, str):
+ iter = open(filename_or_iter)
+ else:
+ iter = filename_or_iter
+ for num, line in enumerate(iter):
if num == 0:
continue
words = line.split()
@@ -92,5 +96,8 @@
typeid_name = os.path.join(os.path.dirname(sys.argv[1]), 'typeids.txt')
if os.path.isfile(typeid_name):
stat.load_typeids(typeid_name)
+ else:
+ import zlib, gc
+ stat.load_typeids(zlib.decompress(gc.get_typeids_z()).split("\n"))
#
stat.print_summary()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit