summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt6
-rw-r--r--src/engine/SCons/Debug.py4
-rw-r--r--src/engine/SCons/Script/Main.py43
3 files changed, 42 insertions, 11 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 0b47dd9..b46af63 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -178,6 +178,12 @@ RELEASE 0.97 - XXX
- Allow more than one --debug= option to be set at a time.
+ - Change --debug=count to report object counts before and after
+ reading SConscript files and before and after building targets.
+
+ - Change --debug=memory output to line up the numbers and to better
+ match (more or less) the headers on the --debug=count columns.
+
From Wayne Lee:
- Avoid "maximum recursion limit" errors when removing $(-$) pairs
diff --git a/src/engine/SCons/Debug.py b/src/engine/SCons/Debug.py
index 410f390..0d2d85d 100644
--- a/src/engine/SCons/Debug.py
+++ b/src/engine/SCons/Debug.py
@@ -60,6 +60,10 @@ def string_to_classes(s):
else:
return string.split(s)
+def fetchLoggedInstances(classes="*"):
+ classnames = string_to_classes(classes)
+ return map(lambda cn: (cn, len(tracked_classes[cn])), classnames)
+
def countLoggedInstances(classes, file=sys.stdout):
for classname in string_to_classes(classes):
file.write("%s: %d\n" % (classname, len(tracked_classes[classname])))
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py
index 1bfd248..f39375a 100644
--- a/src/engine/SCons/Script/Main.py
+++ b/src/engine/SCons/Script/Main.py
@@ -241,7 +241,7 @@ class QuestionTask(SCons.Taskmaster.Task):
# Global variables
keep_going_on_error = 0
-print_count = 0
+count_stats = None
print_dtree = 0
print_explanations = 0
print_includes = 0
@@ -407,7 +407,7 @@ def _SConstruct_exists(dirname=''):
def _set_globals(options):
global repositories, keep_going_on_error, ignore_errors
- global print_count, print_dtree
+ global count_stats, print_dtree
global print_explanations, print_includes, print_memoizer
global print_objects, print_stacktrace, print_stree
global print_time, print_tree
@@ -424,7 +424,7 @@ def _set_globals(options):
pass
else:
if "count" in debug_values:
- print_count = 1
+ count_stats = []
if "dtree" in debug_values:
print_dtree = 1
if "explain" in debug_values:
@@ -918,6 +918,7 @@ def _main(args, parser):
fs.Repository(rep)
if not memory_stats is None: memory_stats.append(SCons.Debug.memory())
+ if not count_stats is None: count_stats.append(SCons.Debug.fetchLoggedInstances())
progress_display("scons: Reading SConscript files ...")
@@ -947,6 +948,7 @@ def _main(args, parser):
SCons.Node.FS.save_strings(1)
if not memory_stats is None: memory_stats.append(SCons.Debug.memory())
+ if not count_stats is None: count_stats.append(SCons.Debug.fetchLoggedInstances())
fs.chdir(fs.Top)
@@ -1076,6 +1078,7 @@ def _main(args, parser):
SCons.Warnings.warn(SCons.Warnings.NoParallelSupportWarning, msg)
if not memory_stats is None: memory_stats.append(SCons.Debug.memory())
+ if not count_stats is None: count_stats.append(SCons.Debug.fetchLoggedInstances())
try:
jobs.run()
@@ -1090,16 +1093,34 @@ def _main(args, parser):
if not memory_stats is None:
memory_stats.append(SCons.Debug.memory())
when = [
- 'before SConscript files',
- 'after SConscript files',
- 'before building',
- 'after building',
+ 'before reading SConscript files',
+ 'after reading SConscript files',
+ 'before building targets',
+ 'after building targets',
]
for i in xrange(len(when)):
- memory_outf.write('Memory %s: %d\n' % (when[i], memory_stats[i]))
-
- if print_count:
- SCons.Debug.countLoggedInstances('*')
+ memory_outf.write('Memory %-32s %12d\n' % (when[i]+':', memory_stats[i]))
+
+ if not count_stats is None:
+ count_stats.append(SCons.Debug.fetchLoggedInstances())
+ stats_table = {}
+ for cs in count_stats:
+ for n in map(lambda t: t[0], cs):
+ stats_table[n] = [0, 0, 0, 0]
+ i = 0
+ for cs in count_stats:
+ for n, c in cs:
+ stats_table[n][i] = c
+ i = i + 1
+ keys = stats_table.keys()
+ keys.sort()
+ print "Object counts:"
+ fmt = " %7s %7s %7s %7s %s"
+ print fmt % ("pre-", "post-", "pre-", "post-", "")
+ print fmt % ("read", "read", "build", "build", "Class")
+ for k in keys:
+ r = stats_table[k]
+ print " %7d %7d %7d %7d %s" % (r[0], r[1], r[2], r[3], k)
if print_objects:
SCons.Debug.listLoggedInstances('*')