| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # scons-time - run SCons timings and collect statistics | 3 # scons-time - run SCons timings and collect statistics |
| 4 # | 4 # |
| 5 # A script for running a configuration through SCons with a standard | 5 # A script for running a configuration through SCons with a standard |
| 6 # set of invocations to collect timing and memory statistics and to | 6 # set of invocations to collect timing and memory statistics and to |
| 7 # capture the results in a consistent set of output files for display | 7 # capture the results in a consistent set of output files for display |
| 8 # and analysis. | 8 # and analysis. |
| 9 # | 9 # |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | 26 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 27 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 27 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 28 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 28 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 29 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 29 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 30 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 30 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 31 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 31 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 32 # | 32 # |
| 33 | 33 |
| 34 from __future__ import nested_scopes | 34 from __future__ import nested_scopes |
| 35 | 35 |
| 36 __revision__ = "src/script/scons-time.py 3603 2008/10/10 05:46:45 scons" | 36 __revision__ = "src/script/scons-time.py 3842 2008/12/20 22:59:52 scons" |
| 37 | 37 |
| 38 import getopt | 38 import getopt |
| 39 import glob | 39 import glob |
| 40 import os | 40 import os |
| 41 import os.path | 41 import os.path |
| 42 import re | 42 import re |
| 43 import shutil | 43 import shutil |
| 44 import string | 44 import string |
| 45 import sys | 45 import sys |
| 46 import tempfile | 46 import tempfile |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 def vertical_bar(self, x, type, label, comment): | 160 def vertical_bar(self, x, type, label, comment): |
| 161 if self.get_min_x() <= x and x <= self.get_max_x(): | 161 if self.get_min_x() <= x and x <= self.get_max_x(): |
| 162 points = [(x, 0), (x, self.max_graph_value(self.get_max_y()))] | 162 points = [(x, 0), (x, self.max_graph_value(self.get_max_y()))] |
| 163 self.line(points, type, label, comment) | 163 self.line(points, type, label, comment) |
| 164 | 164 |
| 165 def get_all_x_values(self): | 165 def get_all_x_values(self): |
| 166 result = [] | 166 result = [] |
| 167 for line in self.lines: | 167 for line in self.lines: |
| 168 result.extend(line.get_x_values()) | 168 result.extend(line.get_x_values()) |
| 169 return filter(None, result) | 169 return filter(lambda r: not r is None, result) |
| 170 | 170 |
| 171 def get_all_y_values(self): | 171 def get_all_y_values(self): |
| 172 result = [] | 172 result = [] |
| 173 for line in self.lines: | 173 for line in self.lines: |
| 174 result.extend(line.get_y_values()) | 174 result.extend(line.get_y_values()) |
| 175 return filter(None, result) | 175 return filter(lambda r: not r is None, result) |
| 176 | 176 |
| 177 def get_min_x(self): | 177 def get_min_x(self): |
| 178 try: | 178 try: |
| 179 return self.min_x | 179 return self.min_x |
| 180 except AttributeError: | 180 except AttributeError: |
| 181 try: | 181 try: |
| 182 self.min_x = min(self.get_all_x_values()) | 182 self.min_x = min(self.get_all_x_values()) |
| 183 except ValueError: | 183 except ValueError: |
| 184 self.min_x = 0 | 184 self.min_x = 0 |
| 185 return self.min_x | 185 return self.min_x |
| (...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 sys.exit(0) | 1504 sys.exit(0) |
| 1505 elif o in ('-V', '--version'): | 1505 elif o in ('-V', '--version'): |
| 1506 sys.stdout.write('scons-time version\n') | 1506 sys.stdout.write('scons-time version\n') |
| 1507 sys.exit(0) | 1507 sys.exit(0) |
| 1508 | 1508 |
| 1509 if not args: | 1509 if not args: |
| 1510 sys.stderr.write('Type "%s help" for usage.\n' % ST.name) | 1510 sys.stderr.write('Type "%s help" for usage.\n' % ST.name) |
| 1511 sys.exit(1) | 1511 sys.exit(1) |
| 1512 | 1512 |
| 1513 ST.execute_subcommand(args) | 1513 ST.execute_subcommand(args) |
| OLD | NEW |