| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be found | 3 # Use of this source code is governed by a BSD-style license that can be found |
| 4 # in the LICENSE file. | 4 # in the LICENSE file. |
| 5 | 5 |
| 6 """ Analyze recent bench data from graphs, and output suggested ranges. | 6 """ Analyze recent bench data from graphs, and output suggested ranges. |
| 7 | 7 |
| 8 This script reads and parses Skia benchmark values from the xhtml files | 8 This script reads and parses Skia benchmark values from the xhtml files |
| 9 generated by bench_graph_svg.py, and outputs an html file containing suggested | 9 generated by bench_graph_svg.py, and outputs an html file containing suggested |
| 10 bench ranges to use in bench_expectations.txt, with analytical plots. | 10 bench ranges to use in bench_expectations.txt, with analytical plots. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 HEIGHT_RE = 'height (\d+\.\d+) corresponds to bench value (\d+\.\d+).-->' | 48 HEIGHT_RE = 'height (\d+\.\d+) corresponds to bench value (\d+\.\d+).-->' |
| 49 REV_RE = '<rect id="(\d+)" x="(\d+\.\d+)" y="' # Revision corresponding x. | 49 REV_RE = '<rect id="(\d+)" x="(\d+\.\d+)" y="' # Revision corresponding x. |
| 50 LINE_RE = '<polyline id="(.*)".*points="(.*)"/>' # Bench value lines. | 50 LINE_RE = '<polyline id="(.*)".*points="(.*)"/>' # Bench value lines. |
| 51 | 51 |
| 52 # Bench graph url pattern. | 52 # Bench graph url pattern. |
| 53 INPUT_URL_TEMPLATE = ('http://chromium-skia-gm.commondatastorage.googleapis.com' | 53 INPUT_URL_TEMPLATE = ('http://chromium-skia-gm.commondatastorage.googleapis.com' |
| 54 '/graph-Skia_%s-2.xhtml') | 54 '/graph-Skia_%s-2.xhtml') |
| 55 | 55 |
| 56 # Output HTML elements and templates. | 56 # Output HTML elements and templates. |
| 57 HTML_HEAD = ('<html><head><title>Skia Bench Expected Ranges</title>' | 57 HTML_HEAD = ('<html><head><title>Skia Bench Expected Ranges</title>' |
| 58 '<script type="text/javascript" src="https://skia.googlecode.com/' | 58 '<script type="text/javascript" src="https://raw.github.com/google' |
| 59 'svn/buildbot/dygraph-combined.js"></script></head><body>Please ' | 59 '/skia-buildbot/master/dygraph-combined.js"></script></head><body>' |
| 60 'adjust values as appropriate and update benches to monitor in ' | 60 'Please adjust values as appropriate and update benches to monitor' |
| 61 'bench/bench_expectations.txt.<br><br>') | 61 ' in bench/bench_expectations.txt.<br><br>') |
| 62 HTML_SUFFIX = '</body></html>' | 62 HTML_SUFFIX = '</body></html>' |
| 63 GRAPH_PREFIX = ('<br>%s<br><div id="%s" style="width:400px;height:200px"></div>' | 63 GRAPH_PREFIX = ('<br>%s<br><div id="%s" style="width:400px;height:200px"></div>' |
| 64 '<script type="text/javascript">g%s=new Dygraph(' | 64 '<script type="text/javascript">g%s=new Dygraph(' |
| 65 'document.getElementById("%s"),"rev,bench,alert\\n') | 65 'document.getElementById("%s"),"rev,bench,alert\\n') |
| 66 GRAPH_SUFFIX = ('",{customBars: true,"alert":{strokeWidth:0.0,drawPoints:true,' | 66 GRAPH_SUFFIX = ('",{customBars: true,"alert":{strokeWidth:0.0,drawPoints:true,' |
| 67 'pointSize:4,highlightCircleSize:6}});</script>') | 67 'pointSize:4,highlightCircleSize:6}});</script>') |
| 68 | 68 |
| 69 | 69 |
| 70 def Usage(): | 70 def Usage(): |
| 71 """Prints flag usage information.""" | 71 """Prints flag usage information.""" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 if out_file: | 238 if out_file: |
| 239 f = open(out_file, 'w+') | 239 f = open(out_file, 'w+') |
| 240 f.write(HTML_HEAD + body + HTML_SUFFIX) | 240 f.write(HTML_HEAD + body + HTML_SUFFIX) |
| 241 f.close() | 241 f.close() |
| 242 else: | 242 else: |
| 243 print HTML_HEAD + body + HTML_SUFFIX | 243 print HTML_HEAD + body + HTML_SUFFIX |
| 244 | 244 |
| 245 | 245 |
| 246 if '__main__' == __name__: | 246 if '__main__' == __name__: |
| 247 main() | 247 main() |
| OLD | NEW |