| OLD | NEW |
| 1 ''' | 1 ''' |
| 2 Created on May 16, 2011 | 2 Created on May 16, 2011 |
| 3 | 3 |
| 4 @author: bungeman | 4 @author: bungeman |
| 5 ''' | 5 ''' |
| 6 import bench_util | 6 import bench_util |
| 7 import getopt | 7 import getopt |
| 8 import httplib | 8 import httplib |
| 9 import itertools | 9 import itertools |
| 10 import json | 10 import json |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 print ' Will raise exception if actual bench values are out of range.' | 47 print ' Will raise exception if actual bench values are out of range.' |
| 48 print ' See bench_expectations.txt for data format and examples.' | 48 print ' See bench_expectations.txt for data format and examples.' |
| 49 print '-f <revision>[:<revision>] the revisions to use for fitting.' | 49 print '-f <revision>[:<revision>] the revisions to use for fitting.' |
| 50 print ' Negative <revision> is taken as offset from most recent revision.' | 50 print ' Negative <revision> is taken as offset from most recent revision.' |
| 51 print '-i <time> the time to ignore (w, c, g, etc).' | 51 print '-i <time> the time to ignore (w, c, g, etc).' |
| 52 print ' The flag is ignored when -t is set; otherwise we plot all the' | 52 print ' The flag is ignored when -t is set; otherwise we plot all the' |
| 53 print ' times except the one specified here.' | 53 print ' times except the one specified here.' |
| 54 print '-l <title> title to use for the output graph' | 54 print '-l <title> title to use for the output graph' |
| 55 print '-m <representation> representation of bench value.' | 55 print '-m <representation> representation of bench value.' |
| 56 print ' See _ListAlgorithm class in bench_util.py.' | 56 print ' See _ListAlgorithm class in bench_util.py.' |
| 57 print '-o <path> path to which to write output; writes to stdout if not spec
ified' | 57 print '-o <path> path to which to write output.' |
| 58 print '-r <revision>[:<revision>] the revisions to show.' | 58 print '-r <revision>[:<revision>] the revisions to show.' |
| 59 print ' Negative <revision> is taken as offset from most recent revision.' | 59 print ' Negative <revision> is taken as offset from most recent revision.' |
| 60 print '-s <setting>[=<value>] a setting to show (alpha, scalar, etc).' | 60 print '-s <setting>[=<value>] a setting to show (alpha, scalar, etc).' |
| 61 print '-t <time> the time to show (w, c, g, etc).' | 61 print '-t <time> the time to show (w, c, g, etc).' |
| 62 print '-x <int> the desired width of the svg.' | 62 print '-x <int> the desired width of the svg.' |
| 63 print '-y <int> the desired height of the svg.' | 63 print '-y <int> the desired height of the svg.' |
| 64 print '--default-setting <setting>[=<value>] setting for those without.' | 64 print '--default-setting <setting>[=<value>] setting for those without.' |
| 65 | 65 |
| 66 | 66 |
| 67 class Label: | 67 class Label: |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 except getopt.GetoptError, err: | 325 except getopt.GetoptError, err: |
| 326 print str(err) | 326 print str(err) |
| 327 usage() | 327 usage() |
| 328 sys.exit(2) | 328 sys.exit(2) |
| 329 | 329 |
| 330 directory = None | 330 directory = None |
| 331 config_of_interest = None | 331 config_of_interest = None |
| 332 bench_of_interest = None | 332 bench_of_interest = None |
| 333 time_of_interest = None | 333 time_of_interest = None |
| 334 time_to_ignore = None | 334 time_to_ignore = None |
| 335 output_path = None |
| 335 bench_expectations = {} | 336 bench_expectations = {} |
| 336 appengine_url = None # used for adding data to appengine datastore | 337 appengine_url = None # used for adding data to appengine datastore |
| 337 rep = None # bench representation algorithm | 338 rep = None # bench representation algorithm |
| 338 revision_range = '0:' | 339 revision_range = '0:' |
| 339 regression_range = '0:' | 340 regression_range = '0:' |
| 340 latest_revision = None | 341 latest_revision = None |
| 341 requested_height = None | 342 requested_height = None |
| 342 requested_width = None | 343 requested_width = None |
| 343 title = 'Bench graph' | 344 title = 'Bench graph' |
| 344 settings = {} | 345 settings = {} |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 read_expectations(bench_expectations, value) | 456 read_expectations(bench_expectations, value) |
| 456 elif option == "-f": | 457 elif option == "-f": |
| 457 regression_range = value | 458 regression_range = value |
| 458 elif option == "-i": | 459 elif option == "-i": |
| 459 time_to_ignore = value | 460 time_to_ignore = value |
| 460 elif option == "-l": | 461 elif option == "-l": |
| 461 title = value | 462 title = value |
| 462 elif option == "-m": | 463 elif option == "-m": |
| 463 rep = value | 464 rep = value |
| 464 elif option == "-o": | 465 elif option == "-o": |
| 465 redirect_stdout(value) | 466 output_path = value |
| 467 redirect_stdout(output_path) |
| 466 elif option == "-r": | 468 elif option == "-r": |
| 467 revision_range = value | 469 revision_range = value |
| 468 elif option == "-s": | 470 elif option == "-s": |
| 469 add_setting(settings, value) | 471 add_setting(settings, value) |
| 470 elif option == "-t": | 472 elif option == "-t": |
| 471 time_of_interest = value | 473 time_of_interest = value |
| 472 elif option == "-x": | 474 elif option == "-x": |
| 473 requested_width = int(value) | 475 requested_width = int(value) |
| 474 elif option == "-y": | 476 elif option == "-y": |
| 475 requested_height = int(value) | 477 requested_height = int(value) |
| 476 elif option == "--default-setting": | 478 elif option == "--default-setting": |
| 477 add_setting(default_settings, value) | 479 add_setting(default_settings, value) |
| 478 else: | 480 else: |
| 479 usage() | 481 usage() |
| 480 assert False, "unhandled option" | 482 assert False, "unhandled option" |
| 481 except ValueError: | 483 except ValueError: |
| 482 usage() | 484 usage() |
| 483 sys.exit(2) | 485 sys.exit(2) |
| 484 | 486 |
| 485 if directory is None: | 487 if directory is None: |
| 486 usage() | 488 usage() |
| 487 sys.exit(2) | 489 sys.exit(2) |
| 488 | 490 |
| 491 if not output_path: |
| 492 print 'Warning: No output path provided. No graphs will be written.' |
| 493 |
| 489 if time_of_interest: | 494 if time_of_interest: |
| 490 time_to_ignore = None | 495 time_to_ignore = None |
| 491 | 496 |
| 492 # The title flag (-l) provided in buildbot slave is in the format | 497 # The title flag (-l) provided in buildbot slave is in the format |
| 493 # Bench_Performance_for_Skia_<platform>, and we want to extract <platform> | 498 # Bench_Performance_for_Skia_<platform>, and we want to extract <platform> |
| 494 # for use in platform_and_alg to track matching benches later. If title flag | 499 # for use in platform_and_alg to track matching benches later. If title flag |
| 495 # is not in this format, there may be no matching benches in the file | 500 # is not in this format, there may be no matching benches in the file |
| 496 # provided by the expectation_file flag (-e). | 501 # provided by the expectation_file flag (-e). |
| 497 bot = title # To store the platform as bot name | 502 bot = title # To store the platform as bot name |
| 498 platform_and_alg = title | 503 platform_and_alg = title |
| (...skipping 26 matching lines...) Expand all Loading... |
| 525 , settings | 530 , settings |
| 526 , bench_of_interest | 531 , bench_of_interest |
| 527 , config_of_interest | 532 , config_of_interest |
| 528 , time_of_interest | 533 , time_of_interest |
| 529 , time_to_ignore) | 534 , time_to_ignore) |
| 530 | 535 |
| 531 regressions = create_regressions(lines | 536 regressions = create_regressions(lines |
| 532 , oldest_regression | 537 , oldest_regression |
| 533 , newest_regression) | 538 , newest_regression) |
| 534 | 539 |
| 535 output_xhtml(lines, oldest_revision, newest_revision, ignored_revision_data_
points, | 540 if output_path: |
| 536 regressions, requested_width, requested_height, title) | 541 output_xhtml(lines, oldest_revision, newest_revision, |
| 542 ignored_revision_data_points, regressions, requested_width, |
| 543 requested_height, title) |
| 537 | 544 |
| 538 if appengine_url: | 545 if appengine_url: |
| 539 write_to_appengine(lines, appengine_url, newest_revision, bot) | 546 write_to_appengine(lines, appengine_url, newest_revision, bot) |
| 540 | 547 |
| 541 check_expectations(lines, bench_expectations, newest_revision, | 548 if bench_expectations: |
| 542 platform_and_alg) | 549 check_expectations(lines, bench_expectations, newest_revision, |
| 550 platform_and_alg) |
| 543 | 551 |
| 544 def qa(out): | 552 def qa(out): |
| 545 """Stringify input and quote as an xml attribute.""" | 553 """Stringify input and quote as an xml attribute.""" |
| 546 return xml.sax.saxutils.quoteattr(str(out)) | 554 return xml.sax.saxutils.quoteattr(str(out)) |
| 547 def qe(out): | 555 def qe(out): |
| 548 """Stringify input and escape as xml data.""" | 556 """Stringify input and escape as xml data.""" |
| 549 return xml.sax.saxutils.escape(str(out)) | 557 return xml.sax.saxutils.escape(str(out)) |
| 550 | 558 |
| 551 def create_select(qualifier, lines, select_id=None): | 559 def create_select(qualifier, lines, select_id=None): |
| 552 """Output select with options showing lines which qualifier maps to it. | 560 """Output select with options showing lines which qualifier maps to it. |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 print '<a id="rev_link" xlink:href="" target="_top">' | 1040 print '<a id="rev_link" xlink:href="" target="_top">' |
| 1033 print '<text id="revision" x="0" y=%s style="' % qa(font_size*2) | 1041 print '<text id="revision" x="0" y=%s style="' % qa(font_size*2) |
| 1034 print 'font-size: %s; ' % qe(font_size) | 1042 print 'font-size: %s; ' % qe(font_size) |
| 1035 print 'stroke: #0000dd; text-decoration: underline; ' | 1043 print 'stroke: #0000dd; text-decoration: underline; ' |
| 1036 print '"> </text></a>' | 1044 print '"> </text></a>' |
| 1037 | 1045 |
| 1038 print '</svg>' | 1046 print '</svg>' |
| 1039 | 1047 |
| 1040 if __name__ == "__main__": | 1048 if __name__ == "__main__": |
| 1041 main() | 1049 main() |
| OLD | NEW |