Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1209)

Side by Side Diff: generate_perf.py

Issue 12094074: Support Chrome Endure graphs in perf dashboard. (Closed) Base URL: https://git.chromium.org/git/chromium/tools/perf.git@master
Patch Set: fixed eval Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dashboard/ui/endure_plotter.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Initializes all the perf directories. 6 # Initializes all the perf directories.
7 7
8 8
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 'xp-release-v8-latest': 'XP Perf (v8-latest)', 103 'xp-release-v8-latest': 'XP Perf (v8-latest)',
104 'xp-release-webkit-latest': 'XP Perf (webkit-latest)', 104 'xp-release-webkit-latest': 'XP Perf (webkit-latest)',
105 } 105 }
106 106
107 # This is public code and should not contain internal names. 107 # This is public code and should not contain internal names.
108 ChromeSystemTitles = { 108 ChromeSystemTitles = {
109 'chrome-vista-dual-core': 'Vista Dual Core', 109 'chrome-vista-dual-core': 'Vista Dual Core',
110 'chrome-vista-quad-core': 'Vista Quad Core', 110 'chrome-vista-quad-core': 'Vista Quad Core',
111 } 111 }
112 112
113 # These are long-running endure tests that have differently-shaped graphs.
114 EndureSystemTitles = {
115 'endure-linux-dbg': 'Endure Linux Debug',
116 'endure-linux-rel': 'Endure Linux Release',
117 }
118
113 TestTitles = { 119 TestTitles = {
114 'avperf': 'Audio Video Perf', 120 'avperf': 'Audio Video Perf',
115 'av_perf': 'Audio Video Perf 2', 121 'av_perf': 'Audio Video Perf 2',
116 'bloat-http': 'Bloat - HTTP', 122 'bloat-http': 'Bloat - HTTP',
117 'chrome_frame_perf': 'Chrome Frame Perf', 123 'chrome_frame_perf': 'Chrome Frame Perf',
124 'control-testControlAttachDetachDOMTree':
125 'Control Test: ControlAttachDetachDOMTree',
126 'control-testControlAttachDetachDOMTreeWebDriver':
127 'Control Test: ControlAttachDetachDOMTreeWebDriver',
118 'coverage': 'Code Coverage', 128 'coverage': 'Code Coverage',
119 'database': 'Page Cycler Database', 129 'database': 'Page Cycler Database',
120 'dhtml': 'Page Cycler DHTML', 130 'dhtml': 'Page Cycler DHTML',
131 'docs-testDocsAlternatelyClickLists':
132 'Docs Test: DocsAlternatelyClickLists',
133 'docs_wpr-testDocsAlternatelyClickLists':
134 'Docs WPR Test: DocsAlternatelyClickLists',
121 'dom_perf': 'Dom', 135 'dom_perf': 'Dom',
122 'dromaeo_domcoreattr': 'Dromaeo DOMCore attr', 136 'dromaeo_domcoreattr': 'Dromaeo DOMCore attr',
123 'dromaeo_domcoremodify': 'Dromaeo DOMCore modify', 137 'dromaeo_domcoremodify': 'Dromaeo DOMCore modify',
124 'dromaeo_domcorequery': 'Dromaeo DOMCore query', 138 'dromaeo_domcorequery': 'Dromaeo DOMCore query',
125 'dromaeo_domcoretraverse': 'Dromaeo DOMCore traverse', 139 'dromaeo_domcoretraverse': 'Dromaeo DOMCore traverse',
126 'dromaeo_jslibattrjquery': 'Dromaeo JSLib attr jquery', 140 'dromaeo_jslibattrjquery': 'Dromaeo JSLib attr jquery',
127 'dromaeo_jslibattrprototype': 'Dromaeo JSLib attr prototype', 141 'dromaeo_jslibattrprototype': 'Dromaeo JSLib attr prototype',
128 'dromaeo_jslibeventjquery': 'Dromaeo JSLib event jquery', 142 'dromaeo_jslibeventjquery': 'Dromaeo JSLib event jquery',
129 'dromaeo_jslibeventprototype': 'Dromaeo JSLib event prototype', 143 'dromaeo_jslibeventprototype': 'Dromaeo JSLib event prototype',
130 'dromaeo_jslibmodifyjquery': 'Dromaeo JSLib modify jquery', 144 'dromaeo_jslibmodifyjquery': 'Dromaeo JSLib modify jquery',
131 'dromaeo_jslibmodifyprototype': 'Dromaeo JSLib modify prototype', 145 'dromaeo_jslibmodifyprototype': 'Dromaeo JSLib modify prototype',
132 'dromaeo_jslibstylejquery': 'Dromaeo JSLib stylej query', 146 'dromaeo_jslibstylejquery': 'Dromaeo JSLib stylej query',
133 'dromaeo_jslibstyleprototype': 'Dromaeo JSLib style prototype', 147 'dromaeo_jslibstyleprototype': 'Dromaeo JSLib style prototype',
134 'dromaeo_jslibtraversejquery': 'Dromaeo JSLib traverse jquery', 148 'dromaeo_jslibtraversejquery': 'Dromaeo JSLib traverse jquery',
135 'dromaeo_jslibtraverseprototype': 'Dromaeo JSLib traverse prototype', 149 'dromaeo_jslibtraverseprototype': 'Dromaeo JSLib traverse prototype',
136 'frame_rate': 'Frame Rate', 150 'frame_rate': 'Frame Rate',
151 'gmail-testGmailComposeDiscard':
152 'Gmail Test: GmailComposeDiscard',
153 'gmail-testGmailAlternateThreadlistConversation':
154 'Gmail Test: GmailAlternateThreadlistConversation',
155 'gmail-testGmailAlternateTwoLabels':
156 'Gmail Test: GmailAlternateTwoLabels',
157 'gmail-testGmailExpandCollapseConversation':
158 'Gmail Test: GmailExpandCollapseConversation',
159 'gmail_wpr-testGmailComposeDiscard':
160 'Gmail WPR Test: GmailComposeDiscard',
161 'gmail_wpr-testGmailAlternateThreadlistConversation':
162 'Gmail WPR Test: GmailAlternateThreadlistConversation',
163 'gmail_wpr-testGmailAlternateTwoLabels':
164 'Gmail WPR Test: GmailAlternateTwoLabels',
165 'gmail_wpr-testGmailExpandCollapseConversation':
166 'Gmail WPR Test: GmailExpandCollapseConversation',
137 'gpu_frame_rate': 'GPU Frame Rate', 167 'gpu_frame_rate': 'GPU Frame Rate',
138 'gpu_latency': 'GPU Latency', 168 'gpu_latency': 'GPU Latency',
139 'gpu_throughput': 'GPU Throughput', 169 'gpu_throughput': 'GPU Throughput',
140 'idb_perf': 'Other IndexedDB', 170 'idb_perf': 'Other IndexedDB',
141 'image_decoding_benchmark': 'Image Decoding Benchmark', 171 'image_decoding_benchmark': 'Image Decoding Benchmark',
142 'indexeddb': 'Page Cycler IndexedDB', 172 'indexeddb': 'Page Cycler IndexedDB',
173 'indexeddb-testOfflineOnline':
174 'IndexedDB Test: OfflineOnline',
143 'intl1': 'Page Cycler Intl1', 175 'intl1': 'Page Cycler Intl1',
144 'intl2': 'Page Cycler Intl2', 176 'intl2': 'Page Cycler Intl2',
145 'jsgamebench': 'JSGameBench', 177 'jsgamebench': 'JSGameBench',
146 'kraken': 'Kraken', 178 'kraken': 'Kraken',
147 'mach_ports': 'Mach Port Usage', 179 'mach_ports': 'Mach Port Usage',
148 'memory': 'Memory', 180 'memory': 'Memory',
149 'memory_benchmark': 'Memory Benchmark', 181 'memory_benchmark': 'Memory Benchmark',
150 'media_perf': 'Media Perf', 182 'media_perf': 'Media Perf',
151 'media_tests_av_perf': 'Media Tests AV Perf', 183 'media_tests_av_perf': 'Media Tests AV Perf',
152 'morejs': 'Page Cycler Morejs', 184 'morejs': 'Page Cycler Morejs',
153 'moz': 'Page Cycler Moz', 185 'moz': 'Page Cycler Moz',
154 'moz-http': 'Page Cycler Moz - HTTP', 186 'moz-http': 'Page Cycler Moz - HTTP',
155 'nacl-perf': 'NaCl Perf', 187 'nacl-perf': 'NaCl Perf',
156 'new-tab-ui-cold': 'New Tab Cold', 188 'new-tab-ui-cold': 'New Tab Cold',
157 'new-tab-ui-warm': 'New Tab Warm', 189 'new-tab-ui-warm': 'New Tab Warm',
158 'octane': 'Octane', 190 'octane': 'Octane',
159 'page_cycler_2012Q2-netsim': 'Page Cycler 2012Q2 Netsim', 191 'page_cycler_2012Q2-netsim': 'Page Cycler 2012Q2 Netsim',
192 'plus-testPlusAlternatelyClickStreams':
193 'Plus Test: PlusAlternatelyClickStreams',
194 'plus_wpr-testPlusAlternatelyClickStreams':
195 'Plus WPR Test: PlusAlternatelyClickStreams',
160 'pnacl-tools': 'PNaCl Toolchain', 196 'pnacl-tools': 'PNaCl Toolchain',
161 'pyauto_perf': 'Pyauto Perf', 197 'pyauto_perf': 'Pyauto Perf',
162 'resource_sizes': 'Resource Sizes', 198 'resource_sizes': 'Resource Sizes',
163 'robohornetpro': 'RoboHornet Pro', 199 'robohornetpro': 'RoboHornet Pro',
164 'scrolling_benchmark': 'Scrolling Benchmark', 200 'scrolling_benchmark': 'Scrolling Benchmark',
165 'sizes': 'Sizes', 201 'sizes': 'Sizes',
166 'spaceport': 'Spaceport', 202 'spaceport': 'Spaceport',
167 'spec2k': 'Spec2K', 203 'spec2k': 'Spec2K',
168 'startup': 'Startup', 204 'startup': 'Startup',
169 'sunspider': 'SunSpider', 205 'sunspider': 'SunSpider',
(...skipping 29 matching lines...) Expand all
199 systemTitles: { 235 systemTitles: {
200 %(system_title)s 236 %(system_title)s
201 }, 237 },
202 238
203 testTitles : { 239 testTitles : {
204 %(test_title)s 240 %(test_title)s
205 }, 241 },
206 }; 242 };
207 """ 243 """
208 244
245 # Template contents of a config.js file for endure tests.
246 ENDURE_CONFIG_TEMPLATE = """\
247 var Config = {
248 buildslave: '%(system_title)s',
249 title: '%(title)s',
250 };
251 """
252
209 DEFAULT_SYMLINK_LIST = [ 253 DEFAULT_SYMLINK_LIST = [
210 ('details.html', '../../dashboard/ui/details.html'), 254 ('details.html', '../../dashboard/ui/details.html'),
211 ('report.html', '../../dashboard/ui/generic_plotter.html'), 255 ('report.html', '../../dashboard/ui/generic_plotter.html'),
212 ('js', '../../dashboard/ui/js'), 256 ('js', '../../dashboard/ui/js'),
213 ] 257 ]
214 258
215 CHROME_DEFAULT_SYMLINK_LIST = [ 259 CHROME_DEFAULT_SYMLINK_LIST = [
216 ('report.html', '../../dashboard/ui/chrome_report.html'), 260 ('report.html', '../../dashboard/ui/chrome_report.html'),
217 ('js', '../../dashboard/ui/js'), 261 ('js', '../../dashboard/ui/js'),
218 ] 262 ]
219 263
264 ENDURE_DEFAULT_SYMLINK_LIST = [
265 ('report.html', '../../dashboard/ui/endure_plotter.html'),
266 ('js', '../../dashboard/ui/endure_js'),
267 ]
268
220 # Descriptions for optional detail tabs 269 # Descriptions for optional detail tabs
221 DETAIL_TAB_DESC = { 270 DETAIL_TAB_DESC = {
222 'view-pages': 'Data', 271 'view-pages': 'Data',
223 'view-coverage': 'Coverage', 272 'view-coverage': 'Coverage',
224 } 273 }
225 274
226 275
276 def WriteJSConfigFile(perf_dir, system_title, test_title, symlink_list):
277 contents = CONFIG_TEMPLATE % {
278 'base_url': BASE_URL,
279 'system_title': system_title,
280 'title': test_title,
281 'system_dir': os.path.basename(os.path.dirname(perf_dir)),
282 }
283
284 # Add detail tabs to config.
285 if os.path.basename(perf_dir) in ('coverage'):
286 detail_tabs = ['view-coverage']
287 elif os.path.basename(perf_dir) in ('sizes', 'targets'):
288 detail_tabs = []
289 else:
290 detail_tabs = ['view-pages']
291 contents += " detailTabs: { 'view-change': 'CL'"
292 for tab in detail_tabs:
293 contents += ", '%s': '%s'" % (tab, DETAIL_TAB_DESC.get(tab, tab))
294 contents += ' }\n'
295 contents += CONFIG_TEMPLATE_END
296
297 with open(os.path.join(perf_dir, 'config.js'), 'w') as config_f:
298 config_f.write(contents)
299
300
227 def WriteChromeJSConfigFile(): 301 def WriteChromeJSConfigFile():
228 """Write Chrome JavaScript configuration file.""" 302 """Write Chrome JavaScript configuration file."""
229 system_title = '' 303 system_title = ''
230 sorted_system_titles = sorted(ChromeSystemTitles.items(), key=lambda x: x[0]) 304 sorted_system_titles = sorted(ChromeSystemTitles.items(), key=lambda x: x[0])
231 for sys, title in sorted_system_titles: 305 for sys, title in sorted_system_titles:
232 system_title += ' \'%s\': \'%s\',\n' % (sys, title) 306 system_title += ' \'%s\': \'%s\',\n' % (sys, title)
233 system_title = system_title.rstrip() 307 system_title = system_title.rstrip()
234 308
235 test_title = '' 309 test_title = ''
236 sorted_test_titles = sorted(TestTitles.items(), key=lambda x: x[0]) 310 sorted_test_titles = sorted(TestTitles.items(), key=lambda x: x[0])
237 for test, title in sorted_test_titles: 311 for test, title in sorted_test_titles:
238 test_title += ' \'%s\': \'%s\',\n' % (test, title) 312 test_title += ' \'%s\': \'%s\',\n' % (test, title)
239 test_title = test_title.rstrip() 313 test_title = test_title.rstrip()
240 314
241 contents = CHROME_CONFIG_TEMPLATE % { 315 contents = CHROME_CONFIG_TEMPLATE % {
242 'system_title': system_title, 316 'system_title': system_title,
243 'test_title': test_title, 317 'test_title': test_title,
244 } 318 }
245 open(os.path.join('dashboard', 'chrome_config.js'), 'w').write(contents) 319 with open(os.path.join('dashboard', 'chrome_config.js'), 'w') as config_f:
320 config_f.write(contents)
246 321
247 322
248 def TestInit(perf_dir, system_title, test_title, symlink_list): 323 def WriteEndureJSConfigFile(perf_dir, system_title, test_title, symlink_list):
324 contents = ENDURE_CONFIG_TEMPLATE % {
325 'system_title': system_title,
326 'title': test_title,
327 }
328
329 with open(os.path.join(perf_dir, 'config.js'), 'w') as config_f:
330 config_f.write(contents)
331
332
333 def TestInit(perf_dir, system_title, test_title, symlink_list, endure=False):
249 for slink, target in symlink_list: 334 for slink, target in symlink_list:
250 slink = os.path.join(perf_dir, slink) 335 slink = os.path.join(perf_dir, slink)
251 # Remove the old symlinks first. Catch exceptions on the 336 # Remove the old symlinks first. Catch exceptions on the
252 # assumption that this is the first time and the symlink 337 # assumption that this is the first time and the symlink
253 # doesn't exist. If file already exist, delete them and 338 # doesn't exist. If file already exist, delete them and
254 # recreate the symlink. If it's due to some other problem, 339 # recreate the symlink. If it's due to some other problem,
255 # the symlink creation afterwards will fail for us. 340 # the symlink creation afterwards will fail for us.
256 try: 341 try:
257 os.unlink(slink) 342 os.unlink(slink)
258 except EnvironmentError: 343 except EnvironmentError:
259 pass 344 pass
260 try: 345 try:
261 os.symlink(target, slink) 346 os.symlink(target, slink)
262 except OSError: 347 except OSError:
263 RemovePath(slink) 348 RemovePath(slink)
264 os.symlink(target, slink) 349 os.symlink(target, slink)
265 350
266 contents = CONFIG_TEMPLATE % { 351 if endure:
267 'base_url': BASE_URL, 352 WriteEndureJSConfigFile(perf_dir, system_title, test_title, symlink_list)
268 'system_title': system_title,
269 'title': test_title,
270 'system_dir': os.path.basename(os.path.dirname(perf_dir)),
271 }
272
273 # Add detail tabs to config
274 if os.path.basename(perf_dir) in ('coverage'):
275 detail_tabs = ['view-coverage']
276 elif os.path.basename(perf_dir) in ('sizes', 'targets'):
277 detail_tabs = []
278 else: 353 else:
279 detail_tabs = ['view-pages'] 354 WriteJSConfigFile(perf_dir, system_title, test_title, symlink_list)
280 contents += " detailTabs: { 'view-change': 'CL'"
281 for tab in detail_tabs:
282 contents += ", '%s': '%s'" % (tab, DETAIL_TAB_DESC.get(tab, tab))
283 contents += ' }\n'
284 contents += CONFIG_TEMPLATE_END
285
286 open(os.path.join(perf_dir, 'config.js'), 'w').write(contents)
287 355
288 356
289 def RemovePath(path): 357 def RemovePath(path):
290 """Remove the given path (file or dir).""" 358 """Remove the given path (file or dir)."""
291 if os.path.isdir(path): 359 if os.path.isdir(path):
292 shutil.rmtree(path, ignore_errors=True) 360 shutil.rmtree(path, ignore_errors=True)
293 return 361 return
294 try: 362 try:
295 os.remove(path) 363 os.remove(path)
296 except OSError: 364 except OSError:
297 pass 365 pass
298 366
299 367
300 def main(): 368 def main():
301 parser = optparse.OptionParser() 369 parser = optparse.OptionParser()
302 parser.add_option( 370 parser.add_option(
303 '-C', '--chrome', action='store_true', 371 '-C', '--chrome', action='store_true',
304 help='Initializes perf directories for Chrome.') 372 help='Initializes perf directories for Chrome.')
373 parser.add_option(
374 '-E', '--endure', action='store_true',
375 help='Initializes perf directories for endure tests.')
305 (options, args) = parser.parse_args() 376 (options, args) = parser.parse_args()
306 377
307 # Find the script's directory and cd there. 378 # Find the script's directory and cd there.
308 main_dir = os.path.dirname(os.path.abspath(__file__)) 379 main_dir = os.path.dirname(os.path.abspath(__file__))
309 os.chdir(main_dir) 380 os.chdir(main_dir)
310 381
311 if options.chrome: 382 if options.chrome:
312 system_titles = ChromeSystemTitles 383 system_titles = ChromeSystemTitles
313 symlink_list = CHROME_DEFAULT_SYMLINK_LIST 384 symlink_list = CHROME_DEFAULT_SYMLINK_LIST
314 WriteChromeJSConfigFile() 385 WriteChromeJSConfigFile()
386 elif options.endure:
387 system_titles = EndureSystemTitles
388 symlink_list = ENDURE_DEFAULT_SYMLINK_LIST
315 else: 389 else:
316 system_titles = SystemTitles 390 system_titles = SystemTitles
317 symlink_list = DEFAULT_SYMLINK_LIST 391 symlink_list = DEFAULT_SYMLINK_LIST
318 392
319 # Find all of the system directories. 393 # Find all of the system directories.
320 for system_dir in os.listdir('.'): 394 for system_dir in os.listdir('.'):
321 # Skip the entry if it's not a directory or should be ignored. 395 # Skip the entry if it's not a directory or should be ignored.
322 if not os.path.isdir(system_dir) or system_dir not in system_titles: 396 if not os.path.isdir(system_dir) or system_dir not in system_titles:
323 continue 397 continue
324 os.chmod(system_dir, 0755) 398 os.chmod(system_dir, 0755)
325 system_title = system_titles[system_dir] 399 system_title = system_titles[system_dir]
326 400
327 # Find all of the test directories. 401 # Find all of the test directories.
328 for test_dir in os.listdir(system_dir): 402 for test_dir in os.listdir(system_dir):
329 # Skip the entry if it's not in our mapping of test titles. 403 # Skip the entry if it's not in our mapping of test titles.
330 if test_dir not in TestTitles: 404 if test_dir not in TestTitles:
331 continue 405 continue
332 test_title = TestTitles[test_dir] 406 test_title = TestTitles[test_dir]
333 perf_dir = os.path.join(system_dir, test_dir) 407 perf_dir = os.path.join(system_dir, test_dir)
334 os.chmod(perf_dir, 0755) 408 os.chmod(perf_dir, 0755)
335 TestInit(perf_dir, system_title, test_title, symlink_list) 409 TestInit(perf_dir, system_title, test_title, symlink_list, options.endure)
336 return 0 410 return 0
337 411
338 412
339 if __name__ == '__main__': 413 if __name__ == '__main__':
340 sys.exit(main()) 414 sys.exit(main())
OLDNEW
« no previous file with comments | « dashboard/ui/endure_plotter.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698