[DTrace-devel] [PATCH v4] Implement the lockstat provider

Eugene Loh eugene.loh at oracle.com
Thu May 25 00:17:45 UTC 2023


Why does lockstat not report a function (e.g., dtrace -lP lockstat)?  I 
thought that some probes instrumented source code (e.g., lockstat) and 
therefore reported a module and function; others (like profile, cpc, 
dtrace) did not and therefore did not. It appears that lockstat is 
reporting a module but not a function, but clearly lockstat is 
instrumenting source code.

On 5/24/23 17:56, Kris Van Hees via DTrace-devel wrote:

> diff --git a/test/unittest/lockstat/tst.lv-adaptive-acquire-error.r.p b/test/unittest/lockstat/tst.lv-adaptive-acquire-error.r.p
> new file mode 100755
> +#!/usr/bin/awk -f
> +NR == 1 { next; }
> +NR == 2 && NF == 5 { $1 = "PROBE"; $4 = ""; gsub(/  +/, " "); print; next; }
> +NR == 2 && NF == 4 { $1 = "PROBE"; gsub(/  +/, " "); print; next; }
> +/^ *[0-9]+/ { exit; }
> +{ print; }

Since this is nontrivial (as Nick already mentioned) and awk can be 
commented, how about a few comments to explain what's going on?

The two NR==2 lines could perhaps be reduced to:
         NR==2 { print "PROBEID", $2, $3, $NF; next; }

What's the exit line for?



More information about the DTrace-devel mailing list