240104.1 · e2eed5b1bddafc3f871ad0baf4cb8b690b564480
bin: add samply scripts
`perf` has been quite finnicky and/or slow lately. So I'm going to try to switch over to `samply` for most of my profiling needs. The downside of `samply` is that it works by serving HTTP. So if I'm working on a remote machine (which I usually do, e.g., my workstation at home from my laptop in the other room), then I need to do some port forwarding to make that server accessible to me. This requires agreement on port numbers and other things. So let's make it simple with some scripts.
reading declarations
@@ -0,0 +1,6 @@+#!/bin/sh++set -e+host="$(myhostname)"+port="$(sr-port "$host")"+samply record --no-open --port "$port" -- "$@"
@@ -0,0 +1,10 @@+#!/bin/sh++set -e+if [ $# != 1 ]; then+ echo "Usage: sr-forward <host>" >&2+ exit 1+fi+host="$1"+port="$(sr-port "$host")"+ssh -L $port:127.0.0.1:$port "$host"
@@ -0,0 +1,22 @@+#!/bin/sh++set -e+if [ $# != 1 ]; then+ echo "Usage: sr-port <host>" >&2+ exit 1+fi+host="$1"++case "$host" in+ duff)+ port=3000+ ;;+ armlisa)+ port=3001+ ;;+ *)+ echo "sr-port: unrecognized hostname $host" >&2+ exit 1+ ;;+esac+echo $port