[pypy-svn] r58762 - pypy/dist/pypy/translator/tool
xoraxax at codespeak.net
xoraxax at codespeak.net
Tue Oct 7 16:23:05 CEST 2008
Author: xoraxax
Date: Tue Oct 7 16:23:04 2008
New Revision: 58762
Modified:
pypy/dist/pypy/translator/tool/staticsizereport.py
Log:
Add another helper function.
Modified: pypy/dist/pypy/translator/tool/staticsizereport.py
==============================================================================
--- pypy/dist/pypy/translator/tool/staticsizereport.py (original)
+++ pypy/dist/pypy/translator/tool/staticsizereport.py Tue Oct 7 16:23:04 2008
@@ -7,7 +7,7 @@
def guess_module(graph):
func = getattr(graph, 'func', None)
- name = '<unknown>'
+ name = None
if func is not None:
newname = func.func_globals.get('__name__', None)
if newname is not None:
@@ -95,6 +95,16 @@
print format_report_line(line)
+def get_unknown_graphs(database):
+ funcnodes = [node for node in database.globalcontainers()
+ if node.nodekind == "func"]
+ for node in funcnodes:
+ graph = getattr(node.obj, 'graph', None)
+ if not graph:
+ continue
+ if not guess_module(graph):
+ yield graph
+
def print_aggregated_values_by_module_and_type(database, count_modules_separately=False):
" Reports all objects by module and by lltype. "
modules = {}
@@ -106,7 +116,7 @@
graph = getattr(node.obj, 'graph', None)
if not graph:
continue
- nodes_set = modules.setdefault(guess_module(graph), set())
+ nodes_set = modules.setdefault(guess_module(graph) or '<unknown>', set())
assert len(node.funcgens) == 1
nodes_set.update(values_to_nodes(database, node.funcgens[0].all_cached_consts))
modules = modules.items()
More information about the Pypy-commit
mailing list