Home | History | Annotate | Download | only in user_activity_benchmarks
      1 #!/bin/bash
      2 
      3 # Copyright 2016 The Chromium OS Authors. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 # Runs the Telemetry benchmarks with AutoTest and collects their perf profiles.
      7 # Reads the benchmark names from the telemetry_benchmark_file. Each benchmark
      8 # should be placed on a separate line.
      9 # The profile results are placed in the results_path.
     10 
     11 set -e
     12 
     13 if [ "$#" -ne 5 ]; then
     14   echo "USAGE: collect_telemetry_profiles.sh board chrome_root_path " \
     15   "machine_ip results_path telemetry_benchmarks_file"
     16   exit 1
     17 fi
     18 
     19 # CHROME_ROOT should contain the path with the source of Chrome. This is used by
     20 # AutoTest.
     21 export CHROME_ROOT=$2
     22 
     23 readonly BOARD=$1
     24 readonly IP=$3
     25 readonly RESULTS_PATH=$4
     26 readonly TELEMETRY_BENCHMARKS_FILE=$5
     27 
     28 # The following Telemetry benchmarks failed for the R52-8350.68.0 Chrome OS
     29 # version: page_cycler_v2.top_10_mobile,
     30 # page_cycler_v2.basic_oopif, smoothness.tough_filters_cases,
     31 # page_cycler_v2.intl_hi_ru,
     32 # image_decoding.image_decoding_measurement, system_health.memory_mobile,
     33 # memory.top_7_stress, smoothness.tough_path_rendering_cases,
     34 # page_cycler_v2.tough_layout_cases,
     35 # memory.long_running_idle_gmail_background_tbmv2, smoothness.tough_webgl_cases,
     36 # smoothness.tough_canvas_cases, smoothness.tough_texture_upload_cases,
     37 # top_10_mobile_memory_ignition, startup.large_profile.cold.blank_page,
     38 # page_cycler_v2.intl_ar_fa_he, start_with_ext.cold.blank_page,
     39 # start_with_ext.warm.blank_page, page_cycler_v2.intl_ko_th_vi,
     40 # smoothness.scrolling_tough_ad_case, page_cycler_v2_site_isolation.basic_oopif,
     41 # smoothness.tough_scrolling_cases, startup.large_profile.warm.blank_page,
     42 # page_cycler_v2.intl_es_fr_pt-BR, page_cycler_v2.intl_ja_zh,
     43 # memory.long_running_idle_gmail_tbmv2, smoothness.scrolling_tough_ad_cases,
     44 # page_cycler_v2.typical_25, smoothness.tough_webgl_ad_cases,
     45 # smoothness.tough_image_decode_cases.
     46 #
     47 # However, we did not manage to collect the profiles only from the following
     48 # benchmarks: smoothness.tough_filters_cases,
     49 # smoothness.tough_path_rendering_cases, page_cycler_v2.tough_layout_cases,
     50 # smoothness.tough_webgl_cases, smoothness.tough_canvas_cases,
     51 # smoothness.tough_texture_upload_cases, smoothness.tough_scrolling_cases,
     52 # smoothness.tough_webgl_ad_cases, smoothness.tough_image_decode_cases.
     53 #
     54 # Use ./run_benchmark --browser=cros-chrome --remote=$IP list to get the list of
     55 # Telemetry benchmarks.
     56 readonly LATEST_PERF_PROFILE=/tmp/test_that_latest/results-1-telemetry_Crosperf/telemetry_Crosperf/profiling/perf.data
     57 
     58 while read benchmark
     59 do
     60   # TODO(evelinad): We should add -F 4000000 to the list of profiler_args
     61   # arguments because we need to use the same sampling period as the one used
     62   # to collect the CWP user data (4M number of cycles for cycles.callgraph).
     63   test_that --debug  --board=${BOARD} --args=" profiler=custom_perf \
     64     profiler_args='record -g -a -e cycles,instructions' \
     65     run_local=False test=$benchmark " $IP telemetry_Crosperf
     66   if [ $? -ne 0 ]; then
     67     echo "Failed to run the $benchmark telemetry benchmark with Autotest."
     68     continue
     69   fi
     70   echo "Warning: Sampling period is too high. It should be set to 4M samples."
     71 
     72   cp "$LATEST_PERF_PROFILE" "$RESULTS_PATH/${benchmark}.data"
     73   if [ $? -ne 0 ]; then
     74     echo "Failed to move the perf profile file from $LATEST_PERF_PROFILE to " \
     75       "$PERF_DATA_RESULTS_PATH/${benchmark}.data for the $benchmark " \
     76       "telemetry benchmark."
     77     continue
     78   fi
     79 
     80   # The ssh connection should be configured without password. We need to do
     81   # this step because we might run out of disk space if we run multiple
     82   # benchmarks.
     83   ssh root@$IP "rm -rf /usr/local/profilers/*"
     84   if [ $? -ne 0 ]; then
     85     echo "Failed to remove the output files from /usr/local/profilers/ for " \
     86       "the $benchmark telemetry benchmark."
     87     continue
     88   fi
     89 done < $TELEMETRY_BENCHMARKS_FILE
     90 
     91