diff options
author | Steven Knight <knight@baldmt.com> | 2009-12-09 18:23:57 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2009-12-09 18:23:57 (GMT) |
commit | 4e8ec715e8c9f2f7144ac18a15026fd311aca654 (patch) | |
tree | 5516dd3f946be4cf72f9899003cb7e51c8776170 /QMTest | |
parent | 2a29b5faa4735e01443c18f6bbe8c0b90a1ac396 (diff) | |
download | SCons-4e8ec715e8c9f2f7144ac18a15026fd311aca654.zip SCons-4e8ec715e8c9f2f7144ac18a15026fd311aca654.tar.gz SCons-4e8ec715e8c9f2f7144ac18a15026fd311aca654.tar.bz2 |
Have the TimeSCons class examine the run output for the reported memory
use and timings, and translate these into TRACE: lines with keyword=value
pairs that will be processed by the now more generic buildbot-side log
processor to populate the timings graph data.
Diffstat (limited to 'QMTest')
-rw-r--r-- | QMTest/TestSCons.py | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 63c40cb..caf32cc 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -949,6 +949,36 @@ print py_ver return alt_cpp_suffix +class Graph: + def __init__(self, name, units, expression, important=False): + self.name = name + self.units = units + self.expression = re.compile(expression) + self.important = important + +GraphList = [ + Graph('TimeSCons-elapsed', 'seconds', + r'TimeSCons elapsed time:\s+([\d.]+)', + important=True), + + Graph('memory-initial', 'bytes', + r'Memory before reading SConscript files:\s+(\d+)'), + Graph('memory-prebuild', 'bytes', + r'Memory before building targets:\s+(\d+)'), + Graph('memory-final', 'bytes', + r'Memory after building targets:\s+(\d+)'), + + Graph('time-sconscript', 'seconds', + r'Total SConscript file execution time:\s+([\d.]+) seconds'), + Graph('time-scons', 'seconds', + r'Total SCons execution time:\s+([\d.]+) seconds'), + Graph('time-commands', 'seconds', + r'Total command execution time:\s+([\d.]+) seconds'), + Graph('time-total', 'seconds', + r'Total build time:\s+([\d.]+) seconds'), +] + + class TimeSCons(TestSCons): """Class for timing SCons.""" def __init__(self, *args, **kw): @@ -998,6 +1028,18 @@ class TimeSCons(TestSCons): apply(self.full, args, kw) apply(self.null, args, kw) + def trace(self, graph, name, value, units): + fmt = "TRACE: graph=%s name=%s value=%s units=%s\n" + sys.stdout.write(fmt % (graph, name, value, units)) + sys.stdout.flush() + + def report_traces(self, trace, input): + self.trace('TimeSCons-elapsed', trace, self.elapsed_time(), "seconds") + for graph in GraphList: + m = graph.expression.search(input) + if m: + self.trace(graph.name, trace, m.group(1), graph.units) + def help(self, *args, **kw): """ Runs scons with the --help option. @@ -1011,7 +1053,7 @@ class TimeSCons(TestSCons): #self.run(*args, **kw) apply(self.run, args, kw) sys.stdout.write(self.stdout()) - print "TimeSCons elapsed time:", self.elapsed_time() + self.report_traces('help', self.stdout()) def full(self, *args, **kw): """ @@ -1021,7 +1063,7 @@ class TimeSCons(TestSCons): #self.run(*args, **kw) apply(self.run, args, kw) sys.stdout.write(self.stdout()) - print "TimeSCons elapsed time:", self.elapsed_time() + self.report_traces('full', self.stdout()) def null(self, *args, **kw): """ @@ -1035,7 +1077,7 @@ class TimeSCons(TestSCons): kw['arguments'] = '.' apply(self.up_to_date, (), kw) sys.stdout.write(self.stdout()) - print "TimeSCons elapsed time:", self.elapsed_time() + self.report_traces('null', self.stdout()) def elapsed_time(self): """ |