| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Script for automatically measuring motion-to-photon latency for VR. | 5 """Script for automatically measuring motion-to-photon latency for VR. |
| 6 | 6 |
| 7 Doing so requires two specialized pieces of hardware. The first is a Motopho, | 7 Doing so requires two specialized pieces of hardware. The first is a Motopho, |
| 8 which when used with a VR flicker app, finds the delay between movement and | 8 which when used with a VR flicker app, finds the delay between movement and |
| 9 the test device's screen updating in response to the movement. The second is | 9 the test device's screen updating in response to the movement. The second is |
| 10 a set of servos, which physically moves the test device and Motopho during the | 10 a set of servos, which physically moves the test device and Motopho during the |
| 11 latency test. | 11 latency test. |
| 12 """ | 12 """ |
| 13 | 13 |
| 14 import android_webvr_latency_test | 14 import android_webvr_latency_test |
| 15 | 15 |
| 16 import argparse | 16 import argparse |
| 17 import logging | 17 import logging |
| 18 import os | 18 import os |
| 19 import sys | 19 import sys |
| 20 | 20 |
| 21 # TODO(bsheedy): See about having versioned copies of the flicker app | |
| 22 # instead of using personal github. | |
| 23 DEFAULT_FLICKER_APP_URL = ('https://weableandbob.github.io/Motopho/' | |
| 24 'flicker_apps/webvr/webvr-flicker-app-klaus.html?' | |
| 25 'polyfill=0\&canvasClickPresents=1') | |
| 26 DEFAULT_ADB_PATH = os.path.realpath('../../third_party/android_tools/sdk/' | 21 DEFAULT_ADB_PATH = os.path.realpath('../../third_party/android_tools/sdk/' |
| 27 'platform-tools/adb') | 22 'platform-tools/adb') |
| 28 # TODO(bsheedy): See about adding tool via DEPS instead of relying on it | 23 # TODO(bsheedy): See about adding tool via DEPS instead of relying on it |
| 29 # existing on the bot already | 24 # existing on the bot already |
| 30 DEFAULT_MOTOPHO_PATH = os.path.join(os.path.expanduser('~'), 'motopho/Motopho') | 25 DEFAULT_MOTOPHO_PATH = os.path.join(os.path.expanduser('~'), 'motopho/Motopho') |
| 31 DEFAULT_NUM_SAMPLES = 10 | 26 DEFAULT_NUM_SAMPLES = 10 |
| 32 DEFAULT_RESULTS_FILE = 'results-chart.json' | 27 DEFAULT_RESULTS_FILE = 'results-chart.json' |
| 33 DEFAULT_VRCORE_VERSION_FILE = 'vrcore_version.txt' | 28 DEFAULT_VRCORE_VERSION_FILE = 'vrcore_version.txt' |
| 34 | 29 |
| 35 | 30 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 'will be saved') | 52 'will be saved') |
| 58 parser.add_argument('--platform', | 53 parser.add_argument('--platform', |
| 59 help='The platform the test is being run on, either ' | 54 help='The platform the test is being run on, either ' |
| 60 '"android" or "windows"') | 55 '"android" or "windows"') |
| 61 parser.add_argument('--results-file', | 56 parser.add_argument('--results-file', |
| 62 default=DEFAULT_RESULTS_FILE, | 57 default=DEFAULT_RESULTS_FILE, |
| 63 help='The name of the JSON file the results will be ' | 58 help='The name of the JSON file the results will be ' |
| 64 'saved to') | 59 'saved to') |
| 65 parser.add_argument('--num-samples', | 60 parser.add_argument('--num-samples', |
| 66 default=DEFAULT_NUM_SAMPLES, | 61 default=DEFAULT_NUM_SAMPLES, |
| 62 type=int, |
| 67 help='The number of times to run the test before ' | 63 help='The number of times to run the test before ' |
| 68 'the results are averaged') | 64 'the results are averaged') |
| 69 parser.add_argument('--url', | 65 parser.add_argument('--url', |
| 70 default=DEFAULT_FLICKER_APP_URL, | 66 action='append', |
| 71 help='The URL of the flicker app to use') | 67 default=[], |
| 68 dest='urls', |
| 69 help='The URL of a flicker app to use. Defaults to a ' |
| 70 'set of URLs with various CPU and GPU loads') |
| 72 parser.add_argument('-v', '--verbose', | 71 parser.add_argument('-v', '--verbose', |
| 73 dest='verbose_count', default=0, action='count', | 72 dest='verbose_count', default=0, action='count', |
| 74 help='Verbose level (multiple times for more)') | 73 help='Verbose level (multiple times for more)') |
| 75 parser.add_argument('--vrcore-version-file', | 74 parser.add_argument('--vrcore-version-file', |
| 76 default=DEFAULT_VRCORE_VERSION_FILE, | 75 default=DEFAULT_VRCORE_VERSION_FILE, |
| 77 help='The name of the text file that the VrCore APK ' | 76 help='The name of the text file that the VrCore APK ' |
| 78 'version number will be saved to') | 77 'version number will be saved to') |
| 79 (args, unknown_args) = parser.parse_known_args() | 78 (args, unknown_args) = parser.parse_known_args() |
| 80 SetLogLevel(args.verbose_count) | 79 SetLogLevel(args.verbose_count) |
| 81 if unknown_args: | 80 if unknown_args: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 96 | 95 |
| 97 def main(): | 96 def main(): |
| 98 args = GetParsedArgs() | 97 args = GetParsedArgs() |
| 99 latency_test = None | 98 latency_test = None |
| 100 if args.platform == 'android': | 99 if args.platform == 'android': |
| 101 latency_test = android_webvr_latency_test.AndroidWebVrLatencyTest(args) | 100 latency_test = android_webvr_latency_test.AndroidWebVrLatencyTest(args) |
| 102 elif args.platform == 'win': | 101 elif args.platform == 'win': |
| 103 raise NotImplementedError('WebVR not currently supported on Windows') | 102 raise NotImplementedError('WebVR not currently supported on Windows') |
| 104 else: | 103 else: |
| 105 raise RuntimeError('Given platform %s not recognized' % args.platform) | 104 raise RuntimeError('Given platform %s not recognized' % args.platform) |
| 106 latency_test.RunTest() | 105 latency_test.RunTests() |
| 107 | 106 |
| 108 | 107 |
| 109 if __name__ == '__main__': | 108 if __name__ == '__main__': |
| 110 sys.exit(main()) | 109 sys.exit(main()) |
| OLD | NEW |