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

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: updated 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
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',
121 'dom_perf': 'Dom', 131 'dom_perf': 'Dom',
122 'dromaeo_domcoreattr': 'Dromaeo DOMCore attr', 132 'dromaeo_domcoreattr': 'Dromaeo DOMCore attr',
123 'dromaeo_domcoremodify': 'Dromaeo DOMCore modify', 133 'dromaeo_domcoremodify': 'Dromaeo DOMCore modify',
124 'dromaeo_domcorequery': 'Dromaeo DOMCore query', 134 'dromaeo_domcorequery': 'Dromaeo DOMCore query',
125 'dromaeo_domcoretraverse': 'Dromaeo DOMCore traverse', 135 'dromaeo_domcoretraverse': 'Dromaeo DOMCore traverse',
126 'dromaeo_jslibattrjquery': 'Dromaeo JSLib attr jquery', 136 'dromaeo_jslibattrjquery': 'Dromaeo JSLib attr jquery',
127 'dromaeo_jslibattrprototype': 'Dromaeo JSLib attr prototype', 137 'dromaeo_jslibattrprototype': 'Dromaeo JSLib attr prototype',
128 'dromaeo_jslibeventjquery': 'Dromaeo JSLib event jquery', 138 'dromaeo_jslibeventjquery': 'Dromaeo JSLib event jquery',
129 'dromaeo_jslibeventprototype': 'Dromaeo JSLib event prototype', 139 'dromaeo_jslibeventprototype': 'Dromaeo JSLib event prototype',
130 'dromaeo_jslibmodifyjquery': 'Dromaeo JSLib modify jquery', 140 'dromaeo_jslibmodifyjquery': 'Dromaeo JSLib modify jquery',
131 'dromaeo_jslibmodifyprototype': 'Dromaeo JSLib modify prototype', 141 'dromaeo_jslibmodifyprototype': 'Dromaeo JSLib modify prototype',
132 'dromaeo_jslibstylejquery': 'Dromaeo JSLib stylej query', 142 'dromaeo_jslibstylejquery': 'Dromaeo JSLib stylej query',
133 'dromaeo_jslibstyleprototype': 'Dromaeo JSLib style prototype', 143 'dromaeo_jslibstyleprototype': 'Dromaeo JSLib style prototype',
134 'dromaeo_jslibtraversejquery': 'Dromaeo JSLib traverse jquery', 144 'dromaeo_jslibtraversejquery': 'Dromaeo JSLib traverse jquery',
135 'dromaeo_jslibtraverseprototype': 'Dromaeo JSLib traverse prototype', 145 'dromaeo_jslibtraverseprototype': 'Dromaeo JSLib traverse prototype',
136 'frame_rate': 'Frame Rate', 146 'frame_rate': 'Frame Rate',
147 'gmail-testGmailComposeDiscard':
148 'Gmail Test: GmailComposeDiscard',
149 'gmail-testGmailAlternateThreadlistConversation':
150 'Gmail Test: GmailAlternateThreadlistConversation',
151 'gmail-testGmailAlternateTwoLabels':
152 'Gmail Test: GmailAlternateTwoLabels',
153 'gmail-testGmailExpandCollapseConversation':
154 'Gmail Test: GmailExpandCollapseConversation',
137 'gpu_frame_rate': 'GPU Frame Rate', 155 'gpu_frame_rate': 'GPU Frame Rate',
138 'gpu_latency': 'GPU Latency', 156 'gpu_latency': 'GPU Latency',
139 'gpu_throughput': 'GPU Throughput', 157 'gpu_throughput': 'GPU Throughput',
140 'idb_perf': 'Other IndexedDB', 158 'idb_perf': 'Other IndexedDB',
141 'image_decoding_benchmark': 'Image Decoding Benchmark', 159 'image_decoding_benchmark': 'Image Decoding Benchmark',
142 'indexeddb': 'Page Cycler IndexedDB', 160 'indexeddb': 'Page Cycler IndexedDB',
143 'intl1': 'Page Cycler Intl1', 161 'intl1': 'Page Cycler Intl1',
144 'intl2': 'Page Cycler Intl2', 162 'intl2': 'Page Cycler Intl2',
145 'jsgamebench': 'JSGameBench', 163 'jsgamebench': 'JSGameBench',
146 'kraken': 'Kraken', 164 'kraken': 'Kraken',
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 systemTitles: { 217 systemTitles: {
200 %(system_title)s 218 %(system_title)s
201 }, 219 },
202 220
203 testTitles : { 221 testTitles : {
204 %(test_title)s 222 %(test_title)s
205 }, 223 },
206 }; 224 };
207 """ 225 """
208 226
227 # Template contents of a config.js file for endure tests.
228 ENDURE_CONFIG_TEMPLATE = """\
229 var Config = {
230 buildslave: '%(system_title)s',
231 title: '%(title)s',
232 };
233 """
234
209 DEFAULT_SYMLINK_LIST = [ 235 DEFAULT_SYMLINK_LIST = [
210 ('details.html', '../../dashboard/ui/details.html'), 236 ('details.html', '../../dashboard/ui/details.html'),
211 ('report.html', '../../dashboard/ui/generic_plotter.html'), 237 ('report.html', '../../dashboard/ui/generic_plotter.html'),
212 ('js', '../../dashboard/ui/js'), 238 ('js', '../../dashboard/ui/js'),
213 ] 239 ]
214 240
215 CHROME_DEFAULT_SYMLINK_LIST = [ 241 CHROME_DEFAULT_SYMLINK_LIST = [
216 ('report.html', '../../dashboard/ui/chrome_report.html'), 242 ('report.html', '../../dashboard/ui/chrome_report.html'),
217 ('js', '../../dashboard/ui/js'), 243 ('js', '../../dashboard/ui/js'),
218 ] 244 ]
219 245
246 ENDURE_DEFAULT_SYMLINK_LIST = [
247 ('report.html', '../../dashboard/ui/endure_plotter.html'),
248 ('js', '../../dashboard/ui/endure_js'),
249 ]
250
220 # Descriptions for optional detail tabs 251 # Descriptions for optional detail tabs
221 DETAIL_TAB_DESC = { 252 DETAIL_TAB_DESC = {
222 'view-pages': 'Data', 253 'view-pages': 'Data',
223 'view-coverage': 'Coverage', 254 'view-coverage': 'Coverage',
224 } 255 }
225 256
226 257
258 def WriteJSConfigFile(perf_dir, system_title, test_title, symlink_list):
259 contents = CONFIG_TEMPLATE % {
260 'base_url': BASE_URL,
261 'system_title': system_title,
262 'title': test_title,
263 'system_dir': os.path.basename(os.path.dirname(perf_dir)),
264 }
265
266 # Add detail tabs to config
dennis_jeffrey 2013/02/05 02:48:28 nit: add period at end of sentence
Dai Mikurube (NOT FULLTIME) 2013/02/05 06:31:49 Done.
267 if os.path.basename(perf_dir) in ('coverage'):
268 detail_tabs = ['view-coverage']
269 elif os.path.basename(perf_dir) in ('sizes', 'targets'):
270 detail_tabs = []
271 else:
272 detail_tabs = ['view-pages']
273 contents += " detailTabs: { 'view-change': 'CL'"
274 for tab in detail_tabs:
275 contents += ", '%s': '%s'" % (tab, DETAIL_TAB_DESC.get(tab, tab))
276 contents += ' }\n'
277 contents += CONFIG_TEMPLATE_END
278
279 open(os.path.join(perf_dir, 'config.js'), 'w').write(contents)
dennis_jeffrey 2013/02/05 02:48:28 should we use the with/open syntax here to ensure
Dai Mikurube (NOT FULLTIME) 2013/02/05 06:31:49 Done. (I'm not sure why the existing code does it
280
281
227 def WriteChromeJSConfigFile(): 282 def WriteChromeJSConfigFile():
228 """Write Chrome JavaScript configuration file.""" 283 """Write Chrome JavaScript configuration file."""
229 system_title = '' 284 system_title = ''
230 sorted_system_titles = sorted(ChromeSystemTitles.items(), key=lambda x: x[0]) 285 sorted_system_titles = sorted(ChromeSystemTitles.items(), key=lambda x: x[0])
231 for sys, title in sorted_system_titles: 286 for sys, title in sorted_system_titles:
232 system_title += ' \'%s\': \'%s\',\n' % (sys, title) 287 system_title += ' \'%s\': \'%s\',\n' % (sys, title)
233 system_title = system_title.rstrip() 288 system_title = system_title.rstrip()
234 289
235 test_title = '' 290 test_title = ''
236 sorted_test_titles = sorted(TestTitles.items(), key=lambda x: x[0]) 291 sorted_test_titles = sorted(TestTitles.items(), key=lambda x: x[0])
237 for test, title in sorted_test_titles: 292 for test, title in sorted_test_titles:
238 test_title += ' \'%s\': \'%s\',\n' % (test, title) 293 test_title += ' \'%s\': \'%s\',\n' % (test, title)
239 test_title = test_title.rstrip() 294 test_title = test_title.rstrip()
240 295
241 contents = CHROME_CONFIG_TEMPLATE % { 296 contents = CHROME_CONFIG_TEMPLATE % {
242 'system_title': system_title, 297 'system_title': system_title,
243 'test_title': test_title, 298 'test_title': test_title,
244 } 299 }
245 open(os.path.join('dashboard', 'chrome_config.js'), 'w').write(contents) 300 open(os.path.join('dashboard', 'chrome_config.js'), 'w').write(contents)
246 301
247 302
248 def TestInit(perf_dir, system_title, test_title, symlink_list): 303 def WriteEndureJSConfigFile(perf_dir, system_title, test_title, symlink_list):
304 contents = ENDURE_CONFIG_TEMPLATE % {
305 'system_title': system_title,
306 'title': test_title,
307 }
308
309 open(os.path.join(perf_dir, 'config.js'), 'w').write(contents)
dennis_jeffrey 2013/02/05 02:48:28 should we use the with/open syntax here too?
Dai Mikurube (NOT FULLTIME) 2013/02/05 06:31:49 Done.
310
311
312 def TestInit(perf_dir, system_title, test_title, symlink_list, endure=False):
249 for slink, target in symlink_list: 313 for slink, target in symlink_list:
250 slink = os.path.join(perf_dir, slink) 314 slink = os.path.join(perf_dir, slink)
251 # Remove the old symlinks first. Catch exceptions on the 315 # Remove the old symlinks first. Catch exceptions on the
252 # assumption that this is the first time and the symlink 316 # assumption that this is the first time and the symlink
253 # doesn't exist. If file already exist, delete them and 317 # doesn't exist. If file already exist, delete them and
254 # recreate the symlink. If it's due to some other problem, 318 # recreate the symlink. If it's due to some other problem,
255 # the symlink creation afterwards will fail for us. 319 # the symlink creation afterwards will fail for us.
256 try: 320 try:
257 os.unlink(slink) 321 os.unlink(slink)
258 except EnvironmentError: 322 except EnvironmentError:
259 pass 323 pass
260 try: 324 try:
261 os.symlink(target, slink) 325 os.symlink(target, slink)
262 except OSError: 326 except OSError:
263 RemovePath(slink) 327 RemovePath(slink)
264 os.symlink(target, slink) 328 os.symlink(target, slink)
265 329
266 contents = CONFIG_TEMPLATE % { 330 if endure:
267 'base_url': BASE_URL, 331 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: 332 else:
279 detail_tabs = ['view-pages'] 333 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 334
288 335
289 def RemovePath(path): 336 def RemovePath(path):
290 """Remove the given path (file or dir).""" 337 """Remove the given path (file or dir)."""
291 if os.path.isdir(path): 338 if os.path.isdir(path):
292 shutil.rmtree(path, ignore_errors=True) 339 shutil.rmtree(path, ignore_errors=True)
293 return 340 return
294 try: 341 try:
295 os.remove(path) 342 os.remove(path)
296 except OSError: 343 except OSError:
297 pass 344 pass
298 345
299 346
300 def main(): 347 def main():
301 parser = optparse.OptionParser() 348 parser = optparse.OptionParser()
302 parser.add_option( 349 parser.add_option(
303 '-C', '--chrome', action='store_true', 350 '-C', '--chrome', action='store_true',
304 help='Initializes perf directories for Chrome.') 351 help='Initializes perf directories for Chrome.')
352 parser.add_option(
353 '-E', '--endure', action='store_true',
354 help='Initializes perf directories for endure tests.')
305 (options, args) = parser.parse_args() 355 (options, args) = parser.parse_args()
306 356
307 # Find the script's directory and cd there. 357 # Find the script's directory and cd there.
308 main_dir = os.path.dirname(os.path.abspath(__file__)) 358 main_dir = os.path.dirname(os.path.abspath(__file__))
309 os.chdir(main_dir) 359 os.chdir(main_dir)
310 360
311 if options.chrome: 361 if options.chrome:
312 system_titles = ChromeSystemTitles 362 system_titles = ChromeSystemTitles
313 symlink_list = CHROME_DEFAULT_SYMLINK_LIST 363 symlink_list = CHROME_DEFAULT_SYMLINK_LIST
314 WriteChromeJSConfigFile() 364 WriteChromeJSConfigFile()
365 elif options.endure:
366 system_titles = EndureSystemTitles
367 symlink_list = ENDURE_DEFAULT_SYMLINK_LIST
315 else: 368 else:
316 system_titles = SystemTitles 369 system_titles = SystemTitles
317 symlink_list = DEFAULT_SYMLINK_LIST 370 symlink_list = DEFAULT_SYMLINK_LIST
318 371
319 # Find all of the system directories. 372 # Find all of the system directories.
320 for system_dir in os.listdir('.'): 373 for system_dir in os.listdir('.'):
321 # Skip the entry if it's not a directory or should be ignored. 374 # 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: 375 if not os.path.isdir(system_dir) or system_dir not in system_titles:
323 continue 376 continue
377 print system_dir
Mike Stip (use stip instead) 2013/01/31 09:39:22 I think this was left in for testing, do you mind
Dai Mikurube (NOT FULLTIME) 2013/02/01 06:14:13 Ugh, thanks for the good catch. removed.
324 os.chmod(system_dir, 0755) 378 os.chmod(system_dir, 0755)
325 system_title = system_titles[system_dir] 379 system_title = system_titles[system_dir]
326 380
327 # Find all of the test directories. 381 # Find all of the test directories.
328 for test_dir in os.listdir(system_dir): 382 for test_dir in os.listdir(system_dir):
329 # Skip the entry if it's not in our mapping of test titles. 383 # Skip the entry if it's not in our mapping of test titles.
330 if test_dir not in TestTitles: 384 if test_dir not in TestTitles:
331 continue 385 continue
386 print ' ' + test_dir
Mike Stip (use stip instead) 2013/01/31 09:39:22 same
Dai Mikurube (NOT FULLTIME) 2013/02/01 06:14:13 Done.
332 test_title = TestTitles[test_dir] 387 test_title = TestTitles[test_dir]
333 perf_dir = os.path.join(system_dir, test_dir) 388 perf_dir = os.path.join(system_dir, test_dir)
334 os.chmod(perf_dir, 0755) 389 os.chmod(perf_dir, 0755)
335 TestInit(perf_dir, system_title, test_title, symlink_list) 390 TestInit(perf_dir, system_title, test_title, symlink_list, options.endure)
336 return 0 391 return 0
337 392
338 393
339 if __name__ == '__main__': 394 if __name__ == '__main__':
340 sys.exit(main()) 395 sys.exit(main())
OLDNEW
« dashboard/ui/endure_js/coordinates.js ('K') | « dashboard/ui/endure_plotter.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698