Jonathan Ward | 70774f6 | 2019-06-10 11:03:19 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Rough script for screenrecord and trace |
| 3 | # ./screenrecordtest [time limit in seconds - 180 seconds maximum] |
| 4 | # Runs screenrecord along with a perfetto trace |
| 5 | |
| 6 | set -e |
| 7 | |
| 8 | time=$1 |
| 9 | if [ "$#" -ne 1 ]; then |
| 10 | echo "Usage: $0 SECONDS_TO_RECORD" |
| 11 | exit 1 |
| 12 | fi |
| 13 | timems=`expr $time \* 1000` |
| 14 | adb shell screenrecord --time-limit $time "/sdcard/tracescr.mp4" & SCRN=$! |
| 15 | |
| 16 | adb shell perfetto \ |
| 17 | -c - --txt \ |
| 18 | -o /data/misc/perfetto-traces/trace \ |
| 19 | <<<" |
| 20 | |
| 21 | buffers: { |
| 22 | size_kb: 8960 |
| 23 | fill_policy: DISCARD |
| 24 | } |
| 25 | buffers: { |
| 26 | size_kb: 1280 |
| 27 | fill_policy: DISCARD |
| 28 | } |
| 29 | data_sources: { |
| 30 | config { |
| 31 | name: \"linux.sys_stats\" |
| 32 | sys_stats_config { |
| 33 | stat_period_ms: 1000 |
| 34 | stat_counters: STAT_CPU_TIMES |
| 35 | stat_counters: STAT_FORK_COUNT |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | duration_ms: $timems |
| 40 | |
| 41 | " |
| 42 | |
| 43 | wait $SCRN |
| 44 | |
| 45 | adb pull "/sdcard/tracescr.mp4" |
| 46 | adb pull "/data/misc/perfetto-traces/trace" |