Loading media/libaaudio/scripts/measure_device_power.py +21 −5 Original line number Diff line number Diff line Loading @@ -79,28 +79,42 @@ ENERGY_DICTIONARY = { \ SORTED_ENERGY_LIST = sorted(ENERGY_DICTIONARY, key=ENERGY_DICTIONARY.get) # Sometimes "adb unroot" returns 1! # Sometimes adb returns 1 for no apparent reason. # So try several times. # @return 0 on success def adbUnroot(): def adbTryMultiple(command): returnCode = 1 count = 0 limit = 5 while count < limit and returnCode != 0: print(('Try to adb unroot {} of {}'.format(count, limit))) print(('Try to adb {} {} of {}'.format(command, count, limit))) subprocess.call(["adb", "wait-for-device"]) time.sleep(PRE_DELAY_SECONDS) returnCode = subprocess.call(["adb", "unroot"]) returnCode = subprocess.call(["adb", command]) print(('returnCode = {}'.format(returnCode))) count += 1 return returnCode # Sometimes "adb root" returns 1! # So try several times. # @return 0 on success def adbRoot(): return adbTryMultiple("root"); # Sometimes "adb unroot" returns 1! # So try several times. # @return 0 on success def adbUnroot(): return adbTryMultiple("unroot"); # @param commandString String containing shell command # @return Both the stdout and stderr of the commands run def runCommand(commandString): print(commandString) if commandString == "adb unroot": result = adbUnroot() elif commandString == "adb root": result = adbRoot() else: commandArray = commandString.split(' ') result = subprocess.run(commandArray, check=True, capture_output=True).stdout Loading @@ -111,6 +125,8 @@ def runCommand(commandString): def adbCommand(commandString): if commandString == "unroot": result = adbUnroot() elif commandString == "root": result = adbRoot() else: print(("adb " + commandString)) commandArray = ["adb"] + commandString.split(' ') Loading Loading @@ -230,7 +246,7 @@ def measureEnergyForCommands(fileName): print((command + "\n")) comment = command[1:].strip() # remove leading '#' elif command.endswith('\\'): command = command[:-1].strip() # remove \\ command = command[:-1].strip() # remove trailing '\' runCommand(command) elif command: report = averageEnergyForCommand(command, DEFAULT_NUM_ITERATIONS) Loading media/libaaudio/scripts/synthmark_tests.txt +23 −18 Original line number Diff line number Diff line # Measure energy consumption with synthmark. # ADPF <400 RR adb root \ adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 400 \ # None adb shell synthmark -tj -n1 -N50 -B2 -z0 adb shell synthmark -tj -n1 -N75 -B2 -z0 adb shell synthmark -tj -n1 -N100 -B2 -z0 # ADPF PID adb shell synthmark -tj -n1 -N50 -B2 -z1 adb shell synthmark -tj -n1 -N75 -B2 -z1 adb shell synthmark -tj -n1 -N100 -B2 -z1 # ADPF <400 RR # adb root \ # adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 400 \ # adb shell synthmark -tj -n1 -N50 -B2 -z1 # adb shell synthmark -tj -n1 -N75 -B2 -z1 # adb shell synthmark -tj -n1 -N100 -B2 -z1 # ADPF <500 RR adb root \ adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 500 \ adb shell synthmark -tj -n1 -N50 -B2 -z1 adb shell synthmark -tj -n1 -N75 -B2 -z1 adb shell synthmark -tj -n1 -N100 -B2 -z1 # adb root \ # adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 500 \ # adb shell synthmark -tj -n1 -N50 -B2 -z1 # adb shell synthmark -tj -n1 -N75 -B2 -z1 # adb shell synthmark -tj -n1 -N100 -B2 -z1 # ADPF <600 RR adb root \ adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 600 \ adb shell synthmark -tj -n1 -N50 -B2 -z1 adb shell synthmark -tj -n1 -N75 -B2 -z1 adb shell synthmark -tj -n1 -N100 -B2 -z1 # None adb shell synthmark -tj -n1 -N50 -B2 -z0 adb shell synthmark -tj -n1 -N75 -B2 -z0 adb shell synthmark -tj -n1 -N100 -B2 -z0 # adb root \ # adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 600 \ # adb shell synthmark -tj -n1 -N50 -B2 -z1 # adb shell synthmark -tj -n1 -N75 -B2 -z1 # adb shell synthmark -tj -n1 -N100 -B2 -z1 # uclamp # adb root \ Loading Loading
media/libaaudio/scripts/measure_device_power.py +21 −5 Original line number Diff line number Diff line Loading @@ -79,28 +79,42 @@ ENERGY_DICTIONARY = { \ SORTED_ENERGY_LIST = sorted(ENERGY_DICTIONARY, key=ENERGY_DICTIONARY.get) # Sometimes "adb unroot" returns 1! # Sometimes adb returns 1 for no apparent reason. # So try several times. # @return 0 on success def adbUnroot(): def adbTryMultiple(command): returnCode = 1 count = 0 limit = 5 while count < limit and returnCode != 0: print(('Try to adb unroot {} of {}'.format(count, limit))) print(('Try to adb {} {} of {}'.format(command, count, limit))) subprocess.call(["adb", "wait-for-device"]) time.sleep(PRE_DELAY_SECONDS) returnCode = subprocess.call(["adb", "unroot"]) returnCode = subprocess.call(["adb", command]) print(('returnCode = {}'.format(returnCode))) count += 1 return returnCode # Sometimes "adb root" returns 1! # So try several times. # @return 0 on success def adbRoot(): return adbTryMultiple("root"); # Sometimes "adb unroot" returns 1! # So try several times. # @return 0 on success def adbUnroot(): return adbTryMultiple("unroot"); # @param commandString String containing shell command # @return Both the stdout and stderr of the commands run def runCommand(commandString): print(commandString) if commandString == "adb unroot": result = adbUnroot() elif commandString == "adb root": result = adbRoot() else: commandArray = commandString.split(' ') result = subprocess.run(commandArray, check=True, capture_output=True).stdout Loading @@ -111,6 +125,8 @@ def runCommand(commandString): def adbCommand(commandString): if commandString == "unroot": result = adbUnroot() elif commandString == "root": result = adbRoot() else: print(("adb " + commandString)) commandArray = ["adb"] + commandString.split(' ') Loading Loading @@ -230,7 +246,7 @@ def measureEnergyForCommands(fileName): print((command + "\n")) comment = command[1:].strip() # remove leading '#' elif command.endswith('\\'): command = command[:-1].strip() # remove \\ command = command[:-1].strip() # remove trailing '\' runCommand(command) elif command: report = averageEnergyForCommand(command, DEFAULT_NUM_ITERATIONS) Loading
media/libaaudio/scripts/synthmark_tests.txt +23 −18 Original line number Diff line number Diff line # Measure energy consumption with synthmark. # ADPF <400 RR adb root \ adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 400 \ # None adb shell synthmark -tj -n1 -N50 -B2 -z0 adb shell synthmark -tj -n1 -N75 -B2 -z0 adb shell synthmark -tj -n1 -N100 -B2 -z0 # ADPF PID adb shell synthmark -tj -n1 -N50 -B2 -z1 adb shell synthmark -tj -n1 -N75 -B2 -z1 adb shell synthmark -tj -n1 -N100 -B2 -z1 # ADPF <400 RR # adb root \ # adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 400 \ # adb shell synthmark -tj -n1 -N50 -B2 -z1 # adb shell synthmark -tj -n1 -N75 -B2 -z1 # adb shell synthmark -tj -n1 -N100 -B2 -z1 # ADPF <500 RR adb root \ adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 500 \ adb shell synthmark -tj -n1 -N50 -B2 -z1 adb shell synthmark -tj -n1 -N75 -B2 -z1 adb shell synthmark -tj -n1 -N100 -B2 -z1 # adb root \ # adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 500 \ # adb shell synthmark -tj -n1 -N50 -B2 -z1 # adb shell synthmark -tj -n1 -N75 -B2 -z1 # adb shell synthmark -tj -n1 -N100 -B2 -z1 # ADPF <600 RR adb root \ adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 600 \ adb shell synthmark -tj -n1 -N50 -B2 -z1 adb shell synthmark -tj -n1 -N75 -B2 -z1 adb shell synthmark -tj -n1 -N100 -B2 -z1 # None adb shell synthmark -tj -n1 -N50 -B2 -z0 adb shell synthmark -tj -n1 -N75 -B2 -z0 adb shell synthmark -tj -n1 -N100 -B2 -z0 # adb root \ # adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 600 \ # adb shell synthmark -tj -n1 -N50 -B2 -z1 # adb shell synthmark -tj -n1 -N75 -B2 -z1 # adb shell synthmark -tj -n1 -N100 -B2 -z1 # uclamp # adb root \ Loading