Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344#!/bin/bashset -euo pipefailcd "$(dirname "$0")/.."source Scripts/trace-common.shusage() { printf 'Usage: %s smoothness|idle|memory|counters [--seconds N] [--attach] [--pid PID] [--installed-template]\n %s export <recording.trace>\n' "$0" "$0" >&2; exit 2; }[[ $# -ge 1 ]] || usagemode=$1shiftif [[ $mode == export ]]; then [[ $# -eq 1 && -d $1 && $1 == *.trace ]] || usage trace=$(realpath "$1") mkdir -p build/traces output="$PWD/build/traces/$(basename "${trace%.trace}")" xcrun xctrace export --input "$trace" --toc --output "$output.toc.xml" xcrun xctrace export --input "$trace" --xpath '/trace-toc/run/data/table[@schema="os-signpost-interval" or @schema="hitches"]' --output "$output.data.xml" Scripts/parcel-dev.sh trace-summary --toc "$output.toc.xml" --data "$output.data.xml" --output "$output.summary.json" exitficase "$mode" in smoothness|idle|memory|counters) ;; *) usage ;; esacseconds=30installed=0pid=while (( $# )); do case "$1" in --seconds) [[ $# -ge 2 && $2 =~ ^[1-9][0-9]*$ ]] || usage; seconds=$2; shift 2 ;; --pid) [[ $# -ge 2 && $2 =~ ^[1-9][0-9]*$ ]] || usage; pid=$2; shift 2 ;; --attach) shift ;; --installed-template) installed=1; shift ;; --launch) printf 'trace never launches or controls your app. Use trace-e2e.sh for a harness-owned launch.\n' >&2; exit 2 ;; *) usage ;; esacdonetemplate=$(trace_template "$mode" "$installed")if [[ -z $pid ]]; then pid=$(pgrep -x Parcel) || { printf 'No running Parcel to attach to. This script will not launch it.\n' >&2; exit 2; } [[ $pid =~ ^[1-9][0-9]*$ ]] || { printf 'Multiple Parcel processes; select one with --pid.\n' >&2; exit 2; }fiprocess=$(ps -p "$pid" -o comm=)[[ ${process##*/} == Parcel ]] || { printf 'PID does not identify Parcel.\n' >&2; exit 2; }output=$(trace_output_path "$mode")xcrun xctrace record --template "$template" --attach "$pid" --time-limit "${seconds}s" --output "$output"[[ -d $output ]] || { printf 'Recorder succeeded without writing a trace.\n' >&2; exit 2; }printf 'Trace: %s\n' "$output"