1#!/bin/sh
2
3set -x
4
5# This probably requires root to set up the probes, and
6# a low sys/kernel/perf_event_paranoid to record them.
7
8# Also, perf record can create huge (>1 GB) files on busy machines,
9# so it's recommended to run this on a tmpfs
10
11prog=$(which waypipe)
12capture_time=${1:-120}
13
14setup="perf buildid-cache -a `which waypipe` ; perf probe -d sdt_waypipe:* ; perf probe sdt_waypipe:* ;"
15sudo -- sh -c "$setup"
16sudo perf record -e sdt_waypipe:*,sched:sched_switch -aR sleep $capture_time
17sudo chmod 644 perf.data
18
19perf script --ns | gzip -9 >scriptfile.gz
20