Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: tools_webrtc/android/profiling/perf_setup.sh

Issue 2864213004: Rename tools-webrtc -> tools_webrtc (Closed)
Patch Set: REmove symlink Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools_webrtc/android/build_aar.py ('k') | tools_webrtc/android/profiling/utilities.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #
11 # Usage: 11 # Usage:
12 # 12 #
13 # It is assumed that a release build of AppRTCMobile exists and has been 13 # It is assumed that a release build of AppRTCMobile exists and has been
14 # installed on an Android device which supports USB debugging. 14 # installed on an Android device which supports USB debugging.
15 # 15 #
16 # Source this script once from the WebRTC src/ directory and resolve any 16 # Source this script once from the WebRTC src/ directory and resolve any
17 # reported issues. Add relative path to build directory as parameter. 17 # reported issues. Add relative path to build directory as parameter.
18 # Required tools will be downloaded if they don't already exist. 18 # Required tools will be downloaded if they don't already exist.
19 # 19 #
20 # Once all tests are passed, a list of available functions will be given. 20 # Once all tests are passed, a list of available functions will be given.
21 # Use these functions to do the actual profiling and visualization of the 21 # Use these functions to do the actual profiling and visualization of the
22 # results. 22 # results.
23 # 23 #
24 # Note that, using a rooted device is recommended since it allows us to 24 # Note that, using a rooted device is recommended since it allows us to
25 # resolve kernel symbols (kallsyms) as well. 25 # resolve kernel symbols (kallsyms) as well.
26 # 26 #
27 # Example usage: 27 # Example usage:
28 # 28 #
29 # > . tools-webrtc/android/profiling/perf_setup.sh out/Release 29 # > . tools_webrtc/android/profiling/perf_setup.sh out/Release
30 # > perf_record 120 30 # > perf_record 120
31 # > flame_graph 31 # > flame_graph
32 # > plot_flame_graph 32 # > plot_flame_graph
33 # > perf_cleanup 33 # > perf_cleanup
34 34
35 if [ -n "$ZSH_VERSION" ]; then 35 if [ -n "$ZSH_VERSION" ]; then
36 # Running inside zsh. 36 # Running inside zsh.
37 SCRIPT_PATH="${(%):-%N}" 37 SCRIPT_PATH="${(%):-%N}"
38 else 38 else
39 # Running inside something else (most likely bash). 39 # Running inside something else (most likely bash).
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 copy_native_shared_library_to_symbol_cache 402 copy_native_shared_library_to_symbol_cache
403 ok "native library copied to ${SYMBOL_DIR}/data/app/${APP_NAME}" 403 ok "native library copied to ${SYMBOL_DIR}/data/app/${APP_NAME}"
404 404
405 # Verify that the application is installed on the device. 405 # Verify that the application is installed on the device.
406 if ! app_is_installed "${APP_NAME}"; then 406 if ! app_is_installed "${APP_NAME}"; then
407 error "${APP_NAME} is not installed on the device" 407 error "${APP_NAME} is not installed on the device"
408 return 1 408 return 1
409 fi 409 fi
410 ok "${APP_NAME} is installed on the device" 410 ok "${APP_NAME} is installed on the device"
411 411
412 # Download simpleperf to <src>/tools-webrtc/android/profiling/simpleperf/. 412 # Download simpleperf to <src>/tools_webrtc/android/profiling/simpleperf/.
413 # Cloning will only take place if the target does not already exist. 413 # Cloning will only take place if the target does not already exist.
414 # The PATH variable will also be updated. 414 # The PATH variable will also be updated.
415 # TODO(henrika): would it be better to use a target outside the WebRTC repo? 415 # TODO(henrika): would it be better to use a target outside the WebRTC repo?
416 local simpleperf_dir="${SCRIPT_DIR}/simpleperf" 416 local simpleperf_dir="${SCRIPT_DIR}/simpleperf"
417 if is_not_dir "${simpleperf_dir}"; then 417 if is_not_dir "${simpleperf_dir}"; then
418 echo "Dowloading simpleperf..." 418 echo "Dowloading simpleperf..."
419 git clone https://android.googlesource.com/platform/prebuilts/simpleperf \ 419 git clone https://android.googlesource.com/platform/prebuilts/simpleperf \
420 "${simpleperf_dir}" 420 "${simpleperf_dir}"
421 chmod u+x "${simpleperf_dir}/report_sample.py" 421 chmod u+x "${simpleperf_dir}/report_sample.py"
422 fi 422 fi
(...skipping 15 matching lines...) Expand all
438 error "failed to install simpleperf on the device" 438 error "failed to install simpleperf on the device"
439 return 1 439 return 1
440 fi 440 fi
441 ok "simpleperf is installed on the device" 441 ok "simpleperf is installed on the device"
442 442
443 # Refresh the symbol cache and read kernal symbols from device if not 443 # Refresh the symbol cache and read kernal symbols from device if not
444 # already done. 444 # already done.
445 perf_update 445 perf_update
446 ok "symbol cache is updated" 446 ok "symbol cache is updated"
447 447
448 # Download Flame Graph to <src>/tools-webrtc/android/profiling/flamegraph/. 448 # Download Flame Graph to <src>/tools_webrtc/android/profiling/flamegraph/.
449 # Cloning will only take place if the target does not already exist. 449 # Cloning will only take place if the target does not already exist.
450 # The PATH variable will also be updated. 450 # The PATH variable will also be updated.
451 # TODO(henrika): would it be better to use a target outside the WebRTC repo? 451 # TODO(henrika): would it be better to use a target outside the WebRTC repo?
452 local flamegraph_dir="${SCRIPT_DIR}/flamegraph" 452 local flamegraph_dir="${SCRIPT_DIR}/flamegraph"
453 if is_not_dir "${flamegraph_dir}"; then 453 if is_not_dir "${flamegraph_dir}"; then
454 echo "Dowloading Flame Graph visualization tool..." 454 echo "Dowloading Flame Graph visualization tool..."
455 git clone https://github.com/brendangregg/FlameGraph.git "${flamegraph_dir}" 455 git clone https://github.com/brendangregg/FlameGraph.git "${flamegraph_dir}"
456 fi 456 fi
457 path_add "${flamegraph_dir}" 457 path_add "${flamegraph_dir}"
458 ok "${flamegraph_dir}" is added to PATH 458 ok "${flamegraph_dir}" is added to PATH
459 459
460 print_function_help 460 print_function_help
461 461
462 cleanup 462 cleanup
463 463
464 return 0 464 return 0
465 } 465 }
466 466
467 # Only call main() if proper input parameter has been provided. 467 # Only call main() if proper input parameter has been provided.
468 if is_set $BUILD_DIR; then 468 if is_set $BUILD_DIR; then
469 main "$@" 469 main "$@"
470 fi 470 fi
OLDNEW
« no previous file with comments | « tools_webrtc/android/build_aar.py ('k') | tools_webrtc/android/profiling/utilities.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698