tmux revision c88a66d6c94ca57e3a40e51e1f47111b841d2f36
1#!/bin/bash 2# Copyright (C) 2018 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15set -e 16 17# If not set guess the OUT dir using the latest directory. 18if [ ! -f "$OUT/args.gn" ]; then 19 echo "OUT=$OUT doesn't look like an output directory." 20 echo "Please specify a directory by doing: export OUT=out/xxx" 21 exit 1 22fi 23 24# You can set the config to one of the files under test/configs e.g. 25# CONFIG=ftrace.cfg or to :test. Defaults to :test. 26CONFIG="${CONFIG:-:test}" 27 28ninja -C $OUT traced traced_probes perfetto trace_to_text test/configs 29 30set -x 31adb push $OUT/traced /data/local/tmp/ 32adb push $OUT/traced_probes /data/local/tmp/ 33adb push $OUT/perfetto /data/local/tmp/ 34set +x 35 36CONFIG_DEVICE_PATH=$CONFIG 37if [[ "$CONFIG" != ":test" ]]; then 38 CONFIG_DEVICE_PATH=/data/local/tmp/$CONFIG.protobuf 39 CONFIG_PATH=$OUT/$CONFIG.protobuf; 40 if [[ ! -f $CONFIG_PATH ]]; then 41 echo 'Config "'$CONFIG_PATH'" not known.' 42 exit 1 43 fi 44 set -x 45 adb push $CONFIG_PATH /data/local/tmp/ 46 set +x 47fi 48 49if tmux has-session -t demo; then 50 tmux kill-session -t demo 51fi 52tmux -2 new-session -d -s demo 53 54if tmux -V | awk '{split($2, ver, "."); if (ver[1] < 2) exit 1 ; else if (ver[1] == 2 && ver[2] < 1) exit 1 }'; then 55 tmux set-option -g mouse on 56else 57 tmux set-option -g mode-mouse on 58 tmux set-option -g mouse-resize-pane on 59 tmux set-option -g mouse-select-pane on 60 tmux set-option -g mouse-select-window on 61fi 62 63tmux split-window -v 64tmux split-window -v 65 66tmux select-layout even-vertical 67 68tmux select-pane -t 0 69tmux send-keys "clear" C-m 70tmux send-keys "adb shell" C-m 71 72tmux select-pane -t 1 73tmux send-keys "clear" C-m 74tmux send-keys "adb shell" C-m 75 76tmux select-pane -t 2 77tmux send-keys "clear" C-m 78tmux send-keys "adb shell" C-m 79 80sleep 2 81 82tmux select-pane -t 1 83tmux send-keys "/data/local/tmp/traced" Enter 84 85tmux select-pane -t 0 86tmux send-keys "/data/local/tmp/traced_probes" Enter 87 88tmux select-pane -t 2 89tmux send-keys "/data/local/tmp/perfetto -c $CONFIG_DEVICE_PATH -o /data/local/tmp/trace" 90 91# Select consumer pane. 92tmux select-pane -t 2 93 94tmux -2 attach-session -t demo 95 96TRACE=$HOME/Downloads/trace.json 97echo -e "\n\x1b[32mPulling trace into $TRACE\x1b[0m" 98set -x 99adb pull /data/local/tmp/trace /tmp/trace.protobuf 100$OUT/trace_to_text systrace < /tmp/trace.protobuf > $TRACE 101