diff options
author | Steven Knight <knight@baldmt.com> | 2009-11-19 08:03:26 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2009-11-19 08:03:26 (GMT) |
commit | 57bf294eaae19922e6e39e5c8e9138112b088641 (patch) | |
tree | ce6a93f58cf7d94d174279509431ccb8d51810d7 /timings | |
parent | fa7db45e10075bb0010e8134503e7c93ddbb9e30 (diff) | |
download | SCons-57bf294eaae19922e6e39e5c8e9138112b088641.zip SCons-57bf294eaae19922e6e39e5c8e9138112b088641.tar.gz SCons-57bf294eaae19922e6e39e5c8e9138112b088641.tar.bz2 |
Capture initial infrastructure for working performance tests.
Diffstat (limited to 'timings')
-rw-r--r-- | timings/CPPPATH/SConstruct | 41 | ||||
-rw-r--r-- | timings/CPPPATH/TimeSCons-run.py (renamed from timings/CPPPATH/st.conf) | 32 | ||||
-rw-r--r-- | timings/CPPPATH/foo.c | 6 | ||||
-rw-r--r-- | timings/CPPPATH/include/foo.h | 1 | ||||
-rw-r--r-- | timings/JTimer/SConstruct | 21 | ||||
-rw-r--r-- | timings/JTimer/TimeSCons-run.py (renamed from timings/hundred/st.conf) | 34 | ||||
-rw-r--r-- | timings/README.txt | 32 | ||||
-rw-r--r-- | timings/hundred/SConstruct | 29 | ||||
-rw-r--r-- | timings/hundred/TimeSCons-run.py (renamed from timings/JTimer/st.conf) | 41 |
9 files changed, 101 insertions, 136 deletions
diff --git a/timings/CPPPATH/SConstruct b/timings/CPPPATH/SConstruct index 728db9c..d49e3d6 100644 --- a/timings/CPPPATH/SConstruct +++ b/timings/CPPPATH/SConstruct @@ -21,45 +21,10 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -""" -This configuration is for testing the timing of searching long lists of -CPPPATH directories. +dir_count = int(ARGUMENTS['DIR_COUNT']) -We create 100 on-disk directories, with a single .h file in the last -directory in the list. We set CPPPATH to a list of Dir Nodes for the -created directories. The .c file we create #includes the .h file to be -found in the last directory in the list. -""" - -import os -import os.path - -dir_cnt = 100 - -dir_list = map(lambda t: 'inc_%03d' % t, xrange(dir_cnt)) - -for dir in dir_list: - if not os.path.isdir(dir): - os.mkdir(dir) - -foo_h = 'inc_099/foo.h' - -if not os.path.isfile(foo_h): - open(foo_h, 'w').write('#define FOO 1\n') - -contents = """\ -#include "foo.h" -void -foo(void) -{ - ; -} -""" - -if not os.path.isfile('foo.c'): - open('foo.c', 'w').write(contents) - -inc_list = map(lambda d: Dir(d), dir_list) +inc_list = [ Dir('inc_%04d' % t) for t in xrange(dir_count) ] +inc_list.append(Dir('include')) env = Environment(CPPPATH = inc_list) diff --git a/timings/CPPPATH/st.conf b/timings/CPPPATH/TimeSCons-run.py index 6507ea2..d88042e 100644 --- a/timings/CPPPATH/st.conf +++ b/timings/CPPPATH/TimeSCons-run.py @@ -19,26 +19,26 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# """ -scons-time.py configuration file for the "CPPPATH" timing test. +This configuration times searching long lists of CPPPATH directories. + +We create 5000 on-disk directories. A single checked-in .h file exists +in the 'include' directory. The SConstruct sets CPPPATH to a list of Dir +Nodes for the created directories, followed by 'include'. A checked-in .c +file #includes the .h file to be found in the last directory in the list. """ -archive_list = [ 'SConstruct' ] -subdir = '.' +import TestSCons + +test = TestSCons.TimeSCons() + +dir_count = 5000 -import sys -sys.path.insert(0, '..') -import SCons_Bars +for d in xrange(dir_count): + test.subdir('inc_%04d' % d) -revs = [ - 1224, # Don't create a Node for every file we try to find during scan. - 1349, # More efficient checking for on-disk file entries. - 1407, # Use a Dir scanner instead of a hard-coded method. - 1433, # Remove unnecessary creation of RCS and SCCS Node.Dir nodes. - 1703, # Lobotomize Memoizer. - 2380, # The Big Signature Refactoring hits branches/core. -] +test.main(options='DIR_COUNT=%s' % dir_count) -vertical_bars = SCons_Bars.Release_Bars.gnuplot(labels=True) + \ - SCons_Bars.Revision_Bars.gnuplot(labels=False, revs=revs) +test.pass_test() diff --git a/timings/CPPPATH/foo.c b/timings/CPPPATH/foo.c new file mode 100644 index 0000000..3cbb036 --- /dev/null +++ b/timings/CPPPATH/foo.c @@ -0,0 +1,6 @@ +#include "foo.h" +void +foo(void) +{ + ; +} diff --git a/timings/CPPPATH/include/foo.h b/timings/CPPPATH/include/foo.h new file mode 100644 index 0000000..b1e1311 --- /dev/null +++ b/timings/CPPPATH/include/foo.h @@ -0,0 +1 @@ +#define FOO 1 diff --git a/timings/JTimer/SConstruct b/timings/JTimer/SConstruct index e1e38d2..95764a6 100644 --- a/timings/JTimer/SConstruct +++ b/timings/JTimer/SConstruct @@ -21,33 +21,18 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -""" -This configuration is for timing how we evaluate long chains of -dependencies, specifically when -j is used. - -We set up a chain of 100 targets that get built from a Python function -action with no source files (equivalent to "echo junk > $TARGET"). -Each target explicitly depends on the next target in turn, so the -Taskmaster will do a deep walk of the dependency graph. - -This test case was contributed by Kevin Massey. Prior to revision 1468, -we had a serious O(N^2) problem in the Taskmaster when handling long -dependency chains like this. That was fixed by adding reference counts -to the Taskmaster so it could be smarter about not re-evaluating Nodes. -""" - -target_cnt = 100 +target_count = int(ARGUMENTS['TARGET_COUNT']) env = Environment() def write_file( env, target, source ): - path_target = env.File( target ).path + path_target = env.File( target )[0].path outfile = open( path_target, 'w' ) outfile.write( 'junk' ) outfile.close() list = [] -for i in range( target_cnt ): +for i in range( target_count ): target = 'target_%03d' % i env.Command( target, [], write_file ) env.Depends( target, list ) diff --git a/timings/hundred/st.conf b/timings/JTimer/TimeSCons-run.py index adfb09e..36b016f 100644 --- a/timings/hundred/st.conf +++ b/timings/JTimer/TimeSCons-run.py @@ -22,26 +22,22 @@ # """ -scons-time.py configuration file for the "hundred" timing test. -""" +This configuration is for timing how we evaluate long chains of +dependencies, specifically when -j is used. + +We set up a chain of 500 targets that get built from a Python function +action with no source files (equivalent to "echo junk > $TARGET"). +Each target explicitly depends on the next target in turn, so the +Taskmaster will do a deep walk of the dependency graph. -archive_list = [ 'SConstruct' ] -subdir = '.' +This test case was contributed by Kevin Massey. Prior to revision 1468, +we had a serious O(N^2) problem in the Taskmaster when handling long +dependency chains like this. That was fixed by adding reference counts +to the Taskmaster so it could be smarter about not re-evaluating Nodes. +""" -import sys -sys.path.insert(0, '..') -import SCons_Bars +import TestSCons -revs = [ - 1220, # Use WeakValueDicts in the Memoizer to reduce memory use. - 1307, # Move signature Node tranlation of rel_paths into the class. - 1435, # Fix Debug.caller() directory separators. - 1477, # Delay disambiguation of Node.FS.Entry into File/Dir. - 1655, # Reduce unnecessary calls to Node.FS.disambiguate(). - 1703, # Lobotomize Memoizer. - 1727, # Cache Executor methods, reduce calls when scanning. - 2380, # The Big Signature Refactoring hits branches/core. -] +target_count = 500 -vertical_bars = SCons_Bars.Release_Bars.gnuplot(labels=True) + \ - SCons_Bars.Revision_Bars.gnuplot(labels=False, revs=revs) +TestSCons.TimeSCons().main(options='TARGET_COUNT=%d' % target_count) diff --git a/timings/README.txt b/timings/README.txt new file mode 100644 index 0000000..840c7f8 --- /dev/null +++ b/timings/README.txt @@ -0,0 +1,32 @@ +This directory contains timing configurations for SCons. + +Each configuration exists in a subdirectory. The controlling script +is named TimeSCons-run.py for the configuration. The TimeSCons-run.py +scripts use TestSCons.TimeSCons, a subclass of TestSCons.TestSCons (both +defined in ../QMTest/TestScons.py), to manage execution of the timing +runs. + +Unlike the TestSCons.TestSCons base class, the TestSCons.TimeSCons +subclass copies the contents of its containing directory to the temporary +working directory. (It avoids copying the .svn directory, and any files +or directories that start with the string "TimeSCons-".) This allows +the timing configuration files to be checked in directly to our source +code management system, instead of requiring that they be created from +in-line data inside the script. + +The simplest-possible TimeSCons-run.py script would look like: + + import TestSCons + TestSCons.TimeSCons().main() + +The above script would end up executing a SConstruct file configuration +in a temporary directory. The main() method is the standard interface +for a timing run. See its docstring for precisely what it does. + +Although the TestSCons.TimeSCons subclass copies its directory contents to +a temporary working directory for the timing run, because it is a subclass +of TestSCons.TestSCons, it *can* also create files or directories from +in-line data. This is typically done when it's necessary to create +hundreds of identical input files or directories before running the +timing test, to avoid cluttering our SCM system with hundreds of otherwise +meaningless files. diff --git a/timings/hundred/SConstruct b/timings/hundred/SConstruct index 2332d73..648c26a 100644 --- a/timings/hundred/SConstruct +++ b/timings/hundred/SConstruct @@ -21,32 +21,15 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -""" -This configuration is for timing how we handle the NxM interaction when -we build a lot of targets from a lot of source files. +target_count = int(ARGUMENTS['TARGET_COUNT']) -We create a list of 100 target files that will each be built by copying -a file from a corresponding list of 100 source files. The source -files themselves are each built by a Python function action that's the -equivalent of "echo contents > $TARGET". -""" +def copy_files( env, target, source ): + for t, s in zip(target, source): + open(str(t), 'wb').write(open(str(s), 'rb').read()) -target_cnt = 100 +source_list = map(lambda t: 'source_%04d' % t, xrange(target_count)) +target_list = map(lambda t: 'target_%04d' % t, xrange(target_count)) env = Environment() -def create_file( env, target, source ): - t = str(target[0]) - open( t, 'w' ).write('contents\n') - -source_list = map(lambda t: 'source_%03d' % t, xrange(target_cnt)) -target_list = map(lambda t: 'target_%03d' % t, xrange(target_cnt)) - -for source in source_list: - env.Command( source, [], create_file ) - -def copy_files( env, target, source ): - for t, s in zip(target, source): - open(str(t), 'w').write(open(str(s), 'r').read()) - env.Command( target_list, source_list, copy_files ) diff --git a/timings/JTimer/st.conf b/timings/hundred/TimeSCons-run.py index cf1ecbf..d21db8a 100644 --- a/timings/JTimer/st.conf +++ b/timings/hundred/TimeSCons-run.py @@ -22,27 +22,24 @@ # """ -scons-time.py configuration file for the "JTimer" timing test. +This configuration is for timing how we handle the NxM interaction when +we build a lot of targets from a lot of source files. + +We create a list of 500 target files that will each be built by copying +a file from a corresponding list of 500 source files. The source +files themselves are each built by a Python function action that's the +equivalent of "echo contents > $TARGET". """ -archive_list = [ 'SConstruct' ] -subdir = '.' -targets = '-j2' - -import sys -sys.path.insert(0, '..') -import SCons_Bars - -revs = [ - 1261, # Fix -j re-scanning built files for implicit deps. - 1307, # Move signature Node tranlation of rel_paths into the class. - 1407, # Use a Dir scanner instead of a hard-coded method. - 1435, # Don't prep .sconsign dependencies until needed. - 1468, # Use waiting-Node reference counts to speed up Taskmaster. - 1703, # Lobotomize Memoizer. - 1706, # Fix _doLookup value-cache misspellings. - 2380, # The Big Signature Refactoring hits branches/core. -] - -vertical_bars = SCons_Bars.Release_Bars.gnuplot(labels=True) + \ - SCons_Bars.Revision_Bars.gnuplot(labels=False, revs=revs) +import TestSCons + +test = TestSCons.TimeSCons() + +target_count = 500 + +for t in xrange(target_count): + open('source_%04d' % t, 'wb' ).write('contents\n') + +test.main(options='TARGET_COUNT=%s' % target_count) + +test.pass_test() |