def main(): # Delimiter is ',' or ' ', skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) skps = _path.find_skps(FLAGS.skps) if FLAGS.adb: adb = Adb(FLAGS.device_serial, FLAGS.adb_binary, echo=(FLAGS.verbosity >= 5)) model = adb.check('getprop ro.product.model').strip() if model == 'Pixel C': from _hardware_pixel_c import HardwarePixelC hardware = HardwarePixelC(adb) elif model == 'Pixel': from _hardware_pixel import HardwarePixel hardware = HardwarePixel(adb) elif model == 'Pixel 2': from _hardware_pixel2 import HardwarePixel2 hardware = HardwarePixel2(adb) elif model == 'Nexus 6P': from _hardware_nexus_6p import HardwareNexus6P hardware = HardwareNexus6P(adb) else: from _hardware_android import HardwareAndroid print("WARNING: %s: don't know how to monitor this hardware; results " "may be unreliable." % model, file=sys.stderr) hardware = HardwareAndroid(adb) else: hardware = Hardware() if FLAGS.resultsfile: with open(FLAGS.resultsfile, mode='a+') as resultsfile: run_benchmarks(configs, skps, hardware, resultsfile=resultsfile) else: run_benchmarks(configs, skps, hardware)
def main(): # Delimiter is ',' or ' ', skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) srcs = _path.find_skps(FLAGS.srcs) assert srcs if FLAGS.adb: adb = Adb(FLAGS.device_serial, FLAGS.adb_binary, echo=(FLAGS.verbosity >= 5)) from _hardware_android import HardwareAndroid model = adb.check('getprop ro.product.model').strip() if model == 'Pixel C': from _hardware_pixel_c import HardwarePixelC hardware = HardwarePixelC(adb) elif model == 'Pixel' or model == "Pixel XL": from _hardware_pixel import HardwarePixel hardware = HardwarePixel(adb) elif model == 'Pixel 2': from _hardware_pixel2 import HardwarePixel2 hardware = HardwarePixel2(adb) elif model == 'Nexus 6P': from _hardware_nexus_6p import HardwareNexus6P hardware = HardwareNexus6P(adb) else: print( "WARNING: %s: don't know how to monitor this hardware; results " "may be unreliable." % model, file=sys.stderr) hardware = HardwareAndroid(adb) if FLAGS.lock_clocks: hardware.__enter__() print( "Entered benchmarking mode, not running benchmarks. Reboot to restore." ) return if FLAGS.clock_speed: hardware.setDesiredClock(FLAGS.clock_speed) else: hardware = Hardware() if FLAGS.resultsfile: with open(FLAGS.resultsfile, mode='a+') as resultsfile: run_benchmarks(configs, srcs, hardware, resultsfile=resultsfile) else: run_benchmarks(configs, srcs, hardware)