| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 3 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license | 5 # Use of this source code is governed by a BSD-style license |
| 6 # that can be found in the LICENSE file in the root of the source | 6 # that can be found in the LICENSE file in the root of the source |
| 7 # tree. An additional intellectual property rights grant can be found | 7 # tree. An additional intellectual property rights grant can be found |
| 8 # in the file PATENTS. All contributing project authors may | 8 # in the file PATENTS. All contributing project authors may |
| 9 # be found in the AUTHORS file in the root of the source tree. | 9 # be found in the AUTHORS file in the root of the source tree. |
| 10 # | 10 # |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } 1> /dev/null | 120 } 1> /dev/null |
| 121 | 121 |
| 122 # Download the correct version of 'simpleperf' to $DEV_TMP_DIR | 122 # Download the correct version of 'simpleperf' to $DEV_TMP_DIR |
| 123 # on the device and enable profiling. | 123 # on the device and enable profiling. |
| 124 function copy_simpleperf_to_device() { | 124 function copy_simpleperf_to_device() { |
| 125 local perf_binary | 125 local perf_binary |
| 126 [[ $(dev_arch) == "aarch64" ]] \ | 126 [[ $(dev_arch) == "aarch64" ]] \ |
| 127 && perf_binary="/arm64/simpleperf" \ | 127 && perf_binary="/arm64/simpleperf" \ |
| 128 || perf_binary="/arm/simpleperf" | 128 || perf_binary="/arm/simpleperf" |
| 129 local simpleperf="${DEV_TMP_DIR}/simpleperf" | 129 local simpleperf="${DEV_TMP_DIR}/simpleperf" |
| 130 # Avoid copying to device if simpleperf already exists. | 130 # Copy the simpleperf binary from local host to temp folder on device. |
| 131 if [[ ! $(dev_ls "${simpleperf}") ]]; then | 131 adb push "${SCRIPT_DIR}/simpleperf/bin/android${perf_binary}" \ |
| 132 adb push "${SIMPLE_PERF_DIR}${perf_binary}" "${DEV_TMP_DIR}" | 132 "${DEV_TMP_DIR}" 1> /dev/null |
| 133 adb shell chmod a+x $simpleperf | 133 adb shell chmod a+x $simpleperf |
| 134 fi | |
| 135 # Enable profiling on the device. | 134 # Enable profiling on the device. |
| 136 enable_profiling | 135 enable_profiling |
| 137 # Allows usage of running report commands on the device. | 136 # Allows usage of running report commands on the device. |
| 138 enable_report_symbols | 137 if image_is_root; then |
| 138 enable_report_symbols |
| 139 fi |
| 139 } | 140 } |
| 140 | 141 |
| 141 # Copy the recorded 'perf.data' file from the device to the current directory. | 142 # Copy the recorded 'perf.data' file from the device to the current directory. |
| 142 # TODO(henrika): add support for specifying the destination. | 143 # TODO(henrika): add support for specifying the destination. |
| 143 function pull_perf_data_from_device() { | 144 function pull_perf_data_from_device() { |
| 144 adb pull "${DEV_TMP_DIR}/perf.data" . | 145 adb pull "${DEV_TMP_DIR}/perf.data" . |
| 145 } 1> /dev/null | 146 } 1> /dev/null |
| 146 | 147 |
| 147 | 148 |
| 148 # Wraps calls to simpleperf report. Used by e.g. perf_report_threads. | 149 # Wraps calls to simpleperf report. Used by e.g. perf_report_threads. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 461 |
| 461 cleanup | 462 cleanup |
| 462 | 463 |
| 463 return 0 | 464 return 0 |
| 464 } | 465 } |
| 465 | 466 |
| 466 # Only call main() if proper input parameter has been provided. | 467 # Only call main() if proper input parameter has been provided. |
| 467 if is_set $BUILD_DIR; then | 468 if is_set $BUILD_DIR; then |
| 468 main "$@" | 469 main "$@" |
| 469 fi | 470 fi |
| OLD | NEW |