diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-05-13 03:29:01 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-13 03:29:01 +0000 |
commit | e20f0c4938f8f03467944ed0e71c0feb130e95f1 (patch) | |
tree | 9febd10c7bd945ced3845f08533010a16a9a0115 /testing/tools | |
parent | 82cb80962bc6bf4450561e185f37eb133bc9d8e0 (diff) | |
download | pdfium-e20f0c4938f8f03467944ed0e71c0feb130e95f1.tar.xz |
Add option to run safetynet_compare.py without a profiler.chromium/3430
This is useful for comparing images without slowing down performance
with a profiler.
Change-Id: Ia0c41bf8ef32d82bbc24f47f44586e22d991aa51
Reviewed-on: https://pdfium-review.googlesource.com/32352
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'testing/tools')
-rwxr-xr-x | testing/tools/safetynet_compare.py | 4 | ||||
-rwxr-xr-x | testing/tools/safetynet_measure.py | 20 |
2 files changed, 20 insertions, 4 deletions
diff --git a/testing/tools/safetynet_compare.py b/testing/tools/safetynet_compare.py index 966910967e..ef47eab9cd 100755 --- a/testing/tools/safetynet_compare.py +++ b/testing/tools/safetynet_compare.py @@ -644,8 +644,8 @@ def main(): 'script is killed or crashes the changes can remain ' 'stashed and you may be on another branch.') parser.add_argument('--profiler', default='callgrind', - help='which profiler to use. Supports callgrind and ' - 'perfstat for now. Default is callgrind.') + help='which profiler to use. Supports callgrind, ' + 'perfstat, and none. Default is callgrind.') parser.add_argument('--interesting-section', action='store_true', help='whether to measure just the interesting section or ' 'the whole test harness. Limiting to only the ' diff --git a/testing/tools/safetynet_measure.py b/testing/tools/safetynet_measure.py index ac362b2cef..55046a2fab 100755 --- a/testing/tools/safetynet_measure.py +++ b/testing/tools/safetynet_measure.py @@ -19,6 +19,7 @@ from common import PrintErr CALLGRIND_PROFILER = 'callgrind' PERFSTAT_PROFILER = 'perfstat' +NONE_PROFILER = 'none' PDFIUM_TEST = 'pdfium_test' @@ -55,6 +56,8 @@ class PerformanceRun(object): time = self._RunCallgrind() elif self.args.profiler == PERFSTAT_PROFILER: time = self._RunPerfStat() + elif self.args.profiler == NONE_PROFILER: + time = self._RunWithoutProfiler() else: PrintErr('profiler=%s not supported, aborting' % self.args.profiler) return 1 @@ -102,6 +105,19 @@ class PerformanceRun(object): # ' 12345 instructions' return self._ExtractIrCount(r'\b(\d+)\b.*\binstructions\b', output) + def _RunWithoutProfiler(self): + """Runs test harness and measures performance without a profiler. + + Returns: + int with the result of the measurement, in instructions or time. In this + case, always return 1 since no profiler is being used. + """ + cmd_to_run = self._BuildTestHarnessCommand() + output = subprocess.check_output(cmd_to_run, stderr=subprocess.STDOUT) + + # Return 1 for every run. + return 1 + def _BuildTestHarnessCommand(self): """Builds command to run the test harness.""" cmd = [self.pdfium_test_path, '--send-events'] @@ -135,8 +151,8 @@ def main(): help='relative path to the build directory with ' '%s' % PDFIUM_TEST) parser.add_argument('--profiler', default=CALLGRIND_PROFILER, - help='which profiler to use. Supports callgrind and ' - 'perfstat for now.') + help='which profiler to use. Supports callgrind, ' + 'perfstat, and none.') parser.add_argument('--interesting-section', action='store_true', help='whether to measure just the interesting section or ' 'the whole test harness. The interesting section is ' |