• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6set -e
7
8time=$1
9if [ "$#" -ne 1 ]; then
10    echo "Usage: $0 SECONDS_TO_RECORD"
11    exit 1
12fi
13timems=`expr $time \* 1000`
14adb shell screenrecord --time-limit $time "/sdcard/tracescr.mp4" & SCRN=$!
15
16adb shell perfetto \
17  -c - --txt \
18  -o /data/misc/perfetto-traces/trace \
19<<<"
20
21buffers: {
22    size_kb: 8960
23    fill_policy: DISCARD
24}
25buffers: {
26    size_kb: 1280
27    fill_policy: DISCARD
28}
29data_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}
39duration_ms: $timems
40
41"
42
43wait $SCRN
44
45adb pull "/sdcard/tracescr.mp4"
46adb pull "/data/misc/perfetto-traces/trace"
47