diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-10-18 20:25:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-10-18 20:25:53 +0000 |
commit | 321a60f15643df42fdf88474513372e84d63740c (patch) | |
tree | 613a8be6f47a71a01a6765b5fa81ac078d9f6406 /adb/benchmark_device.py | |
parent | d301f1bce45e986a1bdb7f0b71ed10e39e54cde6 (diff) | |
parent | 6c060cf1806c9f580f24b8458f033b8f57143c33 (diff) |
Merge changes Ic8d22016,I3e15296e,Ie275e22c
* changes:
adb: improve benchmark script a bit.
adb: extract helper for dumping a packet header.
adbd: turn on -Wthread-safety.
Diffstat (limited to 'adb/benchmark_device.py')
-rwxr-xr-x | adb/benchmark_device.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/adb/benchmark_device.py b/adb/benchmark_device.py index 00c23153c..e56ef5a55 100755 --- a/adb/benchmark_device.py +++ b/adb/benchmark_device.py @@ -60,8 +60,6 @@ def benchmark_push(device=None, file_size_mb=100): if device == None: device = adb.get_device() - lock_max(device) - remote_path = "/dev/null" local_path = "/tmp/adb_benchmark_temp" @@ -69,7 +67,7 @@ def benchmark_push(device=None, file_size_mb=100): f.truncate(file_size_mb * 1024 * 1024) speeds = list() - for _ in range(0, 5): + for _ in range(0, 10): begin = time.time() device.push(local=local_path, remote=remote_path) end = time.time() @@ -81,15 +79,13 @@ def benchmark_pull(device=None, file_size_mb=100): if device == None: device = adb.get_device() - lock_max(device) - remote_path = "/data/local/tmp/adb_benchmark_temp" local_path = "/tmp/adb_benchmark_temp" device.shell(["dd", "if=/dev/zero", "of=" + remote_path, "bs=1m", "count=" + str(file_size_mb)]) speeds = list() - for _ in range(0, 5): + for _ in range(0, 10): begin = time.time() device.pull(remote=remote_path, local=local_path) end = time.time() @@ -101,10 +97,8 @@ def benchmark_shell(device=None, file_size_mb=100): if device == None: device = adb.get_device() - lock_max(device) - speeds = list() - for _ in range(0, 5): + for _ in range(0, 10): begin = time.time() device.shell(["dd", "if=/dev/zero", "bs=1m", "count=" + str(file_size_mb)]) @@ -114,7 +108,10 @@ def benchmark_shell(device=None, file_size_mb=100): analyze("shell %dMiB" % file_size_mb, speeds) def main(): - benchmark_pull() + device = adb.get_device() + unlock(device) + benchmark_push(device) + benchmark_pull(device) if __name__ == "__main__": main() |