From: claudio Date: Fri, 12 May 2023 14:34:00 +0000 (+0000) Subject: Add example user profile btrace script. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9dd2df6aa8c1e6f5e9bf7dbaa8de656a22936b38;p=openbsd Add example user profile btrace script. With and OK mpi@ --- diff --git a/share/btrace/Makefile b/share/btrace/Makefile index 900b5f69570..acca2897a58 100644 --- a/share/btrace/Makefile +++ b/share/btrace/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.1 2021/10/23 19:37:35 mpi Exp $ +# $OpenBSD: Makefile,v 1.2 2023/05/12 14:34:00 claudio Exp $ -FILES= kprofile.bt runqlat.bt +FILES= kprofile.bt runqlat.bt uprofile.bt NOOBJ= noobj install: diff --git a/share/btrace/uprofile.bt b/share/btrace/uprofile.bt new file mode 100644 index 00000000000..17ce622ee96 --- /dev/null +++ b/share/btrace/uprofile.bt @@ -0,0 +1,17 @@ +/* $OpenBSD: uprofile.bt,v 1.1 2023/05/12 14:34:00 claudio Exp $ */ + +/* + * uprofile.bt Userland profiling (stack sampling) at 100Hz. + * + * To produce a FlameGraph process the output with stackcollapse-bpftrace.pl + * and flamegraph.pl found in: + * https://github.com/brendangregg/FlameGraph + * + * The PID of the to be monitored process is the first optional argument to + * btrace(8). + * This only works for a single static binary where everything was compiled + * with -fno-omit-frame-pointer. + */ +profile:hz:100 / pid == $1 / { + @[ustack] = count(); +}