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

Side by Side Diff: tools/run_perf.py

Issue 1327033003: [test] Add an option to the perf runner to support running with the internal profiler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Michael's comments Created 5 years, 3 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 | « no previous file | 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 2014 the V8 project authors. All rights reserved. 2 # Copyright 2014 the V8 project 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 """ 6 """
7 Performance runner for d8. 7 Performance runner for d8.
8 8
9 Call e.g. with tools/run-perf.py --arch ia32 some_suite.json 9 Call e.g. with tools/run-perf.py --arch ia32 some_suite.json
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 The test flags are passed to the js test file after '--'. 95 The test flags are passed to the js test file after '--'.
96 """ 96 """
97 97
98 from collections import OrderedDict 98 from collections import OrderedDict
99 import json 99 import json
100 import logging 100 import logging
101 import math 101 import math
102 import optparse 102 import optparse
103 import os 103 import os
104 import re 104 import re
105 import subprocess
105 import sys 106 import sys
106 107
107 from testrunner.local import commands 108 from testrunner.local import commands
108 from testrunner.local import utils 109 from testrunner.local import utils
109 110
110 ARCH_GUESS = utils.DefaultArch() 111 ARCH_GUESS = utils.DefaultArch()
111 SUPPORTED_ARCHS = ["arm", 112 SUPPORTED_ARCHS = ["arm",
112 "ia32", 113 "ia32",
113 "mips", 114 "mips",
114 "mipsel", 115 "mipsel",
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 """ 450 """
450 suite_dir = os.path.abspath(os.path.dirname(suite_path)) 451 suite_dir = os.path.abspath(os.path.dirname(suite_path))
451 bench_dir = os.path.normpath(os.path.join(*self.path)) 452 bench_dir = os.path.normpath(os.path.join(*self.path))
452 os.chdir(os.path.join(suite_dir, bench_dir)) 453 os.chdir(os.path.join(suite_dir, bench_dir))
453 454
454 def GetCommandFlags(self, extra_flags=None): 455 def GetCommandFlags(self, extra_flags=None):
455 suffix = ["--"] + self.test_flags if self.test_flags else [] 456 suffix = ["--"] + self.test_flags if self.test_flags else []
456 return self.flags + (extra_flags or []) + [self.main] + suffix 457 return self.flags + (extra_flags or []) + [self.main] + suffix
457 458
458 def GetCommand(self, shell_dir, extra_flags=None): 459 def GetCommand(self, shell_dir, extra_flags=None):
459 # TODO(machenbach): This requires +.exe if run on windows. 460 # TODO(machenbach): This requires +.exe if run on windows.
Michael Achenbach 2015/09/14 10:24:10 Please add one line in the beginning of this metho
gdeepti1 2015/09/14 19:46:05 Done.
460 cmd = [os.path.join(shell_dir, self.binary)] 461 cmd = [os.path.join(shell_dir, self.binary)]
462 if self.binary != 'd8' and '--prof' in self.extra_flags:
463 print "Profiler supported only on a benchmark run with d8"
461 return cmd + self.GetCommandFlags(extra_flags=extra_flags) 464 return cmd + self.GetCommandFlags(extra_flags=extra_flags)
462 465
463 def Run(self, runner, trybot): 466 def Run(self, runner, trybot):
464 """Iterates over several runs and handles the output for all traces.""" 467 """Iterates over several runs and handles the output for all traces."""
465 stdout_with_patch, stdout_no_patch = Unzip(runner()) 468 stdout_with_patch, stdout_no_patch = Unzip(runner())
466 return ( 469 return (
467 AccumulateResults( 470 AccumulateResults(
468 self.graphs, 471 self.graphs,
469 self._children, 472 self._children,
470 iter_output=stdout_with_patch, 473 iter_output=stdout_with_patch,
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 print e 636 print e
634 return "" 637 return ""
635 print title % "Stdout" 638 print title % "Stdout"
636 print output.stdout 639 print output.stdout
637 if output.stderr: # pragma: no cover 640 if output.stderr: # pragma: no cover
638 # Print stderr for debugging. 641 # Print stderr for debugging.
639 print title % "Stderr" 642 print title % "Stderr"
640 print output.stderr 643 print output.stderr
641 if output.timed_out: 644 if output.timed_out:
642 print ">>> Test timed out after %ss." % runnable.timeout 645 print ">>> Test timed out after %ss." % runnable.timeout
646 if '--prof' in self.extra_flags:
647 if utils.GuessOS() == "linux":
648 tick_tools = os.path.abspath(os.path.join(shell_dir, "..", "..",
649 "tools",
650 "linux-tick-processor"))
651 elif utils.GuessOS() == "macos":
652 tick_tools = os.path.abspath(os.path.join(shell_dir, "..", "..",
653 "tools",
654 "mac-tick-processor"))
655 else:
656 print "Profiler option currently supported on Linux and Mac OS."
657 prof_cmd = tick_tools + " --only-summary"
658 subprocess.check_call(prof_cmd, shell=True)
643 return output.stdout 659 return output.stdout
644 660
645 661
646 class AndroidPlatform(Platform): # pragma: no cover 662 class AndroidPlatform(Platform): # pragma: no cover
647 DEVICE_DIR = "/data/local/tmp/v8/" 663 DEVICE_DIR = "/data/local/tmp/v8/"
648 664
649 def __init__(self, options): 665 def __init__(self, options):
650 super(AndroidPlatform, self).__init__(options) 666 super(AndroidPlatform, self).__init__(options)
651 LoadAndroidBuildTools(options.android_build_tools) 667 LoadAndroidBuildTools(options.android_build_tools)
652 668
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 907
892 if options.json_test_results_no_patch: 908 if options.json_test_results_no_patch:
893 results_no_patch.WriteToFile(options.json_test_results_no_patch) 909 results_no_patch.WriteToFile(options.json_test_results_no_patch)
894 else: # pragma: no cover 910 else: # pragma: no cover
895 print results_no_patch 911 print results_no_patch
896 912
897 return min(1, len(results.errors)) 913 return min(1, len(results.errors))
898 914
899 if __name__ == "__main__": # pragma: no cover 915 if __name__ == "__main__": # pragma: no cover
900 sys.exit(Main(sys.argv[1:])) 916 sys.exit(Main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698